Skip to content

Instantly share code, notes, and snippets.

@zeffii
Forked from anonymous/fmsynth.ck
Created December 9, 2013 10:02
Show Gist options
  • Save zeffii/7869946 to your computer and use it in GitHub Desktop.
Save zeffii/7869946 to your computer and use it in GitHub Desktop.
// basic FM synthesis using sinosc
// modulator to carrier
SawOsc m => SinOsc c => ADSR kickEnv =>dac;
2 => c.sync;
// carrier frequency
20 => c.freq;
// modulator frequency
2.9 => m.freq;
// index of modulation
-130 => m.gain;
// phase modulation is FM synthesis (sync is 2)
kickEnv.set( 0.089::ms, 231::ms, 0.00, 0::ms );
// time-loop
while( true ) {
kickEnv.keyOn();
-pi => m.phase;
-pi => c.phase;
1::second => now;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment