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
Delay - shorter than one sample ?
8 posts
• Page 1 of 1
Delay - shorter than one sample ?
Hi,
Playing around with very short delays and came up with an intrguing question.
At 48KHz sample rate, a single sample time span is (1/48,000 sec) = 20.833 uSec [micro seconds].
So, using the stock DELAY module, I can add a single delay of 20.833 uSec and next step would be 41.667 (2x20.833).
But, what if I needed a delay of 30 uSec, just between these two values. Is this possible? Can I delay a signal by 1.5 samples or does it have to be an integer?
Is there some kind of technique to achieve such a thing?
Thanks,
Rocko
Playing around with very short delays and came up with an intrguing question.
At 48KHz sample rate, a single sample time span is (1/48,000 sec) = 20.833 uSec [micro seconds].
So, using the stock DELAY module, I can add a single delay of 20.833 uSec and next step would be 41.667 (2x20.833).
But, what if I needed a delay of 30 uSec, just between these two values. Is this possible? Can I delay a signal by 1.5 samples or does it have to be an integer?
Is there some kind of technique to achieve such a thing?
Thanks,
Rocko
Last edited by Rocko on Wed Feb 22, 2017 10:31 am, edited 1 time in total.
- Rocko
- Posts: 186
- Joined: Tue May 15, 2012 12:42 pm
Re: Delay - shorter than one sample ?
There is a thing called fractional delay which does what you describe. It uses some sort of interpolation to produce intersample values. The simplest interpolation would be linear, but there are more sophisticated ones. It depends on your application which one is appropriate.
-
martinvicanek - Posts: 1328
- Joined: Sat Jun 22, 2013 8:28 pm
Re: Delay - shorter than one sample ?
martinvicanek wrote:There is a thing called fractional delay which does what you describe. It uses some sort of interpolation to produce intersample values. The simplest interpolation would be linear, but there are more sophisticated ones. It depends on your application which one is appropriate.
Since Flowstone processes the stream elements just once per sample period how could the fractional thing work?
I expect some sort of Martinmagic to follow...
Cheers
Spogg
-
Spogg - Posts: 3358
- Joined: Thu Nov 20, 2014 4:24 pm
- Location: Birmingham, England
Re: Delay - shorter than one sample ?
Wouldn't it be easier to use latency to be ahead of time and then do your work on fractions after they have happened?
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: Delay - shorter than one sample ?
Tulamide, you are right, of course processing can only be on samples in the past, including the current sample. (Maybe we should put a time travel prim on the wishlist )
No magic, seek for "Interpolated Delay" in your toolbox and you shall find:
Basically you take a weighted average as the value between two samples (linear interpolation).
No magic, seek for "Interpolated Delay" in your toolbox and you shall find:
- Code: Select all
streamin in;
streamout out;
streamin delay;
float index;
float intdelay,frac;
float temp1,temp2;
float out1;
float mem[44100];
float MAXDELAY=44100;
stage(2)
{
mem[index]=in;
intdelay = delay - 0.499999;
intdelay = rndint(intdelay);
frac = delay - intdelay;
temp1 = index - intdelay;
temp2 = temp1 - 1;
temp1 = temp1 + (temp1 < 0)&MAXDELAY;
temp1 = mem[temp1];
temp2 = temp2 + (temp2 < 0)&MAXDELAY;
temp2 = mem[temp2];
out = temp1 + frac * (temp2 - temp1);
out1 = out;
index=index+1;
index=(index<MAXDELAY)&index;
}
Basically you take a weighted average as the value between two samples (linear interpolation).
-
martinvicanek - Posts: 1328
- Joined: Sat Jun 22, 2013 8:28 pm
Re: Delay - shorter than one sample ?
Eventually in the spectrum the comb filter effect is similar to just a low- or highpass filter.
So interpolating it really helps.
So interpolating it really helps.
-
mHz - Posts: 19
- Joined: Sun Sep 05, 2010 6:01 pm
- Location: Eindhoven, Nederland
Re: Delay - shorter than one sample ?
Hi,
Thanks.
any idea why I couldn't find the 'interpolated delay' prim in my toolbox?
Using FlowStone 3.0.8.1 ...
Thanks,
Rocko
Thanks.
any idea why I couldn't find the 'interpolated delay' prim in my toolbox?
Using FlowStone 3.0.8.1 ...
Thanks,
Rocko
- Rocko
- Posts: 186
- Joined: Tue May 15, 2012 12:42 pm
Re: Delay - shorter than one sample ?
Have you got the audio pack and the dsp pack?
Here is the delay->
Here is the delay->
-
nix - Posts: 817
- Joined: Tue Jul 13, 2010 10:51 am
8 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 41 guests