Difference between revisions of "Example 3"

From CSWiki
Jump to: navigation, search
(SuperCollider code)
Line 26: Line 26:
 
  }.play;
 
  }.play;
  
SC actually has a PM UGen (Phase synthesis and FM synthesis are basically the same sound), so this example could also look like this:
+
SC actually has a PM UGen (Phase Modulation synthesis and Frequency Modulation synthesis are basically the same sound), so this example could also look like this:
  
 
  {PMOsc.ar(300,550,2,mul:0.3).dup}.play;
 
  {PMOsc.ar(300,550,2,mul:0.3).dup}.play;

Revision as of 13:05, 10 October 2007

FM synthesis:

ChucK code

SinOsc c => Gain amp => dac; // carrier
SinOsc m => blackhole; // modulator 
0.3 => amp.gain;
550 => float mf => m.freq;
300 => float cf => c.freq;
2 => float index;

while( true )
{
    cf + (index * mf * m.last()) => c.freq;
    1::samp => now;
}

SuperCollider code

{
	var cf, mf, index;
	cf = 300;
	mf = 550;
	index = 2;
	SinOsc.ar(cf + SinOsc.ar(mf, mul: mf * index), mul: 0.3).dup // .dup = duplicate = cheap stereo
}.play;

SC actually has a PM UGen (Phase Modulation synthesis and Frequency Modulation synthesis are basically the same sound), so this example could also look like this:

{PMOsc.ar(300,550,2,mul:0.3).dup}.play;