On Wed, 4 Jun 2008, Kjetil S. Matheussen wrote:

>
>
> 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)))
>> >      (begin
>> >        (print x)
>> >        (<rt-out> 0 (* 0.5
>> >          (/ 1 x)
>> >          (oscil* (* hertz x)))))))
>> >  200)
>> > 
>> >  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
> about it.
>
> 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...
>

Hold on, you can of course use faust instead. My naive first
try looks like this:

((lambda (hertz)
    (do ((x 1 (+ x 1)))
        ((> x (- (/ (/ (rte-samplerate) 2) hertz) 1)))
      (begin
        (print x)
        (primitive-eval `(<rt-faust> (out (* 0.5
                                             ,(/ 1 x)
                                             (osc ,(* hertz x)))))))))
  200)

but takes many minutes to compile, and only uses a little
bit less cpu than the <rt-out> version.

I'm not fluent enough in Faust to implement your routine
in Faust on the spot, but maybe someone at the Faust mailing list can 
help...

_______________________________________________
Cmdist mailing list
[email protected]
http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist

Reply via email to