On Wed, 12 Aug 2009, Kjetil S. Matheussen wrote:

>
> I've added a few improvements to the syntax of snd-rt.
> What I like most is the use of the keywords ":where" and
> ":when" which can be placed anywhere in code. (inspired
> by various functional languages)
>
> ":where" is a postfix operator to add local variables,
> and ":when" is a postfix operator for doing conditional tests.
>

Not quite used to the new syntax yet. Here is another version of the 
softsynth which exploits it better:

(<rt-stalin>
   (sound
     (out (+ (* 0.5 softsynth)
            (* 0.1 reverb)

            :where reverb (+ (comb :scaler 0.742 :size  9601 allpass-sum)
                             (comb :scaler 0.733 :size 10007 allpass-sum)
                             (comb :scaler 0.715 :size 10799 allpass-sum)
                             (comb :scaler 0.697 :size 11597 allpass-sum)
                             :where allpass-sum (send softsynth :through
                                                      (all-pass :feedback -0.7 
:feedforward 0.7)
                                                      (all-pass :feedback -0.7 
:feedforward 0.7)
                                                      (all-pass :feedback -0.7 
:feedforward 0.7)
                                                      (all-pass :feedback -0.7 
:feedforward 0.7)))
            :where softsynth (in (while #t
                                   (wait-midi :command note-on
                                     (sound
                                       (out (* (-> adsr next) (midi-vol) (oscil 
:freq (midi-to-freq (midi-note)))))
                                       (stop :when (-> adsr is-finished)))
                                     (spawn
                                       (wait-midi :command note-off :note 
(midi-note)
                                         (-> adsr stop)))
                                     :where adsr (make-adsr :a 20:-ms :d 30:-ms 
:s 0.2 :r 70:-ms))))))))

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

Reply via email to