[music-dsp] idiot requests assistance with feedback delay

frank.maltman at googlemail.com frank.maltman at googlemail.com
Wed Apr 2 07:23:08 EDT 2008


On 20080401 20:02:41, Charles Henry wrote:
> I don't know either, but I'm happy to try to proofread
> 
> Here's something
> 
> d->samp_buf = calloc(1, d->samp_len);
> 
> how about
> d->samp_buf = calloc(d->samp_len, sizeof(float) );
> 
> sizeof(float) is 4 bytes, if I'm not mistaken.  (I had to check the syntax too.)

You're absolutely right there. I've updated that.

> Could you describe what this part does:
> 

For each element of the input buffer:
>    for (pos = 0; pos < in_len; pos += d->samp_chan) {

For each sample element of the current frame (one 'sample' per channel):
>      for (chan = 0; chan < d->samp_chan; ++chan) {

Take a sample from the input buffer:
>        isv = buf[pos + chan];

Take a sample from the delay buffer:
>        dsv = d->samp_buf[d->samp_pos];

Calculate the output value for the current sample by mixing input and delay
buffer sample:
>        osv = (mix_dry * isv) + (mix_wet * dsv);

Write the delayed signal into the delay buffer, scaling by the feedback amount:
>        d->samp_buf[d->samp_pos] = isv + (feed * dsv);

Increment the pointer for the delay buffer, wrapping at the current delay time
in samples:
>        d->samp_pos = (d->samp_pos + 1) % dlen;

Write the value taken earlier into the output buffer (really the same thing as
the input buffer - the function is destructive):
>        buf[pos + chan] = osv;

>      }
>    }
> 

> I need some notes to read it better.

Hope that cleared things up a bit.

Frank


More information about the music-dsp mailing list