ifbeat   macro


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

Implementation

;
;
;; IFBEAT X Y
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; (ifbeat denominator numerator (do ...) (else do ....))
;
;
;  Y: Accepts both single numbers and lists
;
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(impc:aot:do-or-emit
    (define-macro (ifbeat x y args . elseargs)
    `(if (> ,x 0)
     (for-each (lambda (step)
                    (if (equal? (modulo beat ,x) (helper:handle_negatives_beats ,x step))
                        ,args
                        ,@elseargs))
                (if (list? ,y)
                    ,y
                    (list ,y))))
    )
)


Back to Index

Similar Entries