Skip to content

Instantly share code, notes, and snippets.

@xavriley xavriley/
Created Jun 18, 2018

What would you like to do?
Sonic Pi Vocoder Prototype

Prototype of vocoder on Sonic Pi

Demo here: Original voice input here:

This is a demo of a simple effects synth using the UGen from SuperCollider. This is a fairly primitive vocoder implementation made of a bunch of bandpass filters which are "tuned" to various frequencies.

The results are mixed, but it's difficult to get a decent reproduction of the words from this.

To get T-Pain/Imogen Heap style auto-tune it would be necessary to write a different algorithm probably using a technique called PSOLA which is described at the following links:

Part of the problem is that the algorithm is probably under copyright which makes distribution of an open source version more difficult.

SynthDef('sonic-pi-fx_vocoder', {
arg out_bus=0, in_bus=0;
var car, mod, result;
car =,1);
mod =,1);
result =, mod, 32);, result.dup);
}).writeDefFile("/Users/xriley/Projects/sonic-pi/etc/synthdefs/compiled/"); // change this path to point to Sonic Pi on your system
live_loop :bd do
sample :bd_haus
sleep 0.5
in_thread do
with_fx :vocoder do
# right channel provides the voice input to the effect
with_fx :band_eq, freq: 70, db: 2 do
sample "/Users/xriley/Movies/shipping_forecast.wav", start: 0.506, amp: 5, rate: 1, pan: 1
# using a noisy synth gives more for the vocoder to work with
x = synth :supersaw, sustain: 200, note_slide: 0.05, pan: -1
200.times do
control(x, note: (scale :a2, :minor_pentatonic, num_octaves: 2).choose)
sleep [0.5,0.25,1].choose
diff --git a/app/server/ruby/lib/sonicpi/synths/synthinfo.rb b/app/server/ruby/lib/sonicpi/synths/synthinfo.rb
index d70c85199..135c8c765 100644
--- a/app/server/ruby/lib/sonicpi/synths/synthinfo.rb
+++ b/app/server/ruby/lib/sonicpi/synths/synthinfo.rb
@@ -4942,6 +4942,28 @@ A decent range of Q factors for naturally sounding boosts/cuts is 0.6 to 1.
+ class FXVocoder < FXInfo
+ def name
+ "Vocoder"
+ end
+ def introduced
+ end
+ def synth_name
+ "fx_vocoder"
+ end
+ def doc
+ ""
+ end
+ def arg_defaults
+ super.merge({})
+ end
+ end
class FXMono < FXInfo
def name
@@ -7606,6 +7628,7 @@ Use FX `:band_eq` with a negative db for the opposite effect - to attenuate a gi
:fx_replace_reverb =>,
:fx_level =>,
:fx_mono =>,
+ :fx_vocoder =>,
:fx_replace_level =>,
:fx_echo =>,
:fx_replace_echo =>,

This comment has been minimized.

Copy link
Owner Author

commented Jun 18, 2018

This might be worth looking at for a PSOLA implementation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.