[CM] New bus system for rt-stalin

Kjetil S. Matheussen k.s.matheussen at notam02.no
Mon Dec 22 11:52:39 PST 2008


Hi,

I have finally had time to implement a bus
system for rt-stalin. There's only mono buses for
now, but I don't have time to do more before
the holiday.

Code is sent to Bill now, so it should be
in CVS shortly.

Below is an example with a midi softsynth.
Note that buses are not explicitly handled,
but instead taken care of by the "in"
and "out" macros:



;; Simple oscillator midi softsynth w/adsr envelope:

(define-stalin (midi-synth)
   (while #t
     (wait-midi :command note-on
       (define adsr (make-adsr :a 20:-ms :d 20:-ms :s 0.2 :r 50:-ms))
       (define osc  (make-oscil :freq (midi-to-freq (midi-note))))
       (sound
         (define vol (adsr))
         (if vol
             (out (* 0.2 vol (midi-vol) (oscil osc)))
             (stop)))
       (spawn
         (wait-midi :command note-off :note (midi-note)
           (-> adsr stop))))))



;; Freeverb reverberation, using Faust:

(define-stalin (freeverb get-sound)
   (<faust> :in (vct (get-sound))
            (url "http://faudiostream.cvs.sourceforge.net/viewvc/*checkout*/faudiostream/faust/examples/freeverb.dsp")))



;; Put it together:

(<rt-stalin>
  (sound
    (out (freeverb (lambda ()
                     (in (midi-synth)))))))



;; Play a song:
(system "aplaymidi --port=rt-midi:0 /gammelhd/usr/share/apps/kmidi/Malaguena.mid")




;; Result:

http://heim.ifi.uio.no/~ksvalast/Malagueana.mp3

(There are some pops on that file, but that's because the
freeverb sliders are not interpolated)



More information about the Cmdist mailing list