Support

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 ?

DSP related issues, mathematics, processing and techniques

Delay - shorter than one sample ?

Postby Rocko » Tue Feb 21, 2017 5:09 pm

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
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 ?

Postby martinvicanek » Tue Feb 21, 2017 7:25 pm

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.
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Re: Delay - shorter than one sample ?

Postby Spogg » Wed Feb 22, 2017 9:09 am

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
User avatar
Spogg
 
Posts: 3358
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England

Re: Delay - shorter than one sample ?

Postby tulamide » Wed Feb 22, 2017 10:19 am

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 ?

Postby martinvicanek » Wed Feb 22, 2017 11:09 am

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 :lol:)

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).
User avatar
martinvicanek
 
Posts: 1328
Joined: Sat Jun 22, 2013 8:28 pm

Re: Delay - shorter than one sample ?

Postby mHz » Wed Feb 22, 2017 4:01 pm

Eventually in the spectrum the comb filter effect is similar to just a low- or highpass filter.
So interpolating it really helps.
User avatar
mHz
 
Posts: 19
Joined: Sun Sep 05, 2010 6:01 pm
Location: Eindhoven, Nederland

Re: Delay - shorter than one sample ?

Postby Rocko » Sun Mar 05, 2017 11:21 am

Hi,

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 ?

Postby nix » Sun Mar 05, 2017 11:58 am

Have you got the audio pack and the dsp pack?
Here is the delay->
interpolated delay.fsm
(2.07 KiB) Downloaded 1443 times
User avatar
nix
 
Posts: 817
Joined: Tue Jul 13, 2010 10:51 am


Return to DSP

Who is online

Users browsing this forum: No registered users and 9 guests