onbeat   macro


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

Implementation

; Example:
;; (let ((beat (*metro* 'get-beat)))
;;   (onbeat 2 0 (play dls 60 60 1))
;;   (onbeat 4 '(0 2 3/2) (play dls 48 60 1)))
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(impc:aot:do-or-emit
    (define-macro (onbeat x y . args)
    `(if (> ,x 0)
      (for-each (lambda (step)
                      (if (equal? (modulo beat ,x) (helper:handle_negatives_beats ,x step))
                          (begin ,@args)))
                  (if (list? ,y)
                      ,y
                      (list ,y))))
    )
)


Back to Index