[CM] snd-rt problem
Kjetil S. Matheussen
k.s.matheussen at notam02.no
Wed Jun 4 11:42:20 PDT 2008
On Wed, 4 Jun 2008, Kjetil S. Matheussen wrote:
> On Wed, 4 Jun 2008, border wrote:
>> Hey (Kjetil)
>> Dunno if I should post troubles with snd-rt here on the mailing-list or
>> mail them directly to Kjetil, so in the meantime I'll post them here
>> like I did before.
>> If I run this code:
>> ((lambda (hertz)
>> (do ((x 1 (+ x 1)))
>> ((> x (- (/ (/ (rte-samplerate) 2) hertz) 1)))
>> (print x)
>> (<rt-out> 0 (* 0.5
>> (/ 1 x)
>> (oscil* (* hertz x)))))))
>> everything works as expected, generating a saw-wave up to the nyquist
>> frequency on channel 0.
>> But if I want to run the same code on channel 1, the saw-wave from
>> channel 0 gets distorted a lot, and newly generated one is as expected.
>> Is there an explanatino for this kind of behaviour?
>> I have tried all kinds of volume levels, saw-wave levels, reversed the
>> channels still the result remains.
>> Only if I keep the number of sines generated below 40-45 then I get
>> acceptable results (but not acceptable saw-waves).
>> I do need the control over the different frequencies badly, otherwise I
>> would've use another saw-wave generator probably.
>> Thanks for looking at it.
> You are simply using too much cpu. Snd-rt doesn't tell you,
> although it probaby should, when you use too much cpu. Instead
> it won't run remaining queued instruments. And since instruments
> are placed first in the scheduling queue, the instruments
> you add first are the one not to be played. Instruments using
> more cpu also gets a penalty, if I remember correctly, so
> they will not be run at next block iteration, which explains
> the distorted-like sound.
> I think this is a good example where you should use coroutines. Coroutines
Just tried it. No difference in CPU use. Not surprising when thinking
You are trying to play over 200 oscillators simultaniously.
To make that work, you probably need to avoid calling "sin" somehow.
Supercollider is probably a better tool for this, since it
has some very efficient oscillator generators...
More information about the Cmdist