• # Lesson 5. List Processing

## Annotation

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.

## Score

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

## Notation

Next page Lesson 6. Structure

Go back to 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