Introduction

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;
GeneratedSoundStream<int16_t> stream(sine); 
AudioEffectStream effects(stream);

The audio effects are applied to an input stream: Here in order to test the functionality, I just use a SineWaveGenerator provided to a GeneratedSoundStream class which turns it into an Input Stream source.

This is assigned to the AudioEffectStream.

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…

Outlook

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 new 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.


0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *