I was playing with the thought of building some Arduino Based Guitar Effects Pedals. With that in mind, I have added some simple sound effects to my Arduino Audio Tools Library and this is fitting quite nicely into the overall design.

Overall Design

SineWaveGenerator<int16_t> sine;
AudioEffects effects(sine);
GeneratedSoundStream<int16_t> in(effects); 

The audio effects are applied to an input signal: Here in order to test the functionality, I just use a SineWaveGenerator that is assigned to the AudioEffects. Since the AudioEffects is a SoundGenerator, we can use the GeneratedSoundStream class to turn it into an Input Stream source.

Next we need to define the effects that we want to use. Each effect has parameters:

// Contorl input
float volumeControl = 1.5;
int16_t clipThreashold = 4990;
float fuzzEffectValue = 6.5;
int16_t distortionControl = 4990;
int16_t tremoloDuration = 800;
float tremoloDepth = 0.9;

After having the input parameters defined we can create and assign the individual subclasses of AudioEffect:

// setup effects
effects.addEffect(new Boost(volumeControl));
effects.addEffect(new Distortion(clipThreashold));
effects.addEffect(new Fuzz(fuzzEffectValue));
effects.addEffect(new Tremolo(tremoloDuration, tremoloDepth, sample_rate));

The effects are processed sequentially in the defined sequence. You you don’t want any specific effects you can leave them out or set them as not active.

Finally we can just output the data in one of the usual ways…


In the final sketch, the generated sine wave will be replaced with the input from a ADC. But I leave this to a future Blog.

I think with the current design is is quite easy to add additional Effect implementations. You just need to create a subclass of AudioEffect and implement the process() method which receives an input value and provides the resulting output value.

Complete Example

You can find a full example on Github, that sends the output to a Webbrowser.


Leave a Reply

Avatar placeholder

Your email address will not be published.