Skip to the content.

Chapter 5 - Recreating the beep Synth

A simple beep synthesiser - 2nd version in SuperCollider

This synth accepts the following parameters:

(SynthDef('sonic-pi-mysecondsynth', {| out_bus = 0, note = 52.0, amp = 1, pan = 0, sustain = 1 |

define the variables that we will use later

     var snd, env, freq;

convert the midi note to frequency

     freq = midicps(note);

set up an envelope that lasts as long as the sustain value

     env = Line.kr(0.1, 0.0, sustain, doneAction: 2);

get a beep from the Sin Oscillator and then place it in the Pan and set the volume

     snd = Pan2.ar(SinOsc.ar(freq, 0, env), pos: pan, level: amp);

play

     Out.ar(out_bus, snd)
}).writeDefFile("/home/gordon/.synthdefs"))