programing audio ~ d.i.y. simple soft synth

by damaru. Average Reading Time: about 3 minutes.

Learning electronic music has been a more complex task than initially planned. I’ve been playing around with few toys like Nord Micro Modular, microKORG, KP3, TENORI-ON and Dark Energy. Although my main synth is a virtual modular synth, there were still the basics of sound that I couldn’t grasp.

So I started to learn to program audio (i.e. enter codes to make sounds), in order to understand the mechanics of sound. I experimented with Pure Data, SuperCollider and Processing, but the task hasn’t been really simple. Many of the books written about programming, from LoadBang: Programming electronic music using Pure Data to The Theory and Technique of Electronic Music, weren’t meant for a newbie like me.

I recently started reading Dance Music Manual: Tools, Toys and Techniques and although the title was a bit uncharming, it has been quite a good resource with a really basic introduction to synthesized music. In the last 3 weeks I started programming with the Beads library in Processing and that helped me learn about the basics of audio synthesis. Instead of reading about it, I could play with the basic elements of synthesis and hear the result. I am only at the first step but I wanted to share my process of learning to program electronic music.

My first experiment was with plo, which was a bit too advanced for my skill set. Since then, I have updated from the first version so it plays a little better, but I need to sharpen my skills before having something functional and enjoyable. In the meantime I’ve started experimenting with simple sine wave and that inspired me to go back to Processing and Beads in order to build myself a simple tool.

mO came out of that tinkering. It’s simply 3 oscillators that you can tune and detune and select from square, sine and triangle in order to listen to the effect of the tuning and detuning of the sounds. It’s an interesting effect that is one of the foundations of sound sythesis. When 2 waves are detuned with less than 20hz, it creates a third sound. When the waves are detuned more than that, you can hear the 2 waves starting to separate. With the 3 waves and selection of types of wave you can experiment with these sounds tuning and detuning. It’s interesting to observe the effect of the waves and their tuning and detuning. You can play around and find where 2 sine waves will sound like one, and you can hear the phenomena happen at different HZ separations, where the sound becomes one again.

mO is also a simple example on how to interface Beads and controlP5. The 3 first knobs are for the volumes of the 3 waves, and the 3 other knobs are for the HZ of each wave. You can also select what type of wave you want to use, between the sine, square and saw.

Beads audio can be created by making chains. You can read more about it here, and for my own use I had to create some sort of visual representation of the chains.

For examples the chain of ugen used in mO would look like this:

Which might be a tad too complex if you just started to code with Beads. Here is a really simple program to get the first step into coding your audio. So get Processing, install Beads and start making noise!!


import Beads.*;

AudioContext ac;
WavePlayer wp;
Gain g;

void setup()
ac = new AudioContext();
wp = new WavePlayer(ac, 440.f,Buffer.SINE);
g – new Gain(ac,1,0.1);


This is a simple visual representation of the chain that was created with the code previously entered. Also make sure to go through the Beads documentation and examples, which will teach you all the basics that you need to know! Next step into the creation of a soft synth is to control it. Soon, I’ll post about how to include MIDI into your sketch so that you can use a MIDI controller to play with your synth. So stay tuned and happy hacking!