• # Lesson 4. Rhythm, Repeats and Random Seeds

## Annotation

The instruction to repeat is one of the most common and necessary in composing music. Here is the function GEN-REPEAT set to repeat pitches 5 times. This is the output:

=> (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)

Sadly, we can’t see the repeat grouping that easily. It’s just one long list! There are no bar lines or divisions in the output. But there is a way of indicating bars coming up in Lesson 5. Both right and left hands of the piano are playing identical material BUT the right hand has been processed with LENGTH-WEIGHT.

(length-weight '(3 1) lengths :weight '(3 1):seed 23)
=> (-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
1/8 1/8 -1/8 1/8 -1/8)

You can see the LENGTH-WEIGHT replaces previously 'sounding' lengths with rest-lengths throughout the stream of pitches. The ratio used is (3 1), which indicates roughly 3 sounding lengths to 1 rest. Meanwhile the bass part in the left hand plays steadily each pitch of the repeated figure. Notice that the LENGTH-WEIGHT expression carries a keyword :seed

(length-weight lengths :weight '(3 1) :seed 23)

Without this seed, each time the function was evaluated a different weighting of rest-lengths to note-lengths would be given. Experiment with evaluating the expression without the seed, or simply change the seed itself to see how the output is effected.

## Score

(setf pitches (gen-repeat 5 '(c4 cs4 fs4 g4 c5)))
(setf transposed-pitches (gen-repeat 5 (pitch-transpose -24 pitches)))
(setf lengths (span pitches '(e)))
(setf lengths-rests (length-weight lengths :weight '(3 1) :seed 23))

(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))

(def-score lesson-4
(:key-signature 'chromatic
:time-signature '(5 8)
: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)
)

## Notation

Next page Lesson 5. List Processing

Go to the Reference page.

Edited by opmo

• ### Introduction to OMN the language

OMN is designed as a scripting language for musical events. It’s not about sounds themselves, it is about their control and organisation in a musical composition. As a linear script rather than a graphic stave, musical events can be transformed, extended, reorganised by powerful computer algorithms. Some sequencers and score writers provide basic algorithms, but they do not represent the way composers now think about the process of music composition. Composing has become such a multi-faceted pro

opmo
OMN The Language 0
• ### Introduction to Opusmodus

Contents A Contemporary Language for Making Music The Parametric World of Music The Parametric Instrument Learning Opusmodus : A Strategy Important Questions: Necessary Answers

opmo
Tutorial Guide 0
• ### CLM Installation

Contents CLM Installation Command Line Tools Load and Compile Instruments CLM Installation Common Lisp Music, by William Schottstaedt is a powerful sound synthesis language implemented in Lisp and C. CLM is essentiall

opmo
CLM Examples 0
×

• Lessons