[PD] audio delay

Frank Barknecht fbar at footils.org
Tue Dec 2 14:50:23 CET 2008


Hallo,
joel silvestre hat gesagt: // joel silvestre wrote:

> I'm searching how to do a sample resolution audio delay. Is it possible?

Yes, even in multiple ways: One would involve [rzero~]. rzero acts like
this on audio input: 

 y[n] = x[n] - a[n] * x[n-1]

 y[n]: output sample n
 x[n]: input sample n

If you set a = 1 and substract this from the original signal, you get: 

 y[n] = x[n] - (x[n] - x[n-1]) = x[n-1]

You could also set a = -1 and substract the original from rzero's output:

 y[n] = (x[n] + x[n-1]) - x[n]) = x[n-1]

Both are a one sample delays. In Pd the first approach would realised as:

 [inlet~]
 | \
 |  [rzero~ 1]
 |  |
 [-~]
 |
 [outlet~]

Another way would be to use a normal delay with [delwrite~] and
[delread~] and set the delay time to be one sample. One sample at a
samplerate SR takes 1/SR seconds or 1000/SR milliseconds, so do this: 

 [samplerate~]
 |
 [swap 1000]
 |     /
 [/~  ]
 |
 [* 1]
 |
 [delread~ mydelay]

Use this approach if you want to calculate delay times with more than
one sample. Just change the [* 1] to [* 5] to get a delay of five
samples, for example.

Ciao




More information about the Pd-list mailing list