[chuck-users] fm?

Ge Wang gewang at CS.Princeton.EDU
Wed Mar 8 19:52:29 EST 2006


Hi!

Graham is right.  FM is an abstract base class for all the STK's
FM-based instruments.  We will fix it to gracefully report error
without crashing in the upcoming release.

There are several ways to do FM synthesis in ChucK.  A straightforward 
approach is to move along in time, possibly every samp, and modulate the
carrier in any way you like:

   // carrier
   sinosc c => dac;
   // modulator
   sinosc m => blackhole;

   // carrier frequency
   220 => float cf;
   // modulator frequency
   550 => float mf => m.freq;
   // index of modulation
   .5 => float index;

   // time-loop
   while( true )
   {
       // modulate
       cf + (index * mf * m.last()) => c.freq;
       // advance time by 1 samp
       1::samp => now;
   }

Hope this helps!

Best,
Ge!


More information about the chuck-users mailing list