Skip to content

combining bars

Michael Edwards edited this page Jun 6, 2020 · 7 revisions

combining bars into rhythm sequences

You might want to define some isolated bars then use and re-use them in various combinations to form rhythm sequences. You might first of all want to take a look at the make-rthm-seq-from-fragments function but such things can also be done using standard Common Lisp list building/manipulation procedures:

(in-package :sc)

;; explicitly create a 4-bar rthm-seq using 3 pre-defined bars
(let* ((bar1 '(q q q)) ; remember that these qs are just symbols for now
       (bar2 '(e e q. e))
       (bar3 '(s x 12)))
       ;;                                     don't forget the time-signature
  (make-rthm-seq (list 's1 (list (list (cons '(3 4) bar1) bar2 bar3 bar2)))))

;; now a rthm-seq palette with two sequences (re-)using the given bars
(let* ((bar1 '(q q q))
       (bar2 '(e e q. e))
       (bar3 '(s x 12))
       (s1 (list (list (cons '(3 4) bar1) bar2 bar3 bar2)))
       (s2 (list (list (cons '(3 4) bar2) bar1 bar3 bar2))))
  (make-rsp 'test (list
                   (list 'rs1 s1)
                   (list 'rs2 s2))))

;;; now a slippery-chicken object using similar procedures
(let* ((bar1 '(q q q))
       (bar2 '(e e q. e))
       (bar3 '(s x 12)))
  (make-slippery-chicken
   '+mini+
   :ensemble '(((vc (cello :midi-channel 1))))
   :set-palette '((1 ((f3 g3 a3 b3 c4))))
   :set-map '((1 (1 1 1 1 1))
              (2 (1 1 1 1 1))
              (3 (1 1 1 1 1)))
   :rthm-seq-palette
   ;; things start getting a little cumbersome here, with all the calls to list
   (list
    (list 1 (list (list (cons '(3 4) bar1) bar2 bar3 bar2)))
    (list 2 (list (list (cons '(3 4) bar2) bar1 bar3 bar2))))
   :rthm-seq-map '((1 ((vc (1 2 1 2 1))))
                   (2 ((vc (1 1 2 1 2))))
                   (3 ((vc (1 1 2 2 2)))))))

;;; same as previous but increasing readability by using backquote-comma notation
(let* ((bar1 '(q q q))
       (bar2 '(e e q. e))
       (bar3 '(s x 12)))
  (make-slippery-chicken
   '+mini+
   :ensemble '(((vc (cello :midi-channel 1))))
   :set-palette '((1 ((f3 g3 a3 b3 c4))))
   :set-map '((1 (1 1 1 1 1))
              (2 (1 1 1 1 1))
              (3 (1 1 1 1 1)))
   :rthm-seq-palette `((1 (,(list (cons '(3 4) bar1) bar2 bar3 bar2)))
                       (2 (,(list (cons '(3 4) bar2) bar1 bar3 bar2))))
   :rthm-seq-map '((1 ((vc (1 2 1 2 1))))
                   (2 ((vc (1 1 2 1 2))))
                   (3 ((vc (1 1 2 2 2)))))))
Clone this wiki locally