• # Lesson 17. Working with Integers

## Annotation

As a starting point integers rather than pitches can be used to make new pieces. With Opusmodus Audition you can actually listen to a string of integers. Highlight the first expression in the score and press ⌘4 to audition. Using RND-SAMPLE to generate extra integers is like improvising with a set of notes on an instrument, only you can save the improvisation by setting the :seed.

The function RND-SUM is a valuable way of creating lists of different lengths, and thus bars of different length. We're keeping the metre base in 1/8th so here the function is creating bars of 3, 4, 5 and 7/8. After some experimentation a grouping was found that favoured the 7/8 bar, so this became a structural feature of the piece.

```(setf div (rnd-sum 50 '(3 4 5 7) :seed 451))
=> (7 7 4 7 7 5 3 7 3)```

We can now use GEN-DIVIDE to divide the improvisation i-compass up into a sequence of lists organised as above 5/8 3/8 2/4 . . . and so on:

```=> ((0 7 7 12 6 12 1) (0 1 12 7 6 1 1) (7 1 12 1) (6 12 7 12 6 6 12)
(12 7 0 0 1 6 1) (12 1 12 7 0) (7 12 12) (0 7 0 7 7 1 1) (1 0 12))```

AMBITUS was featured in Lesson 16 and is used here as a way of modifying the range of i-compass to create another part. Likewise AMBITUS-INVERT does the same thing.

By this point there's plenty of material available to start assembling a piece. But once we move into chordal textures on a single part integers can't be used. Notice the use of PITCH-MIX to create chordal material in one hand.

See how GEN-PAUSE structures the 'play' of right and left hand parts?

The next key function is ASSEMBLE-MAP. This is worth spending serious time understanding, particularly when writing for piano.

```(setf m-pitch
(assemble-map '(0 1 1 0 0 1 0 1 1)
(gen-integer 0 8)
(list ce-pitch c-pitch)))```

Of the two variables ce-pitch and c-pitch one has a chordal texture created with PITCH-MIX and the other is melodic. ASSEMBLE-MAP let's us create a third variable that replaces some of the melody material with chordal material. This is all done by using a binary template and a list of sections from 0  to 8:

```'(0 1 1 0 0 1 0 1 1)
(0 1 2 3 4 5 6 7 8)  ;(gen-integer 0 8) ```

Notice that the dynamics and articulation use ASSEMBLE-MAP to coincide these parameters.

Finally, the MAKE-OMN section allows the materials to be collated:

```(setf lh-1
(make-omn :length rhy-1
:pitch i-pitch
:velocity dyn-1
:swallow t))
=> ((-h..) (-h..) (e f2 pp b2 c2 b2) (-h..) (-h..)
(e c2 pp b2 c2 f2 c3) (e f2 f c2 c2) (-h..) (e b2 pp c3 c2))```

The swallow option is a brilliant way to line up all the parameters and avoid 'skipping' lists that contain rest-lengths as the one above does.

Here's the dynamics variable dyn-1:

`=> ((f) (pp) (pp) (f) (f) (pp) (f) (pp) (pp))`

Now check this against the OMN list.

Finally, see how the GET-TIME-SIGNATURE deals with grouping for 5/8 and 7/8 bars like this:

```(setf timesigs (get-time-signature AB-rh :group '((5) (2 3 2))))
=> (((2 3 2) 8 2) (2 4 1) ((2 3 2) 8 2) ((5) 8 1) (3 8 1) ((2 3 2) 8 1)
(3 8 1) ((2 3 2) 8 2) (2 4 1) ((2 3 2) 8 2) ((5) 8 1) (3 8 1)
((2 3 2) 8 1) (3 8 1))```

## Score

```(setf integers '(0 1 6 7 12))
(setf i-compass (rnd-sample 50 integers :seed 4))
(setf div (rnd-sum 50 '(3 4 5 7) :seed 451))
(setf 7-dl (position-item 7 div))
(setf a-dl '(0 3 4 6))
(setf d-compass (gen-divide div i-compass))
(setf c-extend (gen-divide div (ambitus-integer '(-6 0) i-compass)))
(setf c-invert (gen-divide div (integer-invert i-compass)))
(setf rhythm (span d-compass '(e)))
(setf rhy-1 (gen-pause rhythm :section 7-dl))
(setf rhy-2 (gen-pause rhythm :section a-dl))
(setf c-pitch (integer-to-pitch d-compass))
(setf e-pitch (integer-to-pitch c-extend))
(setf i-pitch (pitch-transpose -12 (integer-to-pitch c-invert)))

(setf ce-pitch (gen-divide div
(pitch-mix
(list (flatten c-pitch)
(flatten e-pitch)))))

(setf m-pitch (assemble-map '(0 1 1 0 0 1 0 1 1)
(gen-integer 0 8)
(list ce-pitch c-pitch)))

(setf mi-pitch (assemble-map
(binary-invert '(0 1 1 0 0 1 0 1 1))
(gen-integer 0 8)
(list ce-pitch c-pitch)))

(setf dyn-lis (list (gen-repeat 9 '((f))) (gen-repeat 9 '((pp)))))
(setf dyn-1 (assemble-map '(0 1 1 0 0 1 0 1 1)
(gen-integer 0 8) dyn-lis))

(setf dyn-2 (assemble-map (binary-invert '(0 1 1 0 0 1 0 1 1))
(gen-integer 0 8) dyn-lis))

(setf artic-lis (list (gen-repeat 9 '((stacc))) (gen-repeat 9 '((-)))))
(setf artic-1 (assemble-map (binary-invert '(0 1 1 0 0 1 0 1 1))
(gen-integer 0 8) artic-lis))

(setf artic-2 (assemble-map '(0 1 1 0 0 1 0 1 1)
(gen-integer 0 8) artic-lis))

(setf rh-1 (make-omn
:length rhythm
:pitch mi-pitch
:velocity dyn-1
:articulation artic-1
:swallow t))

(setf lh-1 (make-omn
:length rhy-1
:pitch i-pitch
:velocity dyn-1
:swallow t))

(setf rh-2 (make-omn
:length rhythm
:pitch m-pitch
:velocity dyn-2
:articulation artic-2
:swallow t))

(setf lh-2 (make-omn
:length rhy-2
:pitch i-pitch
:velocity dyn-2
:swallow t))

(setq AB-rh (assemble-seq rh-1 rh-2))
(setq AB-lh (assemble-seq lh-1 lh-2))

(setf timesigs (get-time-signature AB-rh :group '((5) (2 3 2))))

(def-score lesson-17
(:key-signature 'chromatic
:time-signature timesigs
:tempo '(q 110)
:layout (piano-layout 'piano-rh 'piano-lh))

(piano-rh
:omn AB-rh
:channel 1
:sound 'gm
:program 'acoustic-grand-piano)

(piano-lh
:omn AB-lh)
)```

## Notation

Next page Lesson 18. A Chorale with Integers

Go back to Reference page.

Edited by opmo

×

• Lessons