Most simple and smooth feedback delay

notes
fDlyTime = delay time parameter (0-1)

i = input index
j = delay index
code
1
2
3
4
5
6
7
8
9
if( i >= SampleRate )
    i = 0;

j = i - (fDlyTime * SampleRate);

if( j < 0 )
    j += SampleRate;

Output = DlyBuffer[ i++ ] = Input + (DlyBuffer[ j ] * fFeedback);

Comments

// This algo didn't seem to work on testing again, just change:
// -------------------------------------------------------------------
Output = DlyBuffer[ i++ ] = Input + (DlyBuffer[ j ] * fFeedback);
// -------------------------------------------------------------------
// to
// ---------------------------------------------------------------
Output = DlyBuffer[ i ] = Input + (DlyBuffer[ j ] * fFeedback);

i++;
// ---------------------------------------------------------------
// and it will work fine.
// Here's a more clear source. both BufferSize and MaxDlyTime are amounts of samples. BufferSize
// should best be 2*MaxDlyTime to have proper sound.
// -
if( i >= BufferSize )
    i = 0;

j = i - (fDlyTime * MaxDlyTime);

if( j < 0 )
    j += BufferSize;

Output = DlyBuffer[ i ] = Input + (DlyBuffer[ j ] * fFeedback);

i++;