If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
resonator, filter and delays??
18 posts
• Page 2 of 2 • 1, 2
Re: resonator, filter and delays??
Nubeat7 wrote:i only need to take care of the groupdelay which is 2 samples at second order filters like biquads?
so am i right when i just subtract 3 samples from from delaytime to compensate delay and biquad filter?
It is not that simple. The delay is not just 2 samples for biquads but depends on filter parameters and is different for different frequency components of the input signal (as your linked page shows). What matters here is the phase delay not the group delay. If you post your resonator schematics I can try to help you more specifically.
-
martinvicanek - Posts: 1328
- Joined: Sat Jun 22, 2013 8:28 pm
Re: resonator, filter and delays??
Why are you compensating the biquad delay by 2 samples? the biquad shouldn't introduce any delay by default. You can easily check that b using peaking/shelving filter and setting the gain to 0dB.
- KG_is_back
- Posts: 1196
- Joined: Tue Oct 22, 2013 5:43 pm
- Location: Slovakia
Re: resonator, filter and delays??
KG_is_back wrote:Why are you compensating the biquad delay by 2 samples? the biquad shouldn't introduce any delay by default. You can easily check that b using peaking/shelving filter and setting the gain to 0dB.
i thought because because of this part at the end of the code:
- Code: Select all
x2=x1;
x1=in;
...
anyway i did some more research the last days and also found a thread on KVR about 'how to get phase response of a biquad' : http://www.kvraudio.com/forum/viewtopic.php?p=5225317
and i tried to port this into FS, sadly FS offers no atan2 which would be needed and my skills are not enough to make this, further there are some other things which are not clear..
thanks guys for your patience - this is completely new dsp area for me but i need to understand it one day and your answers bring me closer to it
Last edited by Nubeat7 on Sun Aug 02, 2015 6:38 am, edited 1 time in total.
-
Nubeat7 - Posts: 1347
- Joined: Sat Apr 14, 2012 9:59 am
- Location: Vienna
Re: resonator, filter and delays??
Nubeat7 wrote:i thought because because of this part at the end of the code:Code: Select all x2=x1; x1=in;
If you look more closely you see that
- Code: Select all
y0=b0*x0+b1*x1+b2*x2-... //the output consists of all inputs ranging from the actual input and the previous ones
Filter is basically a code (or a circuit/rezonator) that adds inputs and outputs along with their previous versions in a way, that certain frequency elements get boosted/damped and delayed while others don't.
One very simple way to explain this is the way they were invented.
Led's say you have a digital signal (a sequence of values) that changes rapidly and you what it to have more stable values. So you say, let the output be 50% the input and 50% previous output. Logically that means you reduce the change between those to by 50%.
- Code: Select all
b0=0.5;
a1=-0.5; //We use negative a1 that is later subtracted for a reason I can't really explain
y0=x0*b0-y1*a1;
y1=y0;
if you enter sequence
0 , 0.5 , 1 , 0.5 , 0*, -0.5 , -1 , -0.5 , 0
it will put out
0 , 0.25 , 0.625 , 0.4625 , 0.2312* , -0.01975...
As you can see the changes in signal are smaller, but also the signal is shifted in time ( in the first signal, the zero is crossed exactly at fifth sample - in output it is somewhere between 5fth and 6th closer to 6th )
In terms of frequency that means you leave DC (constant part of the signal) untouched and Nyquist frequency (instant rapid changes) reduced to 0.5. Slower Changes are reduced in smaller way, than fast ones - lower frequencies are passed, high frequencies are cut. You have just constructed a simple low-pass filter.
Much more smarter mathematicians then we are have taken this even further. They invented Fourier transform that let you analyze frequency response and phase shifts on signals and Z-transform to calculate A and B coefficients or filters for specific frequency and phase response desired.
I hope this little explanation helps...
- KG_is_back
- Posts: 1196
- Joined: Tue Oct 22, 2013 5:43 pm
- Location: Slovakia
Re: resonator, filter and delays??
Here is a little test setup for delay estimation. A sine wave is fed into a biquad lowpass filter and compared against the original. The resulting delay can be measured by evaluating zero crossings. As you see, it may well exceed 2 samples.
I have also included a calculated delay from the real and imaginary parts of the transfer function. This may be a bit CPU intensive, so I have also thrown in a (much cheaper) low frequency approximation (which may or may not be sufficient).
I'll try to apply this to your (Nubeat7) schematic tomorrow. I see you have both a lowpass and a highpass in the feedback loop, so that's something to consider.
I have also included a calculated delay from the real and imaginary parts of the transfer function. This may be a bit CPU intensive, so I have also thrown in a (much cheaper) low frequency approximation (which may or may not be sufficient).
I'll try to apply this to your (Nubeat7) schematic tomorrow. I see you have both a lowpass and a highpass in the feedback loop, so that's something to consider.
-
martinvicanek - Posts: 1328
- Joined: Sat Jun 22, 2013 8:28 pm
Re: resonator, filter and delays??
Okay so here is what I got so far. The lowpass delay compensation works quite well, octaves stay nicely in tune. I also checked with a reference sine tuned to the fundamental frequency.
However, I don't know how to go about the highpass delay. While it is possible to compensate the delay for the fundamental, the harmonics will in general be off because there is dispersion. This actually makes things worse when the highpass cutoff is above the fundamental. In that case it is better to disable the delay compensation.
However, I don't know how to go about the highpass delay. While it is possible to compensate the delay for the fundamental, the harmonics will in general be off because there is dispersion. This actually makes things worse when the highpass cutoff is above the fundamental. In that case it is better to disable the delay compensation.
- Attachments
-
- resx002.fsm
- (1.04 MiB) Downloaded 1329 times
-
martinvicanek - Posts: 1328
- Joined: Sat Jun 22, 2013 8:28 pm
Re: resonator, filter and delays??
thank you martin, it works great with the lowpass! it sounds much better now
as you said with the HP it is better to leave it..
btw. i was wondering about the midi to poly primitive which you are using in your previous version, it doesn`t exist in my FS version - also useful for the toolbox..
as you said with the HP it is better to leave it..
btw. i was wondering about the midi to poly primitive which you are using in your previous version, it doesn`t exist in my FS version - also useful for the toolbox..
-
Nubeat7 - Posts: 1347
- Joined: Sat Apr 14, 2012 9:59 am
- Location: Vienna
Re: resonator, filter and delays??
Nubeat7 wrote:btw. i was wondering about the midi to poly primitive which you are using in your previous version, it doesn`t exist in my FS version
I probably took it over from SM.
-
martinvicanek - Posts: 1328
- Joined: Sat Jun 22, 2013 8:28 pm
18 posts
• Page 2 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 71 guests