[PlanetCCRMA] cm rts problem

Fernando Lopez-Lezcano nando@ccrma.Stanford.EDU
Sun Apr 22 14:54:03 2007


On Sun, 2007-04-22 at 10:21 -0700, Anthony Green wrote:
> I was experimenting with cm for the first time the other day and having trouble with real-time midi
> output.  Given this...
> 
> (defparameter pm-zyn (portmidi-open :output "ZynAddSubFX" :latency 0))
> (rts pm-zyn :time-format :sec)
> 
> If I send a few seconds of midi events to it like so...
> 
> (events (gen-my-events) pm-zyn)
> 
> ...they all end up being played immediately, at the same time.
> 
> However, if I send them to a midi file...
> 
> (events (gen-my-events) "foo.mid")
> 
> ...and play foo.mid in rosegarden, I see that all of the events are 
> sequenced properly, and it sounds perfect.
> 
> The problem is that I really want the real-time output from cm.  
> Does anybody have rts working?

[BTW, I had tested this, I even sent a scheduling latency graph to Rick]

I just tried one of the examples in the rts Common Music dictionary
entry (surf locally to:
"file:///usr/share/common-lisp/source/cm/doc/dict/index.html" and search
for "rts") and it seems to work fine (ie: events were scheduled
correctly). 

Could you try this and see if it works?
[I connected Midi Through to Zyn in qjackctl]

(define *pm*
  (portmidi-open :output 0 :latency 0))

(define (zzz len lb ub wai amp)
  (process repeat len
           output (new midi :time (now)
                       :duration .1 :amplitude amp
                       :keynum (between lb ub))
           wait wai))

(rts *pm*)
  
;;; eval to add stuff

(let ((k (between 20 100))
      (n (pick 3 5 7 11)))
  (sprout (zzz (* n (pick 2 3 4))
               k
               (+ k 7)
               (/ 1 n)
               .75)))

;;; stop when you are done.

(rts-stop)

-- Fernando