Now we know that lists (() ()) can act as bars, let’s create some lists of different metrical lengths and see how they are shown.
(setf line '(c4 cs4 fs4 g4 c5)) (setf line-rnd (gen-eval 5 '(rnd-sample (rnd-range 3 5) line) :seed 41))
There are several new functions here: GEN-EVAL enables the composer to make an evaluation n times, resulting in the generation of a chain of random evaluations, and with :seed being able to recapture those random evaluations accurately; the function RND-SAMPLE has another random function RND-RANGE acting on its count parameter, which choses a value between and including 3 to 5. Here’s the result:
=> ((g4 cs4 c5 cs4) (fs4 c5 fs4 cs4) (c5 g4 g4 fs4 c4) (fs4 c5 g4 c5) (c4 c4 cs4))
Using SPAN we can get the required lists of note-lengths.
(setf rhythm (span line-rnd '(e)) => ((1/8 1/8 1/8 1/8) (1/8 1/8 1/8 1/8) (1/8 1/8 1/8 1/8 1/8) (1/8 1/8 1/8 1/8) (1/8 1/8 1/8))
In the left hand part we want the bass to restart at the beginning of each bar. To do this we have to add the function LIST to bass as we SPAN it to line-rnd. Try the alternative – without the addition of LIST!
(setf bass-line (span line-rnd (list bass))) (setf bass-line (span line-rnd bass))
In this piece dynamics are being used to highlight the metre change. We want a different dynamic to last for each bar.
(setf dynamics (mclist '(f p f p ff)) => ((f) (p) (f) (p) (ff))
Here the function MCLIST brings two LISP primitives together, MAPCAR and LIST. So in the expression above, LIST is MAPCAR ’ed to each of the dynamic signs.
(setf ts-list (get-time-signature line-1))
Finally, here’s proof of the changing time-signatures:
=> ((2 4 2) (5 8 1) (2 4 1) (3 8 1))
(setf line '(c4 cs4 fs4 g4 c5)) (setf bass (pitch-transpose -24 line)) (setf line-rnd (gen-eval 5 '(rnd-sample (rnd-range 3 5) line) :seed 41)) (setf rhythm (span line-rnd '(e))) (setf bass-line (span line-rnd (list bass))) (setf dynamics (mclist '(f p f p ff))) (setf dyn-spanned (span line-rnd dynamics)) (setf line-1 (make-omn :length rhythm :pitch line-rnd :velocity dyn-spanned)) (setf bass-1 (make-omn :length rhythm :pitch bass-line :velocity dyn-spanned)) (setf ts-list (get-time-signature line-1)) (def-score lesson-8 (:key-signature 'chromatic :time-signature ts-list :tempo 100 :layout (piano-layout 'piano-rh 'piano-lh)) (piano-rh :omn line-1 :channel 1 :sound 'gm :program 'acoustic-grand-piano) (piano-lh :omn bass-1) )
Next page Lesson 9. The Bass Part
Go back to Reference page.