Equation Composer

Documentation and Examples

Creating Synths

Let's go ahead and write the code for the following synth:

SynthTutorial1 will generate a simple triangle waveform at the EquationComposer's output. It relies heavily on the ModuleWavetableOsc module.

We'll need wire up the ModuleWavetableOsc's frequency_input and wavetable_input. As illustrated above, we'll use a constant (the number “1”) for the wavetable input and the sample rate input knob on the Equation Composer (inputs->sr) for the frequency_input.

If you don't supply an input, the Equation Composer will use the value “0” for that input.

Creating SynthTutorial1, step by step:

Step #1: Create a new file called SynthTutoria1.h

#ifndef SynthTutorial1_h
#define SynthTutorial1_h

#include "Synth.h"

class SynthTutorial1 : public Synth
    SynthTutorial1(Inputs *inputs); 


Step #2: Create a new file called SynthTutorial1.cpp

#include "SynthTutorial1.h"

SynthTutorial1::SynthTutorial1(Inputs* inputs)
  ModuleWavetableOsc *osc = new ModuleWavetableOsc();
  osc->wavetable_input  = new ModuleConstant(1);
  osc->frequency_input  = inputs->sr;
  this->last_module = osc;

Step #3: Update EquationComposer.ino

Now that we've created the synth, we need to tell the Equation Composer to use it. SynthTutorial1 is already in the list of synths, but if it weren't, you'd need to open up EquationComposer.ino and make the following additions:

a. Add your synth to the list:

// Include each synth
#include "SynthArp1.h"
#include "SynthAutoDrum.h"
#include "SynthDrumPlayer.h"
#include "SynthDrumSelektor.h"
#include "SynthEquationPlayer.h"
#include "SynthEquationLooper.h"
#include "SynthMini.h"
#include "SynthPassthroughTest.h"
#include "SynthPhonetics.h"
#include "SynthSoundToy.h"
#include "SynthTutorial1.h"
#include "SynthVerbalizer.h"
#include "SynthWavetable.h"

b. Instantiate your synth and increment the number of synths, like so:


Synth *active_synths[] {
  new SynthEquationPlayer(inputs, equations),
  new SynthEquationLooper(inputs, equations),
  new SynthEqWave(inputs, equations),
  new SynthChatterbox(inputs),
  new SynthTutorial1(inputs)

In Summary, to create a new synth:

  1. Create the synth's .h file
  2. Create the synth's .cpp file. Create your modules in the synth's .cpp file and patch them together. Remember to set: this->last_module
  3. Modify EquationComposer.ino by:
    • adding the #include directive for the new synth
    • incrementing NUMBER_OF_SYNTHS
    • adding the synth to the active_synths array