Look carefully at the first expression.
(setf pitches (gen-repeat 5 '((c4 cs4 fs4 g4 c5))))
The row of pitches is now enclosed by double parentheses.
The output is:
=> ((c4 cs4 fs4 g4 c5) (c4 cs4 fs4 g4 c5) (c4 cs4 fs4 g4 c5) (c4 cs4 fs4 g4 c5) (c4 cs4 fs4 g4 c5))
Thus, five lists of five identical rows of pitches. We can now ‘see’ the repeat structure. So, think of the list in this context as being a bar.
(setf pitches (gen-repeat 5 (list '(c4 cs4 fs4 g4 c5))))
The expression above is an alternative to adding the second parentheses. It uses the LISP primitive LIST. It produces an identical output.
If we use the same processing function LENGTH-WEIGHT to vary the rhythm of the right hand there is a very different result.
The ‘skipping’ action of the pitches occurs when a rest-length is processed by the LENGTH-WEIGHT function but the repeat pattern it acts upon restarts at the beginning of every list (bar).
Evaluate and QuickView Play (^⌘P).
This shows the power of the list to contain and organise material. If you are going to compose scores for human performance, using lists ‘as bars’ is almost essential to create sensible notated scores.
(setf timesigs (get-time-signature lengths :group '((5)))) => (((5) 8 5))
Above is the output from the timesigs shows the relationship between the repeat and the time-signature list. It looks a little complex so let’s take the expression apart. If we take away the parentheses (5 8 5) is easy! 5 8 for 5 bars. However, we can control the beaming in notation here. If a parenthesis is placed around the numerator (5), then the whole bar will be beamed.
This device can be extended to include all groupings:
(((2 3) 5 8) ). . . (((3 2) 5 8)) . . . and so on.
(setf pitches (gen-repeat 5 '((c4 cs4 fs4 g4 c5)))) (setf transposed-pitches (pitch-transpose -24 pitches)) (setf lengths (span pitches '(e))) (setf lengths-rests (length-weight lengths :weight '(3 1))) (setf piano-righthand (make-omn :length lengths-rests :pitch pitches :velocity'(mp))) (setf piano-lefthand (make-omn :length lengths :pitch transposed-pitches :velocity '(f))) (setf timesigs (get-time-signature lengths :group '((5)))) (def-score lesson-5 (:key-signature 'chromatic :time-signature timesigs :tempo 100 :layout (piano-layout 'piano-rh 'piano-lh)) (piano-rh :omn piano-righthand :channel 1 :sound 'gm :program 'acoustic-grand-piano) (piano-lh :omn piano-lefthand) )
Next page Lesson 6. Structure
Go back to Reference page.