helper:mplayp_play_list_v2   scheme


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

Implementation

;
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; helper:mplayp_play_list_v2
;
; helper used by :steps playpattern function
; modified from the original from Andrew's implementation
; but the channel is taken as 1-based (hence -1 from what is passed)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define helper:mplayp_play_list_v2
  (let ((lst_idx (range 0 1000)))
    (lambda (beat dur pclas inst vols durs channel lst mod_diff step offset poffset args)
      (let ((duration 0) (volume 0)
            (phase 0))
        (for-each (lambda (x idx t)
                    (if (symbol? x) (set! x (eval x)))
                    (if (list? durs)
                        (if (and (symbol? (car durs))
                                 (defined? (car durs))
                                 (or (closure? (eval (car durs)))
                                     (procedure? (eval (car durs)))
                                     (macro? (eval (car durs)))))
                            (set! duration durs)
                            (if (= (length durs) (length lst))
                                (set! duration (list-ref durs idx))
                                (set! duration step)))
                        (set! duration durs))
                    (if (list? vols)
                        (if (and (symbol? (car vols))
                                 (defined? (car vols))
                                 (or (closure? (eval (car vols)))
                                     (procedure? (eval (car vols)))
                                     (macro? (eval (car vols)))))
                            (set! volume vols)
                            (if (= (length vols) (length lst))
                                (set! volume (list-ref vols idx))
                                (set! volume 80)))
                        (set! volume vols))
                    (if (list? x)
                        (helper:mplayp_play_list_v2 beat dur pclas inst volume
                                          duration channel x mod_diff (/ step (length lst)) (+ t offset) poffset args)
                        (if (> x 0)
                            (begin 
                              (set! phase (+ mod_diff t offset))
                              (eval
                                    `(mplay ,phase ;(+ mod_diff t offset)
                                            ,inst
                                            ,(pc:quantize (+ x poffset) pclas)
                                            ,volume
                                            ,duration
                                            ,(- channel 1) ;; NEW
                                            ,@args))))))
                  lst
                  lst_idx
                  (range 0 step (/ step (length lst))))))))


Back to Index

Similar Entries

  • :mklist    macro    /lambdamusic/extempore-extensions/blob/main/init/init_lisp.xtm
  • cl:expand-list    scheme    /lambdamusic/extempore-extensions/blob/main/init/init_lisp.xtm
  • cl:expand-list2    scheme    /lambdamusic/extempore-extensions/blob/main/init/init_lisp.xtm
  • cl:list-flatten    scheme    /lambdamusic/extempore-extensions/blob/main/init/init_lisp.xtm
  • cl:list-to-string    scheme    /lambdamusic/extempore-extensions/blob/main/init/init_lisp.xtm
  • helper:mmplayp_f_with_offset    scheme    /lambdamusic/extempore-extensions/blob/main/init/init_playp.xtm
  • helper:play-plist    scheme    /lambdamusic/extempore-extensions/blob/main/init/init_midi.xtm
  • helper:playchord    scheme    /lambdamusic/extempore-extensions/blob/main/init/init_play.xtm
  • list-flatten    scheme    /lambdamusic/extempore-extensions/blob/main/init/init_lisp.xtm
  • list-split-after    scheme    /lambdamusic/extempore-extensions/blob/main/init/init_lisp.xtm
  • list-split-from    scheme    /lambdamusic/extempore-extensions/blob/main/init/init_lisp.xtm
  • mplay    macro    /lambdamusic/extempore-extensions/blob/main/init/init_playp.xtm
  • play    macro    /lambdamusic/extempore-extensions/blob/main/init/init_play.xtm
  • playarp    macro    /lambdamusic/extempore-extensions/blob/main/init/init_play.xtm
  • playk    macro    /lambdamusic/extempore-extensions/blob/main/init/init_play.xtm
  • playkp    macro    /lambdamusic/extempore-extensions/blob/main/init/init_playp.xtm
  • playkr    macro    /lambdamusic/extempore-extensions/blob/main/init/init_play.xtm
  • playkrdown    macro    /lambdamusic/extempore-extensions/blob/main/init/init_play.xtm
  • playkrrollup    macro    /lambdamusic/extempore-extensions/blob/main/init/init_play.xtm
  • playp    macro    /lambdamusic/extempore-extensions/blob/main/init/init_playp.xtm
  • sum_list    scheme    /lambdamusic/extempore-extensions/blob/main/init/init_lisp.xtm