Difference between revisions of "ChucK/fm.ck"

From CSWiki
Jump to: navigation, search
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
// carrier
+
Basic example: FM synthesis, by-hand, advancing time by one ''samp'' at a time.
sinosc c => dac;
 
// modulator
 
sinosc m => blackhole;
 
  
// carrier frequency
+
Things to try:
220 => float cf;
+
* different modulator/carrier frequency ratios
// modulator frequency
+
* different index of modulation
550 => float mf => m.freq;
+
* spork a shred to modulate the modulator, possibly at a lower rate
// index of modulation
+
* spork a shred to play a tune
.5 => float index;
+
* run and watch the spectrum in the [http://audicle.cs.princeton.edu/ audicle]
 +
* a lot of other things
  
// time-loop
+
// carrier
while( true )
+
sinosc c => dac;
{
+
// modulator
    // modulate
+
sinosc m => blackhole;
    cf + (index * mf * m.last()) => c.freq;
+
    // advance time by 1 samp
+
// carrier frequency
    1::samp => now;
+
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;
 +
}

Latest revision as of 23:29, 8 March 2006

Basic example: FM synthesis, by-hand, advancing time by one samp at a time.

Things to try:

  • different modulator/carrier frequency ratios
  • different index of modulation
  • spork a shred to modulate the modulator, possibly at a lower rate
  • spork a shred to play a tune
  • run and watch the spectrum in the audicle
  • a lot of other things
// 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;
}