Class fx_delay

Inheritance Relationships

Base Type

Class Documentation

class fx_delay : public fx_effect

Effect: Delay/echo.

A delay effect is basically an echo machine. Unlike other delay pedals, we have a massive amount of delay memory so you can create delays that are several seconds long. Also, this delay block allows you to add your own effects to the “feedback” path of the echo so each echo can run though an effects chain. Put a pitch shifter in here and each echo changes pitch. Add a phase shifter and each echo gets progressively “phasey”. Put another echo effect in there and create effects like the movie Inception.

This example creates a delay and places a low-pass dampening filter in the feedback loop so each echo gets darker and darker.

#include <dreammakerfx.h>

fx_delay    delay_1(1000.0, // Initial delay length of 1 second / 1000ms
                         5000.0, // Max delay of 5 seconds
                         0.7,    // Initial feedback value of 0.7
                         1.0,    // Clean mix
                         0.7,    // Delay / echo mix
                         true);  // Enable fx send/receive loop

fx_biquad_filter  fb_filt(1200.0,                // 1200 Hz starting frequency
                          FILTER_WIDTH_NORMAL,   // Width of the filter is narrow
                          BIQUAD_TYPE_LPF);      // Type is low-pass

void setup() {
  pedal.init(); // Initialize pedal

  // Route audio through effects
  pedal.route_audio(pedal.instr_in, delay_1.input);
  pedal.route_audio(delay_1.output, pedal.amp_out);

  // Route filter through delay fx send/receive loop
  pedal.route_audio(delay_1.fx_send, fb_filt.input);
  pedal.route_audio(fb_filt.output, delay_1.fx_receive);

  pedal.add_bypass_button(FOOTSWITCH_LEFT); // Use left footswitch/LED to bypass effect 

  pedal.run();    // Run effects
}

void loop() {
  pedal.service(); // Run pedal service to take care of stuff
}

There are lots of cool things you can do with delays: Create a set of delays in parallel with lengths (1000ms, 750ms, 333ms) to create cool rhythmic echoes, create elaborate effects chains in the delay’s feedback loop, add delays into the feedback fx send/receive loop of the delay, control a filter from a delayed version of a signal

Public Functions

fx_delay(float delay_len_ms, float feedback)

Basic constructor for delay effect.

// Set up a basic 1 second echo
fx_delay    delay_1(1000.0, // Initial delay length of 1 second / 1000ms
                    0.7);    // Initial feedback value of 0.7

Parameters
  • [in] delay_len_ms: The length of the echo in milliseconds (1000.0 milliseconds = 1 second). For the advanced constructor, the delay_len_max_ms determines the total memory allocated for this delay and will be the max length. In the basic constructor, the initial length is also the maximum delay length.

  • [in] feedback: How much of the output is feedback to the input. A value of 0.0 will product a single delay. A value of 1.0 will produce endless echoes. 0.5-0.7 is a nice decaying echo.

fx_delay(float delay_len_ms, float delay_len_max_ms, float feedback, float mix_dry, float mix_wet, bool enable_ext_fx)

Advanced constructor for delay effect.

// Set up a delay with max delay of 5 seconds and an fx send/receive loop
fx_delay    delay_1(1000.0, // Initial delay length of 1 second / 1000ms
                    5000.0, // Max delay of 5 seconds
                    0.7,    // Initial feedback value of 0.7
                    1.0,    // Clean mix
                    0.7,    // Delay / echo mix
                    true);  // Enable fx send/receive loop

Parameters
  • [in] delay_len_ms: The length of the echo in milliseconds (1000.0 milliseconds = 1 second). For the advanced constructor, the delay_len_max_ms determines the total memory allocated for this delay and will be the max length. In the basic constructor, the initial length is also the maximum delay length.

  • [in] delay_len_max_ms: The maximum length of the delay (if the delay length is modified)

  • [in] feedback: How much of the output is feedback to the input. A value of 0.0 will product a single delay. A value of 1.0 will produce endless echoes. 0.5-0.7 is a nice decaying echo.

  • [in] mix_dry: The mix of the clean signal (0.0 to 1.0)

  • [in] mix_wet: The mix of the delayed/echo signal (0.0 to 1.0)

  • [in] enable_ext_fx: Whether or not to enable the fx send / receive loop (true or false)

void enable()

Enables the delay effect.

void bypass()

Bypass the delay effect (will just pass clean audio through)

void set_length_ms(float len_ms)

Update the length of the delay. Note, if you used the simple constructor, the length of the delay needs to be less than or equal to the initial delay value. If you want the ability to set a longer delay than the initial value, use the advanced constructor as this will allow you to also specify the total amount of delay space to allocate which is then the maximum length of a delay.

void set_feedback(float feedback)

Updates the feedback parameter of the delay.

Parameters
  • [in] feedback: How much of the output is feedback to the input. A value of 0.0 will product a single delay. A value of 1.0 will produce endless echoes. 0.5-0.7 is a nice decaying echo.

void set_dry_mix(float dry_mix)

Sets the dry mix.

Parameters
  • [in] dry_mix: The mix of the clean signal (0.0 to 1.0)

void set_wet_mix(float wet_mix)

Updates the wet / delay mix of the delay (0.0 to 1.0)

Parameters
  • [in] wet_mix: The mix of the delayed/echo signal (0.0 to 1.0)

Public Members

fx_audio_node *input

Audio routing node [input]: primary audio input

fx_audio_node *output

Audio routing node [output]: primary audio output

fx_audio_node *fx_send

Audio routing node [output]: effect loop send before entering delay line of this effect

// Route audio through effects
pedal.route_audio(pedal.instr_in, delay_1.input);
pedal.route_audio(delay_1.output, pedal.amp_out);

// Route filter through delay fx send/receive loop
pedal.route_audio(delay_1.fx_send, fb_filt.input);
pedal.route_audio(fb_filt.output, delay_1.fx_receive);

fx_audio_node *fx_receive

Audio routing node [output]: effect loop return before entering delay line of this effect

// Route audio through effects
pedal.route_audio(pedal.instr_in, delay_1.input);
pedal.route_audio(delay_1.output, pedal.amp_out);

// Route filter through delay fx send/receive loop
pedal.route_audio(delay_1.fx_send, fb_filt.input);
pedal.route_audio(fb_filt.output, delay_1.fx_receive);

fx_control_node *length_ms

Control routing node [input]: Length of delay line in milliseconds (1/1000s of a second)

fx_control_node *feedback

Control routing node [input]: Feedback ratio (between 0.0 and 1.0)

fx_control_node *dry_mix

Control routing node [input]: Dry mix (between 0.0 and 1.0)

fx_control_node *wet_mix

Control routing node [input]: Wet mix (between 0.0 and 1.0)