[CM] run (guile) type declarations
Carlos Pita
carlosjosepita at yahoo.com.ar
Sat Sep 16 11:37:27 PDT 2006
The moral here is that declare should go immediately
below the run lambda and predicate only of variables
bound in the outer (non-optimized) scope, isn't it?
--- Bill Schottstaedt <bil at ccrma.Stanford.EDU>
escribió:
> Here's one way:
>
> (definstrument (add beg dur freq amp)
> (let* ((start (seconds->samples beg))
> (end (+ start (seconds->samples dur)))
> (vec (make-vector 20))
> (env 0))
> (do ((i 0 (1+ i))) ((= i 20))
> (vector-set! vec i (make-oscil (* (1+ i)
> 100))))
> (run
> (lambda ()
> (declare env float)
> (do ((i start (1+ i)))
> ((= i end))
> (let ((sum 0.0))
> (do ((j 0 (1+ j)))
> ((= j 20))
> (set! sum (+ sum (* (sin env) (oscil
> (vector-ref vec j)))))
> (set! env (+ env (/ pi 20.))))
> (outa i (* amp .05 sum) *output*)))))))
>
> but it seems perverse -- I'll look into making the
> optimizer's type checker smarter
> about this sort of case.
>
> _______________________________________________
> Cmdist mailing list
> Cmdist at ccrma.stanford.edu
>
http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist
>
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas
More information about the Cmdist
mailing list