[CM] duration equivalent on snd-rt

Kjetil S. Matheussen k.s.matheussen at notam02.no
Wed Dec 22 16:14:04 PST 2010


On Mon, 3 Mar 2008, Juan I Reyes wrote:

> Gentlemen,
>
> On CLM-3 and SND I get the actual duration of a sound (number of
> samples) by assigning the 'end' variable the following operation:
>
>  (end (* dur *srate*)
>
> where dur is a defined parameter on definstrument or define* (scheme).
>
> How can I handle the same expression on snd-rt, since AFAIK in
> real-time, the duration parameter is arbitrary.
>

Just in case there is a misunderstanding: Snd-rt has a scheduler, so the 
length of the instrument can be set.


(<rt-out> :dur 1 3
           (oscil))

is the same as:

(definstrument os (start dur)
   (let ((o (make-oscil)))
     (run
       (loop for i from (* *srate* start)
                   to   (+ (* *srate* start)
                           (* *srate* dur))
          do (let ((val (oscil o)))
               (outa i val)
               (outb i val))))))

(with-sound () (os 1 3))



> Do I average or is there
> like a system handling mechanism which takes care of this issue?. 
> The reason for this question is that in the case of delay-lines, lengths
> are pretty much function of durations and sampling-rate.
>

I guess that depends on the situation...




More information about the Cmdist mailing list