mu:testchord   macro


Defined in:  https://github.com/lambdamusic/extempore-extensions/blob/main/init/init_midi.xtm

Implementation

;
;
;;  MU:TESTCHORD 
;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Test MIDI channel with a chord 
;
;; both with/without time abstractions
;; Variable num of args
;; MIDI channel is 1-based
;; IMPORTANT need *mididevice*  to be predefined 
;
; Example:
; (define *mididevice* (pm_create_output_stream 1))
; (mu:testchord '(60 63 67) )
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;
(impc:aot:do-or-emit
   (define-macro (mu:testchord . args)
      (cond ((length-equal? args 1) ;; just notes list
            `(for-each (lambda (x)
                        (play-midi-note (now) *mididevice* x 80 *second* 0))
                        ,(car args)))
            ((length-equal? args 2) ;; note + channel 1-based
            `(for-each (lambda (x)
                        (play-midi-note (now) *mididevice* x 80 *second* (- ,(cadr args) 1)))
                        ,(car args)))
            (#t (print 'Error: '1 'or '2 'args' 'max))))


Back to Index