Mozzi  version v2.0
sound synthesis library for Arduino
AudioDelay< NUM_BUFFER_SAMPLES, T > Class Template Reference

Audio delay line for comb filter, flange, chorus and short echo effects. More...

#include <AudioDelay.h>

Detailed Description

template<unsigned int NUM_BUFFER_SAMPLES, class T = int8_t>
class AudioDelay< NUM_BUFFER_SAMPLES, T >

Audio delay line for comb filter, flange, chorus and short echo effects.

Template Parameters
NUM_BUFFER_SAMPLESis the length of the delay buffer in samples. This should be a power of two. The largest delay you'll fit in an atmega328 will be 512 cells, which at 16384 Hz sample rate is 31 milliseconds. More of a flanger or a doubler than an echo. The amount of memory available for delays on other chips will vary. AudioDelay() doesn't have feedback. If you want feedback, use AudioDelayFeedback().
thetype of numbers to use for the signal in the delay. The default is int8_t, but int could be useful when adding manual feedback. When using int, the input should be limited to 15 bits width, ie. -16384 to 16383.

Definition at line 27 of file AudioDelay.h.

Public Member Functions

 AudioDelay ()
 Constructor.
 
 AudioDelay (unsigned int delaytime_cells)
 Constructor. More...
 
next (T in_value, unsigned int delaytime_cells)
 Input a value to the delay and retrieve the signal in the delay line at the position delaytime_cells. More...
 
next (T in_value)
 Input a value to the delay and retrieve the signal in the delay line at the position delaytime_cells. More...
 
void set (unsigned int delaytime_cells)
 Set the delay time, measured in cells. More...
 
read (unsigned int delaytime_cells)
 Retrieve the signal in the delay line at the position delaytime_cells. More...
 

Constructor & Destructor Documentation

◆ AudioDelay()

template<unsigned int NUM_BUFFER_SAMPLES, class T = int8_t>
AudioDelay< NUM_BUFFER_SAMPLES, T >::AudioDelay ( unsigned int  delaytime_cells)
inline

Constructor.

Parameters
delaytime_cellsdelay time expressed in cells.
For example, 128 cells delay at MOZZI_AUDIO_RATE would produce a time delay of 128/16384 = 0.0078125 s = 7.8 ms Put another way, num_cells = delay_seconds * MOZZI_AUDIO_RATE.

Definition at line 49 of file AudioDelay.h.

Member Function Documentation

◆ next() [1/2]

template<unsigned int NUM_BUFFER_SAMPLES, class T = int8_t>
T AudioDelay< NUM_BUFFER_SAMPLES, T >::next ( in_value)
inline

Input a value to the delay and retrieve the signal in the delay line at the position delaytime_cells.

Parameters
in_valuethe signal input.

Definition at line 77 of file AudioDelay.h.

◆ next() [2/2]

template<unsigned int NUM_BUFFER_SAMPLES, class T = int8_t>
T AudioDelay< NUM_BUFFER_SAMPLES, T >::next ( in_value,
unsigned int  delaytime_cells 
)
inline

Input a value to the delay and retrieve the signal in the delay line at the position delaytime_cells.

Parameters
in_valuethe signal input.
delaytime_cellssets the delay time in terms of cells in the delay buffer.

Definition at line 59 of file AudioDelay.h.

◆ read()

template<unsigned int NUM_BUFFER_SAMPLES, class T = int8_t>
T AudioDelay< NUM_BUFFER_SAMPLES, T >::read ( unsigned int  delaytime_cells)
inline

Retrieve the signal in the delay line at the position delaytime_cells.

It doesn't change the stored internal value of _delaytime_cells.

Parameters
delaytime_cellsindicates the delay time in terms of cells in the delay buffer.

Definition at line 104 of file AudioDelay.h.

◆ set()

template<unsigned int NUM_BUFFER_SAMPLES, class T = int8_t>
void AudioDelay< NUM_BUFFER_SAMPLES, T >::set ( unsigned int  delaytime_cells)
inline

Set the delay time, measured in cells.

Parameters
delaytime_cellshow many cells to delay the input signal by.

Definition at line 94 of file AudioDelay.h.