Alexandre,
I have translated a PD patch (see the last graph on
this page) and it is modulating AND responding to frequency changes. See if this does the trick for you (doesn't sound exactly like your SC code, but I think some fiddling with modulation index can be useful):
Step imp; // now I am using an impulse to generate sound after calculating stuff from phasor/sinosc
Phasor carrier; // Miller said to do so ;)
SinOsc modul; // a phasor as carrier, a sinosc as modulator
Gain g; // this object serves only to sum the signals
1 => g.op; // op number 1 is sum.
400 => carrier.freq;
201 => modul.freq;
1 => float ind => modul.gain; // so, modul. signal * index + carrier signal.
imp => dac; // impulse is actually generating sound
carrier => g => blackhole; // both generators go through a Gain object an then to the blackhole
modul => g; // so that they only lend data to the Impulse generator
while ( true ) { // this loop includes a timed function only to show that this stuff responds to changes into carrier's frequency
now + 1::second => time later;
while (now < later) {
Math.cos(g.last()) => imp.next; // i am running this through a Cosine function since Phasor is a ramp (let's smooth that)
1::samp => now;
}
if ( maybe ) 20 + carrier.freq() => carrier.freq;
else -30 + carrier.freq() => carrier.freq;
}
Please notice that Miller Puckette's approach includes using the phasor as *carrier* and sinosc as *modulator*, so that we can separate phase treatment and wave generation (phasor + cos). I am using an Impulse generator in order to be allowed to pass the resulting signal through the cosine function before sending it to DAC.
Keep trying...