Summary

Members Descriptions
class fx_adsr_envelope Effect: Envelope generator.
class fx_amplitude_mod Effect: Amplitude modulator for creating tremelo-like effects.
class fx_biquad_filter Effect: Biquad filter for implementing various types of filters (low pass, high pass, band pass, etc.)
class fx_compressor Effect: Compressor/Limiter.
class fx_delay Effect: Delay/echo.
class fx_destructor Effect: Destructor - provides various types of hard and soft destructors for creating different types of distortions.
class fx_envelope_tracker Effect: Envelope tracker.
class fx_gain Effect: Gain - used to increase or decrease the volume of an audio signal.
class fx_looper Effect: Looper - capture and playback loops.
class fx_mixer_2 Utility: 2 channel mixer.
class fx_mixer_3 Utility: 3 channel mixer.
class fx_mixer_4 Utility: 4 channel mixer.
class fx_octave Effect: - chops up audio in the time domain and pipes to different effects.
class fx_oscillator Utility: Oscillator that can has both audio and control outputs.
class fx_phase_shifter Effect: Phase shifter for creating rich phase shifts.
class fx_pitch_shift Effect: Pitch shifter - shifts audio up or down in pitch.
class fx_ring_mod Effect: Ring modulator - frequency modulates the audio - crazy sounding.
class fx_slicer Effect: Slicer - chops up audio in the time domain and pipes to different effects.
class fx_variable_delay Effect: Variable delay - foundational block of flangers and choruses.

class fx_adsr_envelope

class fx_adsr_envelope
  : public fx_effect

Effect: Envelope generator.

An envelope generator creates a volume envelope that can applied to either the audio from the instrument or an oscillator.

Here’s a good explanation of what ADSR means: Video

Summary

Members Descriptions
public fx_audio_node * input Audio routing node: primary audio input
public fx_audio_node * output Audio routing node: primary audio output
public fx_control_node * attack_ms Control routing node [input]: envelope attack in milliseconds
public fx_control_node * decay_ms Control routing node [input]: envelope decay in milliseconds
public fx_control_node * sustain_ms Control routing node [input]: envelope sustain in milliseconds
public fx_control_node * release_ms Control routing node [input]: envelope release in milliseconds
public fx_control_node * peak_ratio Control routing node [input]: relative volume after attack (0.0 to 1.0) - will be scaled by output volume
public fx_control_node * sustain_ratio Control routing node [input]: relative volume during sustain (0.0 to 1.0) - will be scaled by output volume
public fx_control_node * gain_out Control routing node [input]: output pain
public fx_control_node * playing Control routing node [input]: playing - continuously set to non-zero to during play and zero to stop
public fx_control_node * value Control routing node [output]: value of the envelope
public inline fx_adsr_envelope(float attack_ms,float decay_ms,float sustain_ms,float release_ms,float gain_out) Constructs a new instance of the envelope.
public inline void enable() Enable the this_effect (it is enabled by default)
public inline void bypass() Bypass the this_effect (will just pass clean audio through)
public inline void print_params(void) Prints the parameters for the delay effect.

Members

public fx_audio_node * input

Audio routing node: primary audio input

public fx_audio_node * output

Audio routing node: primary audio output

public fx_control_node * attack_ms

Control routing node [input]: envelope attack in milliseconds

public fx_control_node * decay_ms

Control routing node [input]: envelope decay in milliseconds

public fx_control_node * sustain_ms

Control routing node [input]: envelope sustain in milliseconds

public fx_control_node * release_ms

Control routing node [input]: envelope release in milliseconds

public fx_control_node * peak_ratio

Control routing node [input]: relative volume after attack (0.0 to 1.0) - will be scaled by output volume

public fx_control_node * sustain_ratio

Control routing node [input]: relative volume during sustain (0.0 to 1.0) - will be scaled by output volume

public fx_control_node * gain_out

Control routing node [input]: output pain

public fx_control_node * playing

Control routing node [input]: playing - continuously set to non-zero to during play and zero to stop

public fx_control_node * value

Control routing node [output]: value of the envelope

public inline fx_adsr_envelope(float attack_ms,float decay_ms,float sustain_ms,float release_ms,float gain_out)

Constructs a new instance of the envelope.

Parameters

public inline void enable()

Enable the this_effect (it is enabled by default)

public inline void bypass()

Bypass the this_effect (will just pass clean audio through)

public inline void print_params(void)

Prints the parameters for the delay effect.


class fx_amplitude_mod

class fx_amplitude_mod
  : public fx_effect

Effect: Amplitude modulator for creating tremelo-like effects.

An amplitude modulator will change the volume or “amplitude” of the audio to create various types of tremelo effects.

Here’s a video demonstrating how amplitude modulators work: Video

Code example:

/**
 * This is an implementation of a typical delay / echo pedal.
 *
 * Left pot: depth - the depth of the tremelo effect
 * Center pot: delay time - modulation rate
 * Right pot: type of modulation - from counterclockwise to clockwise is sine -> triangle -> square -> random
 *
 * Left footswitch: bypass - turns on and off the effect
 * Right footswitch: tap - tap it a few times at a set interval to update the vibrato modulation rate
 *
 * This effect uses a tiny amount of the available processing power and memory.
 * It's provided as an example of how to use the various features of the fx_amplitude_mod block
 *
 *
 */
#include <dreammakerfx.h>

fx_amplitude_mod  tremy(1.0,       // Rate is 1.0Hz (1 cycle per second)
                        0.5,       // Initial depth is 0.5 (50% volume reduction)
                        0.0,       // Initial phase is 0 degrees
                        OSC_SINE,  // Sine oscillator
                        false);    // Not using an external oscillator

void setup() {

  // Initialize the pedal!
  pedal.init();

  // Route audio from instrument -> fx_amplitude_mod -> amp
  pedal.route_audio(pedal.instr_in, tremy.input);
  pedal.route_audio(tremy.output, pedal.amp_out);

  // left footswitch is bypass
  pedal.add_bypass_button(FOOTSWITCH_LEFT);

  // Right foot switch is tap loop length
  pedal.add_tap_interval_button(FOOTSWITCH_RIGHT, true);

  // Run this effect
  pedal.run();

}

void loop() {

  // If new tempo has been tapped in, use that to control tremelo rate
  if (pedal.new_tap_interval()) {
    tremy.set_rate_hz(pedal.get_tap_freq_hz());
  }

  // Left pot controls depth
  if (pedal.pot_left.has_changed()) {
    tremy.set_depth(pedal.pot_left.val);
  }

  // Center pot controls rate
  if (pedal.pot_center.has_changed()) {
    float rate_hz = pedal.pot_center.val* 10.0;
    pedal.set_tap_blink_rate_hz(rate_hz);
    tremy.set_rate_hz(rate_hz);
  }

  // Right pot sets the oscillator type
  if (pedal.pot_right.has_changed()) {
    if (pedal.pot_right.val < 0.25) {
      tremy.set_lfo_type(OSC_SINE);
    } else if (pedal.pot_right.val < 0.5) {
      tremy.set_lfo_type(OSC_TRIANGLE);
    } else if (pedal.pot_right.val < 0.75) {
      tremy.set_lfo_type(OSC_SQUARE_SOFT);
    } else {
      tremy.set_lfo_type(OSC_RANDOM);
    }
  }

   // Run pedal service to take care of stuff
  pedal.service();

}

Summary

Members Descriptions
public fx_audio_node * input Audio routing node: primary audio input
public fx_audio_node * output Audio routing node: primary audio output
public fx_audio_node * ext_mod_in Audio routing node: external modulator audio input
public fx_control_node * depth Control routing node: amplifude modulator depth (should be between 0.0 and 1.0)
public fx_control_node * rate_hz Control routing node: amplitide modulator rate (Hz) (i.e. 1.0 = once per second)
public inline fx_amplitude_mod(float rate_hz,float depth) Basic constructor/initializer for amplitude modulator.
public inline fx_amplitude_mod(float rate_hz,float depth,float initial_phase_deg,OSC_TYPES modulation_type,bool use_ext_modulator) Advanced constructor for the amplitude modulator.
public inline void enable() Enable the amplitude modululator (it is enabled by default)
public inline void bypass() Bypass the amplitude modululator (will just pass clean audio through)
public inline void set_depth(float depth) Sets the depth of the amplitude modululator.
public inline void set_rate_hz(float rate_hz) Sets the rate of the modulator in Hertz (cycles per second)
public inline void set_lfo_type(OSC_TYPES new_type) Sets the the type of oscillator used as the LFO.
public inline void print_params(void) Print the parameters for this effect.

Members

public fx_audio_node * input

Audio routing node: primary audio input

public fx_audio_node * output

Audio routing node: primary audio output

public fx_audio_node * ext_mod_in

Audio routing node: external modulator audio input

public fx_control_node * depth

Control routing node: amplifude modulator depth (should be between 0.0 and 1.0)

public fx_control_node * rate_hz

Control routing node: amplitide modulator rate (Hz) (i.e. 1.0 = once per second)

public inline fx_amplitude_mod(float rate_hz,float depth)

Basic constructor/initializer for amplitude modulator.

Parameters

public inline fx_amplitude_mod(float rate_hz,float depth,float initial_phase_deg,OSC_TYPES modulation_type,bool use_ext_modulator)

Advanced constructor for the amplitude modulator.

Parameters

public inline void enable()

Enable the amplitude modululator (it is enabled by default)

public inline void bypass()

Bypass the amplitude modululator (will just pass clean audio through)

public inline void set_depth(float depth)

Sets the depth of the amplitude modululator.

Parameters

public inline void set_rate_hz(float rate_hz)

Sets the rate of the modulator in Hertz (cycles per second)

Parameters

public inline void set_lfo_type(OSC_TYPES new_type)

Sets the the type of oscillator used as the LFO.

Parameters

public inline void print_params(void)

Print the parameters for this effect.


class fx_biquad_filter

class fx_biquad_filter
  : public fx_effect

Effect: Biquad filter for implementing various types of filters (low pass, high pass, band pass, etc.)

The biquad filter can be used to create static filters such as equalizers and dynamic filters such as auto-wahs and other interesting swept filtering effects.

Here’s a nice video about three different parameters of a biquad: f: cutoff/center frequency, q: filter width, and g: filter gain

Summary

Members Descriptions
public fx_audio_node * input Audio routing node: primary audio input
public fx_audio_node * output Audio routing node: primary audio output
public fx_control_node * freq Control routing node: center/critical frequency of the filter in Hz (i.e. 800.0 for 800Hz)
public fx_control_node * q Control routing node: width of the filter
public fx_control_node * gain Control routing node: gain of the filter (used in shelving filters)
public inline fx_biquad_filter(float filt_freq,float filt_resonance,BIQUAD_FILTER_TYPE filt_type) Basic constructor for biquad filter.
public inline fx_biquad_filter(float filt_freq,float filt_resonance,BIQUAD_FILTER_TYPE filt_type,BIQUAD_FILTER_ORDER order) Basic constructor for biquad filter.
public inline fx_biquad_filter(float filt_freq,float filt_resonance,float filter_gain,BIQUAD_FILTER_TYPE filt_type,EFFECT_TRANSITION_SPEED trans_speed) Advanced constructor for biquad filter.
public inline fx_biquad_filter(float filt_freq,float filt_resonance,float filter_gain_db,BIQUAD_FILTER_TYPE filt_type,EFFECT_TRANSITION_SPEED trans_speed,BIQUAD_FILTER_ORDER order) Advanced constructor for biquad filter.
public inline void enable() Enable the biquad filter (it is enabled by default)
public inline void bypass() Bypass the biquad filter (will just pass clean audio through)
public inline void set_freq(float freq) Sets a new cutoff/critical frequency (Hz).
public inline void set_q(float q) Sets a new Q factor for the filter. For more information on Q factor, read this: https://en.wikipedia.org/wiki/Q_factor.
public inline void set_resonance(float filt_resonance) Sets the resonance; 1.0 is none (0.7071)
public inline void set_gain(float gain) Sets the filter gain. This is only used in shelving filters.
public inline void print_params(void) Print the parameters for this effect.

Members

public fx_audio_node * input

Audio routing node: primary audio input

public fx_audio_node * output

Audio routing node: primary audio output

public fx_control_node * freq

Control routing node: center/critical frequency of the filter in Hz (i.e. 800.0 for 800Hz)

public fx_control_node * q

Control routing node: width of the filter

public fx_control_node * gain

Control routing node: gain of the filter (used in shelving filters)

public inline fx_biquad_filter(float filt_freq,float filt_resonance,BIQUAD_FILTER_TYPE filt_type)

Basic constructor for biquad filter.

Parameters

public inline fx_biquad_filter(float filt_freq,float filt_resonance,BIQUAD_FILTER_TYPE filt_type,BIQUAD_FILTER_ORDER order)

Basic constructor for biquad filter.

Parameters

public inline fx_biquad_filter(float filt_freq,float filt_resonance,float filter_gain,BIQUAD_FILTER_TYPE filt_type,EFFECT_TRANSITION_SPEED trans_speed)

Advanced constructor for biquad filter.

Parameters

public inline fx_biquad_filter(float filt_freq,float filt_resonance,float filter_gain_db,BIQUAD_FILTER_TYPE filt_type,EFFECT_TRANSITION_SPEED trans_speed,BIQUAD_FILTER_ORDER order)

Advanced constructor for biquad filter.

Parameters

public inline void enable()

Enable the biquad filter (it is enabled by default)

public inline void bypass()

Bypass the biquad filter (will just pass clean audio through)

public inline void set_freq(float freq)

Sets a new cutoff/critical frequency (Hz).

Parameters

public inline void set_q(float q)

Sets a new Q factor for the filter. For more information on Q factor, read this: https://en.wikipedia.org/wiki/Q_factor.

Parameters

public inline void set_resonance(float filt_resonance)

Sets the resonance; 1.0 is none (0.7071)

Parameters

public inline void set_gain(float gain)

Sets the filter gain. This is only used in shelving filters.

Parameters

public inline void print_params(void)

Print the parameters for this effect.


class fx_compressor

class fx_compressor
  : public fx_effect

Effect: Compressor/Limiter.

Here’s a nice primer on how compressors work:

Example:

/**
 * This is an implementation of a typical compressor pedal
 *
 * Left pot: depth - the threshold where compression kicks in
 * Center pot: delay time - the amount to compress after threshold crossed
 * Right pot: type of modulation - output gain
 *
 * Left footswitch: bypass - turns on and off the effect
 * Right footswitch: gain boost - press to double instrument volume when effect engaged
 *
 * This effect uses a tiny amount of the available processing power and memory.
 * It's provided as an example of how to use the various features of the fx_compressor block
 *
 */
#include <dreammakerfx.h>

fx_compressor compressor( -30.0,    // Threshold in dB
                          8,        // Ratio (1:8)
                          10.0,     // Attack (10ms)
                          100.0,    // Release (100ms)
                          2.0);     // Output gain (2x);

void setup() {

  // Initialize the pedal!
  pedal.init();

  // Route audio from instrument -> fx_compressor -> amp
  pedal.route_audio(pedal.instr_in, compressor.input);
  pedal.route_audio(compressor.output, pedal.amp_out);

  // left footswitch is bypass
  pedal.add_bypass_button(FOOTSWITCH_LEFT);

  // Run this effect
  pedal.run();

}

// Use this to save our gain setting for when gain boost footswitched released
float pot_gain_setting = 0;


void loop() {

  // The right footswitch is being used as a momentary gain boost of 2x
  if (pedal.button_pressed(FOOTSWITCH_RIGHT, true)) {
    compressor.set_output_gain(pot_gain_setting*2.0);
  }
  if (pedal.button_released(FOOTSWITCH_RIGHT, true)) {
    compressor.set_output_gain(pot_gain_setting);
  }

  // Left pot changes threshold from -12dB to -72dB
  if (pedal.pot_left.has_changed()) {
      compressor.set_threshold(-12.0 - (pedal.pot_left.val*60));
  }

  // Center pot sets compression ratio
  if (pedal.pot_center.has_changed()) {
    compressor.set_ratio(pedal.pot_center.val_log*100.0);
  }

  // Right pot controls compressor output gain
  if (pedal.pot_right.has_changed()) {
    pot_gain_setting = pedal.pot_right.val*6;
    compressor.set_output_gain(pot_gain_setting);
  }

  // Service
  pedal.service();

}

Summary

Members Descriptions
public fx_audio_node * input Audio routing node: primary audio input
public fx_audio_node * output Audio routing node: primary audio output
public fx_control_node * threshold Control routing node [input]: Compressor/limiter threshold in dB (i.e. -30.0)
public fx_control_node * ratio Control routing node [input]: Compressor/limiter compression ratio (a value of 100.0 would be a ratio of 1:100)
public fx_control_node * attack Control routing node [input]: Compressor/limiter attack rate in milliseconds
public fx_control_node * release Control routing node [input]: Compressor/limiter release rate in milliseconds
public fx_control_node * out_gain Control routing node [input]: Compressor/limiter output gain (linear value so a value of 2.0 would double the signal amplitude)
public inline fx_compressor(float thresh,float ratio,float attack,float release,float gain_out)  
public inline void enable() Enable the this_effect (it is enabled by default)
public inline void bypass() Bypass the this_effect (will just pass clean audio through)
public inline void set_threshold(float threshold)  
public inline void set_ratio(float ratio)  
public inline void set_attack(float attack)  
public inline void set_release(float release)  
public inline void set_output_gain(float gain_out)  
public inline void print_params(void)  

Members

public fx_audio_node * input

Audio routing node: primary audio input

public fx_audio_node * output

Audio routing node: primary audio output

public fx_control_node * threshold

Control routing node [input]: Compressor/limiter threshold in dB (i.e. -30.0)

public fx_control_node * ratio

Control routing node [input]: Compressor/limiter compression ratio (a value of 100.0 would be a ratio of 1:100)

public fx_control_node * attack

Control routing node [input]: Compressor/limiter attack rate in milliseconds

public fx_control_node * release

Control routing node [input]: Compressor/limiter release rate in milliseconds

public fx_control_node * out_gain

Control routing node [input]: Compressor/limiter output gain (linear value so a value of 2.0 would double the signal amplitude)

public inline fx_compressor(float thresh,float ratio,float attack,float release,float gain_out)

public inline void enable()

Enable the this_effect (it is enabled by default)

public inline void bypass()

Bypass the this_effect (will just pass clean audio through)

public inline void set_threshold(float threshold)

public inline void set_ratio(float ratio)

public inline void set_attack(float attack)

public inline void set_release(float release)

public inline void set_output_gain(float gain_out)

public inline void print_params(void)


class fx_delay

class fx_delay
  : public fx_effect

Effect: Delay/echo.

This is basically an echo effect.

Example:

/**
 * This is an implementation of a typical delay / echo pedal.   
 * 
 * Left pot: "feedback" - basically how long the echo lasts before dying out
 * Center pot: delay time - how far apart the echos are (0.1 to 3 seconds)
 * Right pot: wet/dry mix - the mix of clean audio and the echo effect
 * 
 * Left footswitch: bypass - turns on and off the effect
 * Right footswitch: tap - tap it a few times at a set interval and the delay will lock on
 * 
 * This effect uses a tiny amount of the available processing power and memory.
 * It's provided as an example of how to use the various features of the fx_delay block
 * 
 * 
 */
#include <dreammakerfx.h>

fx_delay    my_delay(3000.0,  // 3000 ms / 3 seconds
                     0.6);    // 0.6 feedback ratio

void setup() {
  // put your setup code here, to run once:

  // Initialize the pedal!
  pedal.init();

  // Route audio from instrument -> my_delay -> amp
  pedal.route_audio(pedal.instr_in, my_delay.input);
  pedal.route_audio(my_delay.output, pedal.amp_out);

  // left footswitch is bypass
  pedal.add_bypass_button(FOOTSWITCH_LEFT);

  // Right foot switch is tap delay length
  pedal.add_tap_interval_button(FOOTSWITCH_RIGHT, true);

  pedal.run();
}

void loop() {

  // If new delay time has been tapped in, use that
  if (pedal.new_tap_interval()) { 
    my_delay.set_length_ms(pedal.get_tap_interval_ms());
  } 

  // Left pot changes the feedback of the delay (determining how long the echoes last)
  if (pedal.pot_left.has_changed()) {
    my_delay.set_feedback(pedal.pot_left.val);
  }
  
  // Right pot changes the wet / dry mix
  if (pedal.pot_right.has_changed()) {
    my_delay.set_dry_mix(1.0 - pedal.pot_right.val);
    my_delay.set_wet_mix(pedal.pot_right.val);
  }  
  
  // Center pot can also be used to change the delay length 
  // from 100ms to 3000ms
  if (pedal.pot_center.has_changed()) {
    float new_length_ms = 100.0 + pedal.pot_center.val*2900.0;
    my_delay.set_length_ms(new_length_ms);
    pedal.set_tap_blink_rate_ms(new_length_ms);
  }    
  
  // Service pedal
  pedal.service();
}

Summary

Members Descriptions
public fx_audio_node * input Audio routing node [input]: primary audio input
public fx_audio_node * output Audio routing node [output]: primary audio output
public fx_audio_node * fx_send Audio routing node [output]: effect loop send before entering delay line of this effect
public fx_audio_node * fx_receive Audio routing node [output]: effect loop return before entering delay line of this effect
public fx_control_node * length_ms Control routing node [input]: Length of delay line in milliseconds (1/1000s of a second)
public fx_control_node * feedback Control routing node [input]: Feedback ratio (between 0.0 and 1.0)
public fx_control_node * dry_mix Control routing node [input]: Dry mix (between 0.0 and 1.0)
public fx_control_node * wet_mix Control routing node [input]: Wet mix (between 0.0 and 1.0)
public inline fx_delay(float delay_len_ms,float feedback) Basic constructor for delay effect.
public inline 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.
public inline void enable() Enable the this_effect (it is enabled by default)
public inline void bypass() Bypass the this_effect (will just pass clean audio through)
public inline void set_length_ms(float len_ms) Update the length of the delay.
public inline void set_feedback(float feedback) Updates the feedback parameter of the delay.
public inline void set_dry_mix(float dry_mix) Updates the dry / clean mix of the delay (0.0 to 1.0)
public inline void set_wet_mix(float wet_mix) Updates the wet / delay mix of the delay (0.0 to 1.0)
public inline void print_params(void) Prints the parameters for the delay effect.

Members

public fx_audio_node * input

Audio routing node [input]: primary audio input

public fx_audio_node * output

Audio routing node [output]: primary audio output

public fx_audio_node * fx_send

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

public fx_audio_node * fx_receive

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

public fx_control_node * length_ms

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

public fx_control_node * feedback

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

public fx_control_node * dry_mix

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

public fx_control_node * wet_mix

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

public inline fx_delay(float delay_len_ms,float feedback)

Basic constructor for delay effect.

Parameters

public inline 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.

Parameters

public inline void enable()

Enable the this_effect (it is enabled by default)

public inline void bypass()

Bypass the this_effect (will just pass clean audio through)

public inline 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.

public inline void set_feedback(float feedback)

Updates the feedback parameter of the delay.

public inline void set_dry_mix(float dry_mix)

Updates the dry / clean mix of the delay (0.0 to 1.0)

public inline void set_wet_mix(float wet_mix)

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

public inline void print_params(void)

Prints the parameters for the delay effect.


class fx_destructor

class fx_destructor
  : public fx_effect

Effect: Destructor - provides various types of hard and soft destructors for creating different types of distortions.

Here’s a nice summary of clipping using polynomials to create various types of distortions topic: http://sites.music.columbia.edu/cmc/music-dsp/FAQs/guitar_distortion_FAQ.html

Example:

/**
 * This is an implementation of a basic distortion pedal
 *
 * Left pot: depth - the threshold where compression kicks in
 * Center pot: delay time - the amount to compress after threshold crossed
 * Right pot: type of modulation - output gain
 *
 * Left footswitch: bypass - turns on and off the effect
 * Right footswitch: drive boost - hold down to set drive to max
 *
 * This effect uses a tiny amount of the available processing power and memory.
 * It's provided as an example of how to use the various features of the fx_compressor block
 *
 */
#include <dreammakerfx.h>

fx_destructor       destruct(0.1,           // Clipping level (from 0 to 1.0) - lower is heavier distortion
                             4.0,           // Input drive
                             SMOOTH_CLIP);  // Distortion function = fuzz

fx_biquad_filter    tone_filter(800.0,              // Initial filter cutoff freq
                                1.0,                // Standard resonance
                                BIQUAD_TYPE_BPF);   // Filter type is bandpass


fx_gain             out_gain(1.0);
void setup() {
  // put your setup code here, to run once:

  // Initialize the pedal!
  pedal.init(true, true);

  // Route audio through distortion, tone filter and then output gain
  pedal.route_audio(pedal.instr_in, destruct.input);
  pedal.route_audio(destruct.output, tone_filter.input);
  pedal.route_audio(tone_filter.output, out_gain.input);
  pedal.route_audio(out_gain.output, pedal.amp_out);

  // left footswitch is bypass
  pedal.add_bypass_button(FOOTSWITCH_LEFT);

  // Run this effect
  pedal.run();

}

float pot_drive = 1.0;
void loop() {

  // When right footswitch is pressed, max drive!
  if (pedal.button_pressed(FOOTSWITCH_RIGHT, true)) {
    destruct.set_param_2(16);
  }
  if (pedal.button_released(FOOTSWITCH_RIGHT, true)) {
    destruct.set_param_2(pot_drive);
  }

  // Left pot is distortion drive
  if (pedal.pot_left.has_changed()) {
    pot_drive = 1 + pedal.pot_left.val_log*16.0;
    destruct.set_param_2(pot_drive);
  }

  // Center pot is tone knob from 200 to 1200Hz
  if (pedal.pot_center.has_changed()) {
    tone_filter.set_freq(200.0 + pedal.pot_center.val*1400.0);
  }

  // Right pot is out gain
  if (pedal.pot_right.has_changed()) {
    out_gain.set_gain(0.3333 + pedal.pot_right.val*3.0);
  }

  // Run pedal service to take care of stuff
  pedal.service();

}

Summary

Members Descriptions
public fx_audio_node * input Audio routing node [input]: primary audio input
public fx_audio_node * output Audio routing node [output]: primary audio output
public fx_control_node * param_1 Control routing node [input]: clipping threshold (0.0 -> 1.0)
public fx_control_node * param_2 Control routing node [input]: input drive multiplier before destructor (up to 64.0)
public inline fx_destructor(float param_1,float param_2,DESTRUCTOR_TYPE clip_type) Basic constructor for the destructor.
public inline fx_destructor(float param_1,float param_2,DESTRUCTOR_TYPE clip_type,bool upsample) Advanced constructor for the destructor.
public inline void enable() Enable the destructor (it is enabled by default)
public inline void bypass() Bypass the destructor (will just pass clean audio through)
public inline void set_param_1(float new_param_1) Sets the clipping threshold.
public inline void set_param_2(float new_param_2) Sets the input drive before the destructor.
public inline void print_params(void) Print the parameters for this effect.

Members

public fx_audio_node * input

Audio routing node [input]: primary audio input

public fx_audio_node * output

Audio routing node [output]: primary audio output

public fx_control_node * param_1

Control routing node [input]: clipping threshold (0.0 -> 1.0)

public fx_control_node * param_2

Control routing node [input]: input drive multiplier before destructor (up to 64.0)

public inline fx_destructor(float param_1,float param_2,DESTRUCTOR_TYPE clip_type)

Basic constructor for the destructor.

Parameters

public inline fx_destructor(float param_1,float param_2,DESTRUCTOR_TYPE clip_type,bool upsample)

Advanced constructor for the destructor.

Parameters

public inline void enable()

Enable the destructor (it is enabled by default)

public inline void bypass()

Bypass the destructor (will just pass clean audio through)

public inline void set_param_1(float new_param_1)

Sets the clipping threshold.

Parameters

public inline void set_param_2(float new_param_2)

Sets the input drive before the destructor.

Parameters

public inline void print_params(void)

Print the parameters for this effect.


class fx_envelope_tracker

class fx_envelope_tracker
  : public fx_effect

Effect: Envelope tracker.

Here’s a nice tutorial on one effect that can be created with an envelope tracker

Summary

Members Descriptions
public fx_audio_node * input  
public fx_control_node * decay_speed_ms  
public fx_control_node * attack_speed_ms  
public fx_control_node * envelope  
public inline fx_envelope_tracker(float attack_speed_ms,float decay_speed_ms,bool triggered)  
public inline void set_attack_speed_ms(float attack_speed_ms)  
public inline void set_decay_speed_ms(float decay_speed_ms)  
public inline void print_params(void)  

Members

public fx_audio_node * input

public fx_control_node * decay_speed_ms

public fx_control_node * attack_speed_ms

public fx_control_node * envelope

public inline fx_envelope_tracker(float attack_speed_ms,float decay_speed_ms,bool triggered)

public inline void set_attack_speed_ms(float attack_speed_ms)

public inline void set_decay_speed_ms(float decay_speed_ms)

public inline void print_params(void)


class fx_gain

class fx_gain
  : public fx_effect

Effect: Gain - used to increase or decrease the volume of an audio signal.

Summary

Members Descriptions
public fx_audio_node * input Audio routing node: primary audio input
public fx_audio_node * output Audio routing node: primary audio output
public fx_control_node * gain Control routing node: gain value input - you can then link the envelope filter to this to create slow swell effects
public inline fx_gain(float gain_val) Basic constructor/initializer for gain.
public inline fx_gain(float gain_val,EFFECT_TRANSITION_SPEED gain_trans_speed) Advanced constructor for the gain.
public inline void enable() Enable the this_effect (it is enabled by default)
public inline void bypass() Bypass the this_effect (will just pass clean audio through)
public inline void set_gain(float new_gain) Sets the gain multiplier. For example, a value of 2 will double the volume/amplitude and a value of 0.5 will halve the volume/amplitude.
public inline void set_gain_db(float new_gain_db) Sets the gain multiplier using decibles. For example, a value of 0 will keep volume the same, a value of 6 will double the amplitude/volume, a value of -6 will halve the amplitude/volume.
public inline void print_params(void) Prints the parameters for the delay effect.

Members

public fx_audio_node * input

Audio routing node: primary audio input

public fx_audio_node * output

Audio routing node: primary audio output

public fx_control_node * gain

Control routing node: gain value input - you can then link the envelope filter to this to create slow swell effects

public inline fx_gain(float gain_val)

Basic constructor/initializer for gain.

Parameters

public inline fx_gain(float gain_val,EFFECT_TRANSITION_SPEED gain_trans_speed)

Advanced constructor for the gain.

Parameters

public inline void enable()

Enable the this_effect (it is enabled by default)

public inline void bypass()

Bypass the this_effect (will just pass clean audio through)

public inline void set_gain(float new_gain)

Sets the gain multiplier. For example, a value of 2 will double the volume/amplitude and a value of 0.5 will halve the volume/amplitude.

Parameters

public inline void set_gain_db(float new_gain_db)

Sets the gain multiplier using decibles. For example, a value of 0 will keep volume the same, a value of 6 will double the amplitude/volume, a value of -6 will halve the amplitude/volume.

Parameters

public inline void print_params(void)

Prints the parameters for the delay effect.


class fx_looper

class fx_looper
  : public fx_effect

Effect: Looper - capture and playback loops.

Here’s a nice tutorial on how looper pedals work in general <iframe width="560" height="315" src="https://www.youtube.com/embed/Gd0NhglZWtw" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen>=””></iframe>

Example:

 #include "dreammmakerfx.h"

/*
This is a basic looper pedal that uses the route_control() function to pass the tapped
loop length along to an echo effect. The echo effect is set to 1/4 the lenght of the loop
so each time a new loop is set, the echo time is updated to.

                +--------+    +-----------+
                |        |    |           |
                |        |    |           |
Instr In +----->+ Looper +--->+   Delay   +-----> Amp Out
                |        |    |           |
                |        |    |           |
                +---+----+    +------+----+
                    |                ^
                    +----------------+
                        loop length

 */
#include <dreammakerfx.h>

fx_looper   loopy( 0.8,   // Dry mix
                   0.8,   // Looped audio mix
                   12,    // Max loop length in seconds
                   false); // Disable FX processing as audio enters the loop

fx_delay    echo(3000,    // Max lenght of 3 seconds
                 0.7 );   // Feedback of 0.7

void setup() {

  // put your setup code here, to run once:
  pedal.init();

  // for template, just pass audio from input to output jack
  pedal.route_audio(pedal.instr_in, loopy.input);
  pedal.route_audio(loopy.output, echo.input);
  pedal.route_audio(echo.output, pedal.amp_out);

  // Connect the tapped loop length of our looper to the delay size and divide by 1/4 and convert to milliseconds (so four echoes per loop)
  pedal.route_control(loopy.loop_length_seconds,
                      echo.length_ms,
                      250.0,        // Scale by 1000 * 1/4 (convert to ms and then divide by 4 so we get four echoes)
                      0);           // Offset = 0


  // Run this effect
  pedal.run();

}

void loop() {


  // Service
  pedal.service();
}

Summary

Members Descriptions
public fx_audio_node * input Audio routing node: primary audio input
public fx_audio_node * output Audio routing node: primary audio output
public fx_audio_node * preproc_send Audio routing node: pre-loop effects send (process audio before it ends up in the loop)
public fx_audio_node * preproc_receive Audio routing node: pre-loop effects receive (process audio before it ends up in the loop)
public fx_control_node * start Control routing node: Trigger to start loop recording
public fx_control_node * stop Control routing node: Trigger to stop loop recording
public fx_control_node * playback_rate Control routing node: Loop playback rate (1.0 is recorded rate, > 1.0 is faster / higher pitch, < 1.0 is slower, <0 is reverse)
public fx_control_node * dry_mix Control routing node: clean/dry mix
public fx_control_node * loop_mix Control routing node: clean/dry mix
public fx_control_node * loop_length_seconds Control routing node: [output] loop length - can be tied to things like delay length to create delay lines that are synced to the loop length
public fx_control_node * loop_length_seconds_set Control routing node: [input] loop length - used to set loop length before a loop is recorded (to sync with other loops)
public inline fx_looper(float looper_dry_mix,float looper_loop_mix,float looper_max_length_seconds,bool looper_enable_loop_preprocessing) Constructor/initializer for amplitude modulator.
public inline void enable() Enable the this_effect (it is enabled by default)
public inline void bypass() Bypass the this_effect (will just pass clean audio through)
public inline void start_loop_recording()  
public inline void stop_loop_recording()  
public inline void stop_loop_playback()  
public inline void set_playback_rate(float playback_rate)  
public inline void set_loop_mix(float new_loop_mix) Sets the loop mix.
public inline void set_dry_mix(float new_dry_mix) Sets the dry mix.
public inline void print_params(void) Prints the parameters for the delay effect.

Members

public fx_audio_node * input

Audio routing node: primary audio input

public fx_audio_node * output

Audio routing node: primary audio output

public fx_audio_node * preproc_send

Audio routing node: pre-loop effects send (process audio before it ends up in the loop)

public fx_audio_node * preproc_receive

Audio routing node: pre-loop effects receive (process audio before it ends up in the loop)

public fx_control_node * start

Control routing node: Trigger to start loop recording

public fx_control_node * stop

Control routing node: Trigger to stop loop recording

public fx_control_node * playback_rate

Control routing node: Loop playback rate (1.0 is recorded rate, > 1.0 is faster / higher pitch, < 1.0 is slower, <0 is reverse)

public fx_control_node * dry_mix

Control routing node: clean/dry mix

public fx_control_node * loop_mix

Control routing node: clean/dry mix

public fx_control_node * loop_length_seconds

Control routing node: [output] loop length - can be tied to things like delay length to create delay lines that are synced to the loop length

public fx_control_node * loop_length_seconds_set

Control routing node: [input] loop length - used to set loop length before a loop is recorded (to sync with other loops)

public inline fx_looper(float looper_dry_mix,float looper_loop_mix,float looper_max_length_seconds,bool looper_enable_loop_preprocessing)

Constructor/initializer for amplitude modulator.

Parameters

public inline void enable()

Enable the this_effect (it is enabled by default)

public inline void bypass()

Bypass the this_effect (will just pass clean audio through)

public inline void start_loop_recording()

public inline void stop_loop_recording()

public inline void stop_loop_playback()

public inline void set_playback_rate(float playback_rate)

public inline void set_loop_mix(float new_loop_mix)

Sets the loop mix.

Parameters

public inline void set_dry_mix(float new_dry_mix)

Sets the dry mix.

Parameters

public inline void print_params(void)

Prints the parameters for the delay effect.


class fx_mixer_2

class fx_mixer_2
  : public fx_effect

Utility: 2 channel mixer.

Summary

Members Descriptions
public fx_audio_node * input_1 Audio routing node [input]: audio input (mixer channel 1)
public fx_audio_node * input_2 Audio routing node [input]: audio input (mixer channel 2)
public fx_audio_node * output Audio routing node [output]: mixer output
public inline fx_mixer_2(void) Simple constructor takes no arguments.
public inline void print_params(void) Print the parameters for this effect.

Members

public fx_audio_node * input_1

Audio routing node [input]: audio input (mixer channel 1)

public fx_audio_node * input_2

Audio routing node [input]: audio input (mixer channel 2)

public fx_audio_node * output

Audio routing node [output]: mixer output

public inline fx_mixer_2(void)

Simple constructor takes no arguments.

public inline void print_params(void)

Print the parameters for this effect.


class fx_mixer_3

class fx_mixer_3
  : public fx_effect

Utility: 3 channel mixer.

Summary

Members Descriptions
public fx_audio_node * input_1 Audio routing node [input]: audio input (mixer channel 1)
public fx_audio_node * input_2 Audio routing node [input]: audio input (mixer channel 2)
public fx_audio_node * input_3 Audio routing node [input]: audio input (mixer channel 3)
public fx_audio_node * output Audio routing node [output]: mixer output
public inline fx_mixer_3(void) Simple constructor takes no arguments.
public inline void print_params(void) Print the parameters for this effect.

Members

public fx_audio_node * input_1

Audio routing node [input]: audio input (mixer channel 1)

public fx_audio_node * input_2

Audio routing node [input]: audio input (mixer channel 2)

public fx_audio_node * input_3

Audio routing node [input]: audio input (mixer channel 3)

public fx_audio_node * output

Audio routing node [output]: mixer output

public inline fx_mixer_3(void)

Simple constructor takes no arguments.

public inline void print_params(void)

Print the parameters for this effect.


class fx_mixer_4

class fx_mixer_4
  : public fx_effect

Utility: 4 channel mixer.

Summary

Members Descriptions
public fx_audio_node * input_1 Audio routing node [input]: audio input (mixer channel 1)
public fx_audio_node * input_2 Audio routing node [input]: audio input (mixer channel 2)
public fx_audio_node * input_3 Audio routing node [input]: audio input (mixer channel 3)
public fx_audio_node * input_4 Audio routing node [input]: audio input (mixer channel 4)
public fx_audio_node * output Audio routing node [output]: mixer output
public inline fx_mixer_4(void) Simple constructor takes no arguments.
public inline void print_params(void) Print the parameters for this effect.

Members

public fx_audio_node * input_1

Audio routing node [input]: audio input (mixer channel 1)

public fx_audio_node * input_2

Audio routing node [input]: audio input (mixer channel 2)

public fx_audio_node * input_3

Audio routing node [input]: audio input (mixer channel 3)

public fx_audio_node * input_4

Audio routing node [input]: audio input (mixer channel 4)

public fx_audio_node * output

Audio routing node [output]: mixer output

public inline fx_mixer_4(void)

Simple constructor takes no arguments.

public inline void print_params(void)

Print the parameters for this effect.


class fx_octave

class fx_octave
  : public fx_effect

Effect: - chops up audio in the time domain and pipes to different effects.

Summary

Members Descriptions
public fx_audio_node * input Audio routing node: primary audio input
public fx_audio_node * output Audio routing node: primary audio output
public fx_audio_node * synth_output Audio routing node: synth only raw output
public fx_audio_node * oct_1_output Audio routing node: octave 1 raw output
public fx_audio_node * oct_2_output Audio routing node: octave 2 raw output
public fx_control_node * clean_mix Control routing node: Clean mix (0.0 -> 1.0)
public fx_control_node * octave_mix Control routing node: Shaper mix (0.0 -> 1.0)
public fx_control_node * oct_1_mix Control routing node: Octave below mix (0.0 -> 1.0)
public fx_control_node * oct_2_mix Control routing node: Two octaves below mix (0.0 -> 1.0)
public inline fx_octave(OSC_TYPES type,float clean_mix,float oct_0_mix,float oct_1_mix,float oct_2_mix) Constructor for the octave.
public inline void enable() Enable the amplitude modululator (it is enabled by default)
public inline void bypass() Bypass the amplitude modululator (will just pass clean audio through)
public inline void set_clean_mix(float clean_mix) Sets clean / instrument mix.
public inline void set_oct_0_mix(float octave_mix) Sets the octave 0 (same frequency as incoming signal) mix.
public inline void set_oct_1_mix(float oct_1_mix) Sets mix of one octave down.
public inline void set_oct_2_mix(float oct_2_mix) Sets mix of two octaves down.
public inline void set_semitone_shift(int semitones_up) Sets the semitone shift for all three octave outputs.
public inline void print_params(void) Print the parameters for this effect.

Members

public fx_audio_node * input

Audio routing node: primary audio input

public fx_audio_node * output

Audio routing node: primary audio output

public fx_audio_node * synth_output

Audio routing node: synth only raw output

public fx_audio_node * oct_1_output

Audio routing node: octave 1 raw output

public fx_audio_node * oct_2_output

Audio routing node: octave 2 raw output

public fx_control_node * clean_mix

Control routing node: Clean mix (0.0 -> 1.0)

public fx_control_node * octave_mix

Control routing node: Shaper mix (0.0 -> 1.0)

public fx_control_node * oct_1_mix

Control routing node: Octave below mix (0.0 -> 1.0)

public fx_control_node * oct_2_mix

Control routing node: Two octaves below mix (0.0 -> 1.0)

public inline fx_octave(OSC_TYPES type,float clean_mix,float oct_0_mix,float oct_1_mix,float oct_2_mix)

Constructor for the octave.

Parameters

public inline void enable()

Enable the amplitude modululator (it is enabled by default)

public inline void bypass()

Bypass the amplitude modululator (will just pass clean audio through)

public inline void set_clean_mix(float clean_mix)

Sets clean / instrument mix.

Parameters

public inline void set_oct_0_mix(float octave_mix)

Sets the octave 0 (same frequency as incoming signal) mix.

Parameters

public inline void set_oct_1_mix(float oct_1_mix)

Sets mix of one octave down.

Parameters

public inline void set_oct_2_mix(float oct_2_mix)

Sets mix of two octaves down.

Parameters

public inline void set_semitone_shift(int semitones_up)

Sets the semitone shift for all three octave outputs.

Parameters

public inline void print_params(void)

Print the parameters for this effect.


class fx_oscillator

class fx_oscillator
  : public fx_effect

Utility: Oscillator that can has both audio and control outputs.

Summary

Members Descriptions
public fx_audio_node * output Audio routing node: primary audio oscillator output
public fx_control_node * freq Control routing node: frequency of the oscillator in Hz
public fx_control_node * amplitude Control routing node: amplitude of the oscillator (linear, typically between 0.0 and 1.0)
public fx_control_node * offset Control routing node: The DC offset of the amplifier. Useful if you’re using this to control parameters in ranges not centered around 0.0.
public fx_control_node * value Control routing node: The current value of the oscillator. Connect this node to external oscillator nodes for effects.
public inline fx_oscillator(OSC_TYPES osc_type,float freq,float amplitude) Basic constructor for an oscillator when used as an audio source.
public inline fx_oscillator(OSC_TYPES osc_type,float freq,float amplitude,float initial_phase) Basic constructor for an oscillator used as a control source.
public inline void enable() Enable the oscillator (it is enabled by default)
public inline void bypass() Bypass the oscillator (it will provide just a constant value)
public inline void set_frequency(float freq) Upates the frequency in Hz of the current oscillator.
public inline void set_amplitude(float amplitude) Updates the amplitude for the current oscillator.
public inline void set_oscillator_type(OSC_TYPES new_type) Sets the oscillator type.
public inline void print_params(void) Print the parameters for this effect.

Members

public fx_audio_node * output

Audio routing node: primary audio oscillator output

public fx_control_node * freq

Control routing node: frequency of the oscillator in Hz

public fx_control_node * amplitude

Control routing node: amplitude of the oscillator (linear, typically between 0.0 and 1.0)

public fx_control_node * offset

Control routing node: The DC offset of the amplifier. Useful if you’re using this to control parameters in ranges not centered around 0.0.

public fx_control_node * value

Control routing node: The current value of the oscillator. Connect this node to external oscillator nodes for effects.

public inline fx_oscillator(OSC_TYPES osc_type,float freq,float amplitude)

Basic constructor for an oscillator when used as an audio source.

Parameters

public inline fx_oscillator(OSC_TYPES osc_type,float freq,float amplitude,float initial_phase)

Basic constructor for an oscillator used as a control source.

Parameters

public inline void enable()

Enable the oscillator (it is enabled by default)

public inline void bypass()

Bypass the oscillator (it will provide just a constant value)

public inline void set_frequency(float freq)

Upates the frequency in Hz of the current oscillator.

Parameters

public inline void set_amplitude(float amplitude)

Updates the amplitude for the current oscillator.

Parameters

public inline void set_oscillator_type(OSC_TYPES new_type)

Sets the oscillator type.

Parameters

public inline void print_params(void)

Print the parameters for this effect.


class fx_phase_shifter

class fx_phase_shifter
  : public fx_effect

Effect: Phase shifter for creating rich phase shifts.

Example: phase_shifter_1.c

Summary

Members Descriptions
public fx_audio_node * input Audio routing node: primary audio input
public fx_audio_node * output Audio routing node: primary audio output
public fx_control_node * depth Control routing node: phase shifter depth (should be between 0.0 and 1.0)
public fx_control_node * rate_hz Control routing node: phase shifter rate (Hz) (i.e. 1.0 = once per second)
public fx_control_node * feedback Control routing node: phase shifter feedback (should be between -1.0 and 1.0)
public inline fx_phase_shifter(float rate_hz,float depth,float feedback) Basic constructor/initializer for the phase shifter.
public inline fx_phase_shifter(float rate_hz,float depth,float feedback,float inital_phase,OSC_TYPES mod_type) Constructs a new instance.
public inline void enable() Enable the phase shifter (it is enabled by default)
public inline void bypass() Bypass the phase shifter (will just pass clean audio through)
public inline void set_depth(float depth) Sets the depth of the phase shifter.
public inline void set_rate_hz(float rate_hz) Sets the rate of the phase shifter in Hertz (cycles per second)
public inline void set_feedback(float feedback) Sets the feedback of the phase shifter.
public inline void set_lfo_type(OSC_TYPES new_type) Sets the the type of oscillator used as the LFO.
public inline void print_params(void) Print the parameters for this effect.

Members

public fx_audio_node * input

Audio routing node: primary audio input

public fx_audio_node * output

Audio routing node: primary audio output

public fx_control_node * depth

Control routing node: phase shifter depth (should be between 0.0 and 1.0)

public fx_control_node * rate_hz

Control routing node: phase shifter rate (Hz) (i.e. 1.0 = once per second)

public fx_control_node * feedback

Control routing node: phase shifter feedback (should be between -1.0 and 1.0)

public inline fx_phase_shifter(float rate_hz,float depth,float feedback)

Basic constructor/initializer for the phase shifter.

Parameters

public inline fx_phase_shifter(float rate_hz,float depth,float feedback,float inital_phase,OSC_TYPES mod_type)

Constructs a new instance.

Parameters

public inline void enable()

Enable the phase shifter (it is enabled by default)

public inline void bypass()

Bypass the phase shifter (will just pass clean audio through)

public inline void set_depth(float depth)

Sets the depth of the phase shifter.

Parameters

public inline void set_rate_hz(float rate_hz)

Sets the rate of the phase shifter in Hertz (cycles per second)

Parameters

public inline void set_feedback(float feedback)

Sets the feedback of the phase shifter.

Parameters

public inline void set_lfo_type(OSC_TYPES new_type)

Sets the the type of oscillator used as the LFO.

Parameters

public inline void print_params(void)

Print the parameters for this effect.


class fx_pitch_shift

class fx_pitch_shift
  : public fx_effect

Effect: Pitch shifter - shifts audio up or down in pitch.

Summary

Members Descriptions
public fx_audio_node * input Audio routing node: primary audio input
public fx_audio_node * output Audio routing node: primary audio output
public fx_control_node * freq_shift  
public inline fx_pitch_shift(float pitch_shift_freq)  
public inline void enable() Enable the pitch shifter (it is enabled by default)
public inline void bypass() Bypass the pitch shifter (will just pass clean audio through)
public inline void set_freq_shift(float freq_shift) Update the pitch shifter value. A freq_shift of 0.5 will drop down one octave. A value of 2.0 will go up one octave. A value of 1.0 will play at current pitch (no shift).
public inline void print_params(void) Print the parameters for this effect.

Members

public fx_audio_node * input

Audio routing node: primary audio input

public fx_audio_node * output

Audio routing node: primary audio output

public fx_control_node * freq_shift

public inline fx_pitch_shift(float pitch_shift_freq)

public inline void enable()

Enable the pitch shifter (it is enabled by default)

public inline void bypass()

Bypass the pitch shifter (will just pass clean audio through)

public inline void set_freq_shift(float freq_shift)

Update the pitch shifter value. A freq_shift of 0.5 will drop down one octave. A value of 2.0 will go up one octave. A value of 1.0 will play at current pitch (no shift).

Parameters

public inline void print_params(void)

Print the parameters for this effect.


class fx_ring_mod

class fx_ring_mod
  : public fx_effect

Effect: Ring modulator - frequency modulates the audio - crazy sounding.

The following example is a full ring modulator pedal with tone control, wet/dry mix and of course ring modulator.

#include <dreammakerfx.h>


fx_ring_mod      ring_mod_1(200.0, // Carrier frequency in Hz
                            0.7);  // Depth 
fx_gain          wet_mix(0.5);
fx_gain          dry_mix(0.5);
fx_biquad_filter ring_mod_tone(500.0, FILTER_WIDTH_MEDIUM, BIQUAD_TYPE_LPF);
fx_mixer_2       wet_dry_mxer;


void setup() {
  
  // Init the effects system
  pedal.init();

  // Route audio through wet channel (ring mod->tone control)
  pedal.route_audio(pedal.instr_in, ring_mod_1.input);
  pedal.route_audio(ring_mod_1.output, ring_mod_tone.input);
  pedal.route_audio(ring_mod_tone.output, wet_dry_mxer.input_1);
  
  // Route audio through dry channel
  pedal.route_audio(pedal.instr_in, dry_mix.input);
  pedal.route_audio(dry_mix.output, wet_dry_mxer.input_2);

  // Mix wet and dry to output
  pedal.route_audio(wet_dry_mxer.output, pedal.amp_out);

  // Run it!
  pedal.run();

}
  
void loop() {

  // Connect Pot 0 to wet dry mix
  if (pedal.pot_0.has_changed()) { 
    wet_mix.set_gain(pedal.pot_0.val);
    dry_mix.set_gain(1.0 - pedal.pot_0.val);
  } 

  // Connect Pot 1 to carrier rate (Hz) from 50.0 to 1000.0Hz
  if (pedal.pot_1.has_changed()) { 
    ring_mod_1.set_freq(950.0 * pedal.pot_1.val+50.0);
  } 

  // Connect Pot 2 to tone
  if (pedal.pot_2.has_changed()) { 
    ring_mod_tone.set_freq((2000 * pedal.pot_2.val) + 500.0);
  } 

  // Service 
  pedal.service();
}


void sw1_pressed() { } 
void sw2_pressed() { }
void sw3_pressed() { }
void sw4_pressed() { }

Summary

Members Descriptions
public fx_audio_node * input Audio routing node [input]: primary audio input
public fx_audio_node * output Audio routing node [output]: primary audio output
public fx_control_node * freq Control routing node [input]: the carrier frequency of the ring moduator (Hz)
public fx_control_node * depth Control routing node [input]: modulation depth
public inline fx_ring_mod(float ring_mod_freq,float ring_mod_depth)  
public inline void enable() Enable the ring modulator (it is enabled by default)
public inline void bypass() Bypass the ring modulator (will just pass clean audio through)
public inline void set_freq(float new_freq) Sets the carrier frequency of the ring moduator (Hz)
public inline void set_depth(float new_depth) Sets the depth of the ring modulator (0.0 -> 1.0)
public inline void print_params(void) Prints the parameters for the delay effect.

Members

public fx_audio_node * input

Audio routing node [input]: primary audio input

public fx_audio_node * output

Audio routing node [output]: primary audio output

public fx_control_node * freq

Control routing node [input]: the carrier frequency of the ring moduator (Hz)

public fx_control_node * depth

Control routing node [input]: modulation depth

public inline fx_ring_mod(float ring_mod_freq,float ring_mod_depth)

public inline void enable()

Enable the ring modulator (it is enabled by default)

public inline void bypass()

Bypass the ring modulator (will just pass clean audio through)

public inline void set_freq(float new_freq)

Sets the carrier frequency of the ring moduator (Hz)

Parameters

public inline void set_depth(float new_depth)

Sets the depth of the ring modulator (0.0 -> 1.0)

Parameters

public inline void print_params(void)

Prints the parameters for the delay effect.


class fx_slicer

class fx_slicer
  : public fx_effect

Effect: Slicer - chops up audio in the time domain and pipes to different effects.

Example:

/*

 The slicer switches between output channels at a predefined rate.  It is 
 great for creating interesting rhymic effects.  This effect sends each channel
 of the slicer through band-pass filters that are tuned to different center
 frequencies.  The outputs of the filters are then mixed together using a 
 simple 4 channel mixer.
  
               +------------+   +-------------+   +---------+
               |            +-->+ BPF @ 200Hz +-->+         |
               |            |   +-------------+   |         |
               |            |   +-------------+   |         |
               |            +-->+ BPF @ 1200Hz+-->+         |
Instr In +---->+ Slicer x 4 |   +-------------+   | Mixer4  +----> Amp Out
               |            |   +-------------+   |         |
               |            +-->+ BPF @ 500Hz +-->+         |
               |            |   +-------------+   |         |
               |            |   +-------------+   |         |
               |            +-->+ BPF @ 800Hz +-->+         |
               +------------+   +-------------+   +---------+

 */
#include  <dreammakerfx.com>

      
// Set up a slicer for four channels
fx_slicer   slice4(1000.0, 4);

// Instances of the four bandpass (BPF) filters at different frequencies
fx_biquad_filter  filt1(200, FILTER_WIDTH_NARROW, BIQUAD_TYPE_BPF);
fx_biquad_filter  filt2(1000, FILTER_WIDTH_NARROW, BIQUAD_TYPE_BPF);
fx_biquad_filter  filt3(500, FILTER_WIDTH_NARROW, BIQUAD_TYPE_BPF);
fx_biquad_filter  filt4(800, FILTER_WIDTH_NARROW, BIQUAD_TYPE_BPF);
fx_mixer_4 mix4;

bool go = false;
bool running = false;

void setup() {

  pedal.init();

  pedal.route_audio(pedal.instr_in, slice4.input);
  
  pedal.route_audio(slice4.output_1, filt1.input);
  pedal.route_audio(slice4.output_2, filt2.input);
  pedal.route_audio(slice4.output_3, filt3.input);
  pedal.route_audio(slice4.output_4, filt4.input);

  pedal.route_audio(filt1.output, mix4.input_1);
  pedal.route_audio(filt2.output, mix4.input_2);
  pedal.route_audio(filt3.output, mix4.input_3);
  pedal.route_audio(filt4.output, mix4.input_4);
  
  pedal.route_audio(mix4.output, pedal.amp_out);

  // Optional code to print out the routing details to console
  if (true) {
    pedal.print_instance_stack();
    pedal.print_routing_table();
    pedal.print_param_tables();
  }

  // Run this effect
  pedal.run(); 

}

void loop() {

  static int now = millis();

  // Run pedal service to take care of stuff
  pedal.service();

  // Set period of slicer from 100ms through 3 seconds
  if (pedal.pot_0.has_changed()) {
    slice4.set_period_ms(100.0 + 3000.0 * (1.0 - pedal.pot_0.val));
  }

  if (pedal.pot_1.has_changed()) {
  }
  
  if (pedal.pot_2.has_changed()) {
  }

}

Summary

Members Descriptions
public fx_audio_node * input Audio routing node: primary audio input
public fx_audio_node * output_1 Audio routing node: audio output for slicer channel 0
public fx_audio_node * output_2 Audio routing node: audio output for slicer channel 1
public fx_audio_node * output_3 Audio routing node: audio output for slicer channel 2
public fx_audio_node * output_4 Audio routing node: audio output for slicer channel 3
public fx_audio_node * output_5 Audio routing node: audio output for slicer channel 4
public fx_audio_node * output_6 Audio routing node: audio output for slicer channel 5
public fx_audio_node * output_7 Audio routing node: audio output for slicer channel 6
public fx_audio_node * output_8 Audio routing node: audio output for slicer channel 7
public fx_control_node * period Control routing node: period in in milliseconds
public inline fx_slicer(float period_ms,int32_t channels) Basic constructor/initializer for the slicer.
public inline void enable() Enable the slicer (it is enabled by default)
public inline void bypass() Bypass the slicer (will just pass clean audio through)
public inline void set_period_ms(float period) Upates the period in milliseconds for the slicer.
public inline void print_params(void) Print the parameters for this effect.

Members

public fx_audio_node * input

Audio routing node: primary audio input

public fx_audio_node * output_1

Audio routing node: audio output for slicer channel 0

public fx_audio_node * output_2

Audio routing node: audio output for slicer channel 1

public fx_audio_node * output_3

Audio routing node: audio output for slicer channel 2

public fx_audio_node * output_4

Audio routing node: audio output for slicer channel 3

public fx_audio_node * output_5

Audio routing node: audio output for slicer channel 4

public fx_audio_node * output_6

Audio routing node: audio output for slicer channel 5

public fx_audio_node * output_7

Audio routing node: audio output for slicer channel 6

public fx_audio_node * output_8

Audio routing node: audio output for slicer channel 7

public fx_control_node * period

Control routing node: period in in milliseconds

public inline fx_slicer(float period_ms,int32_t channels)

Basic constructor/initializer for the slicer.

Parameters

public inline void enable()

Enable the slicer (it is enabled by default)

public inline void bypass()

Bypass the slicer (will just pass clean audio through)

public inline void set_period_ms(float period)

Upates the period in milliseconds for the slicer.

Parameters

public inline void print_params(void)

Print the parameters for this effect.


class fx_variable_delay

class fx_variable_delay
  : public fx_effect

Effect: Variable delay - foundational block of flangers and choruses.

The variable delay effect is the basis for a number of time-varying delay effects like chorus, flanger, phaser, vibrato, Leslie simulator, etc.

Here’s a nice tutorial on how variable delays work in these various building blocks: https://www.dsprelated.com/freebooks/pasp/Time_Varying_Delay_Effects.html

Example:

/**
 * This is an implementation of a typical flanger pedal.   
 * 
 * Left pot: depth - the depth of the flanger effect
 * Center pot: delay time - modulation rate
 * Right pot: feedback - the feedback has a big impact on the sound.  Full counter-clockwise is -1.0
 *                       center is 0.0, and full clock-wise is 1.0.
 * 
 * Left footswitch: bypass - turns on and off the effect
 * Right footswitch: tap - tap it a few times at a set interval to update the flanger modulation rate
 * 
 * This effect uses a tiny amount of the available processing power and memory.
 * It's provided as an example of how to use the various features of the fx_variable_delay block
 * 
 */
#include <dreammakerfx.h>

fx_variable_delay flangey(1.0,            // Initial oscillator rate of 1Hz (1 cycle / second)
                          0.5,            // Initial depth of 0.5
                          0.4,            // Initial feedback of 0.4
                          OSC_TRIANGLE);  // Use a triangle oscillator

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

  // Route audio from instrument -> my_variable_delay -> amp
  pedal.route_audio(pedal.instr_in, flangey.input);
  pedal.route_audio(flangey.output, pedal.amp_out);  

  // left footswitch is bypass
  pedal.add_bypass_button(FOOTSWITCH_LEFT);

  // Right foot switch is tap loop length
  pedal.add_tap_interval_button(FOOTSWITCH_RIGHT, true);

  // Run this effect
  pedal.run();

}


void loop() {

  // If new tempo has been tapped in, use that to control flange rate
  if (pedal.new_tap_interval()) { 
    flangey.set_rate_hz(pedal.get_tap_freq_hz());
  } 

  // Left pot controls depth of the effect
  if (pedal.pot_left.has_changed()) { 
    flangey.set_depth(pedal.pot_left.val);     
  } 

  // Center pot controls rate
  if (pedal.pot_center.has_changed()) { 
    float rate_hz = pedal.pot_center.val* 6.0;
    pedal.set_tap_blink_rate_hz(rate_hz);
    flangey.set_rate_hz(rate_hz);     
  } 

  // Right pot controls the feedback (-1.0 to 1.0)
  if (pedal.pot_right.has_changed()) {
   flangey.set_feedback(1.0 - pedal.pot_right.val*2.0);
  }

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

Summary

Members Descriptions
public fx_audio_node * input Audio routing node [input]: primary audio input
public fx_audio_node * output Audio routing node [output]: primary audio output
public fx_audio_node * ext_mod_in Audio routine node [input]: use another signal as the modulator source such as an fx_oscillator. The oscillator can be run though the clipper for example to create new types of waveforms.
public fx_audio_node * modulated_out Audio routing node [output]: just the pitch modulated signal without mixing in the original signal
public fx_control_node * depth Control routing node [input]: modulation depth
public fx_control_node * rate_hz Control routing node [input]: modulation rate in Hz
public fx_control_node * feedback Control routing node [input]: feedback
public fx_control_node * mix_clean Control routing node [input]: clean signal mix
public fx_control_node * mix_delayed Control routing node [input]: delayed signal mix
public inline fx_variable_delay(float rate_hz,float depth,float feedback,OSC_TYPES mod_type) Basic constructor/initializer for variable delay.
public inline fx_variable_delay(float rate_hz,float depth,float feedback,float buf_size_ms,float mix_clean,float mix_delayed,OSC_TYPES mod_type,bool ext_mod) Basic constructor/initializer for variable delay.
public inline fx_variable_delay(float rate_hz,float depth,float feedback,float buf_size_ms,float mix_clean,float mix_delayed,OSC_TYPES mod_type,bool ext_mod,float initial_phase) Basic constructor/initializer for variable delay.
public inline void enable() Enable the this_effect (it is enabled by default)
public inline void bypass() Bypass the this_effect (will just pass clean audio through)
public inline void set_depth(float depth) Updates the depth of the variable delay.
public inline void set_rate_hz(float rate_hz) Updates the rate (Hz) of the variable delay.
public inline void set_feedback(float feedback) Updates the feedback parameter of the variable delay.
public inline void set_mix_clean(float mix_clean) Updates the clean mix of the variable delay.
public inline void set_mix_delayed(float mix_delayed) Updates the delayed signal mix of the variable delay.
public inline void set_lfo_type(OSC_TYPES new_type) Sets the the type of oscillator used as the LFO.
public inline void print_params(void) Prints the parameters for this effect.

Members

public fx_audio_node * input

Audio routing node [input]: primary audio input

public fx_audio_node * output

Audio routing node [output]: primary audio output

public fx_audio_node * ext_mod_in

Audio routine node [input]: use another signal as the modulator source such as an fx_oscillator. The oscillator can be run though the clipper for example to create new types of waveforms.

public fx_audio_node * modulated_out

Audio routing node [output]: just the pitch modulated signal without mixing in the original signal

public fx_control_node * depth

Control routing node [input]: modulation depth

public fx_control_node * rate_hz

Control routing node [input]: modulation rate in Hz

public fx_control_node * feedback

Control routing node [input]: feedback

public fx_control_node * mix_clean

Control routing node [input]: clean signal mix

public fx_control_node * mix_delayed

Control routing node [input]: delayed signal mix

public inline fx_variable_delay(float rate_hz,float depth,float feedback,OSC_TYPES mod_type)

Basic constructor/initializer for variable delay.

Parameters

public inline fx_variable_delay(float rate_hz,float depth,float feedback,float buf_size_ms,float mix_clean,float mix_delayed,OSC_TYPES mod_type,bool ext_mod)

Basic constructor/initializer for variable delay.

Parameters

public inline fx_variable_delay(float rate_hz,float depth,float feedback,float buf_size_ms,float mix_clean,float mix_delayed,OSC_TYPES mod_type,bool ext_mod,float initial_phase)

Basic constructor/initializer for variable delay.

Parameters

public inline void enable()

Enable the this_effect (it is enabled by default)

public inline void bypass()

Bypass the this_effect (will just pass clean audio through)

public inline void set_depth(float depth)

Updates the depth of the variable delay.

Parameters

public inline void set_rate_hz(float rate_hz)

Updates the rate (Hz) of the variable delay.

Parameters

public inline void set_feedback(float feedback)

Updates the feedback parameter of the variable delay.

Parameters

public inline void set_mix_clean(float mix_clean)

Updates the clean mix of the variable delay.

Parameters

public inline void set_mix_delayed(float mix_delayed)

Updates the delayed signal mix of the variable delay.

Parameters

public inline void set_lfo_type(OSC_TYPES new_type)

Sets the the type of oscillator used as the LFO.

Parameters

public inline void print_params(void)

Prints the parameters for this effect.

Generated by Moxygen# group Enumerations {#group__Enumerations}

Summary

Members Descriptions
enum OSC_TYPES : Types of oscillators
enum EFFECT_TRANSITION_SPEED : Transition time when new parameters are loaded
enum BIQUAD_FILTER_TYPE : Type of biquad filter
enum BIQUAD_FILTER_ORDER : Biquad filter order. The higher the order, the more intense the filtering effect
enum DESTRUCTOR_TYPE : Destructor functions

Members

enum OSC_TYPES

Values Descriptions
OSC_NONE  
OSC_SINE Sine wave
OSC_TRIANGLE Triangle wave
OSC_TRIANGLE_CLIPPED Clipped triangle wave (param1 is the clipping threshold)
OSC_SQUARE Square wave
OSC_SQUARE_SOFT Square wave with smoothed transitions so no abrubt changes when used as a control source
OSC_PULSE Pulse wave (param1 is the duty cycle from 0.0 to 1.0)
OSC_RAMP_POS Ramp wave with positive slope
OSC_RAMP_NEG Ramp wave with negative slope
OSC_RANDOM Random wave
OSC_CLIPPED_TRI  
OSC_TOTAL  

: Types of oscillators

enum EFFECT_TRANSITION_SPEED

Values Descriptions
TRANS_VERY_FAST < 1 ms
TRANS_FAST ~ 3 ms
TRANS_MED ~ 6 ms
TRANS_SLOW ~ 25 ms
TRANS_VERY_SLOW ~ 80 ms
TRANS_TOTAL  

: Transition time when new parameters are loaded

enum BIQUAD_FILTER_TYPE

Values Descriptions
BIQUAD_TYPE_LPF Low-pass filter
BIQUAD_TYPE_HPF High-pass filter
BIQUAD_TYPE_BPF Band-pass filter
BIQUAD_TYPE_NOTCH Notch filter
BIQUAD_TYPE_PEAKING Peaking filter (used in parametric filters)
BIQUAD_TYPE_L_SHELF Low shelf
BIQUAD_TYPE_H_SHELF High shelf
BIQUAD_TYPE_TOTAL  

: Type of biquad filter

Video

enum BIQUAD_FILTER_ORDER

Values Descriptions
BIQUAD_ORDER_2 2nd order
BIQUAD_ORDER_4 4th order
BIQUAD_ORDER_6 6th order
BIQUAD_ORDER_8 8th order
BIQUAD_ORDER_TOTAL  

: Biquad filter order. The higher the order, the more intense the filtering effect

enum DESTRUCTOR_TYPE

Values Descriptions
SMOOTH_CLIP Smooth polynomial clipping like tube distortion
SMOOTHER_CLIP Smoother polynomial clipping like tube distortion
SMOOTH_FUZZ Smooth polynomial clipping that is rectified like a fuzz pedal
BIT_CRUSHER Digital bit reduction
SAMPLE_RATE_CRUSHER Digital sample-rate reduction
SINE_CLIPPER Wave shaping with sine function - introduces interesting high frequencies components
DIGITAL_PULVERIZER Digital destruction
POLY_TOTAL  

: Destructor functions