Learn Arduino Effects with me. Project 4 - Tremolo

Now that we have some basics down, let’s make it a little more difficult.

The “vibrato” (incorrectly named) on my Twin Reverb doesn’t really work well anymore, so let’s check out the (correctly named) tremolo effect. Open up Arduino - File - Examples - DaisyDuino - … Shoot! There’s no tremolo example for the Arduino yet. But I think we can figure this one out.

Fortunately, Electro-Smith gives us everything we need to know. We can find all the available modules here DaisyDuino/src/utility/DaisySP/modules at master · electro-smith/DaisyDuino · GitHub Wouldn’t you know it, there’s one called tremolo.h. Let’s open that one up and see what’s good.

    /** Initializes the module
        \param sample_rate  The sample rate of the audio engine being run.
    void Init(float sample_rate);

     \param in Input sample.
     \return Next floating point sample.
    float Process(float in);

    /** Sets the tremolo rate.
       \param freq Tremolo freq in Hz.
    void SetFreq(float freq);

    /** Shape of the modulating lfo 
        \param waveform Oscillator waveform. Use Oscillator::WAVE_SIN for example.
    void SetWaveform(int waveform);

    /** How much to modulate your volume.
        \param depth Works 0-1.
    void SetDepth(float depth);

As we can see in the Tremolo class, it defines several functions including Init, Process, SetFreq, SetWaveform, and SetDepth. Remember in our Reverb exmple, we called the Init and Process functions by using our defined object ‘verb’. It’ll work the same way here. Even better, there are comments in this code! As we can see in the Init, it wants the sample_rate. The Process takes the input signal and Processes it behind the scenes. Then we have the frequency of oscillation (0-20hz), the specified waveform, and the depth of the modulated tremolo effect (between 0 and 1, 1 being full depth).

We can certainly work with this. Let’s type up some code:

#include "DaisyDuino.h"

DaisyHardware hw;

Tremolo trem;

void AudioCallback(float *in, float *out, size_t size) {

  for (size_t i = 0; i < size; i ++) {

    out[i] = (trem.Process(in[i]))*2;

void setup() {

void loop() {


Let’s compile and upload the code and let’s take a look at what’s new.

Tremolo trem;

Nothing much new here, instead of a Reverb object, we’re making a Tremolo object.


Same thing as the Reverb example, just initializes the Tremolo

out[i] = (trem.Process(in[i]))*2;

Instead of having a mixed wet and dry signal, we’re just outputting a ‘wet’ signal. This just processes the effect and outputs it by using just one line. Alternatively, we could do

float wet;
wet = trem.Process(in[i]);
out[i] = wet*2;

Next up, we have:


SetDepth and SetFreq should be self explanitory. 80% depth at a frequency of 3hz. Now what’s going on with the SetWaveform? In the Tremolo.h file, it said we can “Use Oscillator::WAVE_SIN for example.” which we did, but what’s going on? Oscillator::WAVE_SIN is actually calling that waveform from the Oscillator class, which is in a different file. Well, what other waveforms can we use and where can find it?
Let’s go back to DaisyDuino/src/utility/DaisySP/modules at master · electro-smith/DaisyDuino · GitHub and open up the oscillator.h file

class Oscillator
    Oscillator() {}
    ~Oscillator() {}
    /** Choices for output waveforms, POLYBLEP are appropriately labeled. Others are naive forms.

Looks like we have a whole bunch of waveforms! If you’re interested at what they look like, this wikipedia article is a good start: Triangle wave - Wikipedia Try them out in your code and see how they’re different. Play around with the SetDepth and Freq and see how that changes the sound. The WAVE_SQUARE reminds me of the effect Pink Floyd used on One Of These Days.

As stated in my previous post, I wanted to help newbies understand the code, and more importantly, be able to navigate available resources and generate effects themselves. I hope some people found value in this project. Next up I think I may start doing switches and knobs. I’ll admit, the Terrarium is not particularily intuitive with Arduino IDE and the Seed, but there is a template we can work off of.


Here’s my test of the audio of this tremolo code. Download the file here (link).

Seems like I can’t embed audio, but here’s a link to SoundCloud.

Beautiful effect btw (A little bit too much tremolo for my taste though, I gotta add a dry/wet knob).