On Fri, Oct 05, 2012 at 02:25:40PM +0200, Stefan Blixt wrote:
A SinOsc constantly oscillates between -1 and 1, according to the frequency set. The frequence is stored in/retrieved from m.freq (e.g. 200 for 200 Hz), and the constantly changing/oscillating value (between -1.0 and 1.0) can be retrieved from m.last().
All true. In this case -1 to 1 clearly is rather a small range for all but the most subtle of modulations. You can multiply by "index" every sample as in the posted examples, but personally I'd simply set the modulator's .gain() to the value of the index. While we are at it; I'd also use the fm input to the carrier set by the .sync() member function. That leaves the centre frequency, I'd sum the modulator with a Step UGen set to that value. This will greatly simplify the code (no need to manually loop) and because of that decrease the CPU cost. For educational purposes I won't write out the code, shout if more hints are needed ;-). This, BTW, will only fly if we are modulating a plain oscillator, if something else, which lacks a .sync() member and thus the fm input, needs to be modulated the strategy of the past few mails will be the way to go. Yours, Kas.