Jump to content
• Sign Up
• # Lesson 28. Working with Libraries

## Annotation

Back to the piano and a piece with a ragtime feel using Opusmodus libraries as way of working with collections of pitch and rhythm material.

There are three functions associated with libraries: CREATE-LIBRARY, DEF-LIBRARY and LIBRARY. We'll use them all here.

In this composition we'll work with the libraries within the score-file itself, but it's worth looking at the Library Section of the Utilities Pane just to get an idea of the kind of material that can be kept there.

We'll start by creating two libraries: one for rhythm, one for pitch. Here's the one for rhythm:

```(create-library
'Binary-Rhythmics '4-bit-binary 'binr
(combination2 4 '(1 0)))```

In the above code, the CREATE-LIBRARY function will create a library definition for 'Binary-Rhythmics, which in this case includes only one sub-section '4-bit-binary. The definition will be printed directly to the Listener. Note that each definition in the library is also user-defined prefix 'binr. So, to access the first item in the library we would refer to it as 'binr0. We end up with a list like this, copied from the Listener and pasted into our Composer panel:

```(def-library binary-rhythmics
(:section 4-bit-binary
binr0 '(0 0 0 0)
binr1 '(1 0 0 0)
binr2 '(0 1 0 0)
. . .
))```

The output shown here is from the function COMBINATION2, a function that can output all the possible occurrences in a list of 4 items consisting in this instantce of the binary digits (1 0).

With this print-out a library can be defined with the function DEF-LIBRARY. Here's part of it:

```(def-library binary-rhythmics
(:section 4-bit-binary
binr0 '(0 0 0 0)
binr1 '(1 0 0 0)
binr2 '(0 1 0 0)
binr3 '(1 1 0 0)
binr4 '(0 0 1 0)
binr5 '(1 0 1 0)
binr6 '(0 1 1 0)
binr7 '(1 1 1 0)
binr8 '(0 0 0 1)
binr9 '(1 0 0 1)
binr10 '(0 1 0 1)
binr11 '(1 1 0 1)
binr12 '(0 0 1 1)
binr13 '(1 0 1 1)
binr14 '(0 1 1 1)
binr15 '(1 1 1 1)
))```

The output from the Listener can not only be copied and pasted onto the working file itself (as it is here), but also can be saved in a dedicated file to the composer's own user-library.

Now for the pitch library. As the Slonimsky library is already part of the Opusmodus libraries we don't have to create a library, only define one (see the Libraries tab in the Utilities panel to access the Slonimsky Thesaurus library). Here we've copied a section from the Slonimsky library and labelled it as :section tritone27-31. Notice these entries are for both upward and downward patterns. Again we could create a separate user-file or, as here, simply paste it to our working file.

Composing begins with these expressions using the function LIBRARY to pick out random lists from each library using the :random keyword:

```(setf rh-pitches
(library 'slonimsky-s
'tritone27-31 nil :random 20 :seed 61))
=> ((c4 f4 fs4 g4) (c5 gs4 fs4 e4) (c5 gs4 fs4 e4) . . .)

(setf rh-rhythms
(library 'binary-rhythmics
'4-bit-binary nil :random 20 :seed 51))
=> ((1 1 0 1) (0 0 1 1) (1 1 1 0) (1 0 0 1) . . .)```

Because we're using binary lists in conjunction with BINARY-MAP, the pitches will be swallowed by the rhythm pattern rather than skipping length-rests.

```(setf rh-pitches-s (binary-map rh-rhythms rh-pitches))
=> ((c4 f4 g4) (fs4 e4) (c5 gs4 fs4) . . .)

(setf rh-rhythms-s (binary-map rh-rhythms '(s)))
=> ((1/16 1/16 -1/16 1/16) (-1/16 -1/16 1/16 1/16)
(1/16 1/16 1/16 -1/16) . . .)```

This is fine, but the texture of the right hand isn't quite finished.

```(setf rhy-inversion
(length-invert rh-rhythms-s
:section '(0 3 4 5 6 8 11 12 14 16 18)))```

A secondary part is created here using the LENGTH-INVERT function. This changes the rhythm list rh-rhythms-s into:

```=> ((-1/16 -1/16 1/16 -1/16) (-1/16 -1/16 1/16 1/16)
(1/16 1/16 1/16 -1/16) . . .)```

But there's more, as the LENGTH-INVERT function is only being applied to this part on certain sections (lists) in the piece. The result is contrary-motion figures and chordal passages all playable by a single hand.

In the left hand part the pitch library-based expression is set to a different :seed, but in the rhythm library-based expression it's been removed. Here a further aspect of LIBRARY is revealed: the ability to be able to :collect together a list of chosen rhythms. Here a template has been collected based on the order of the library list of rhythms. The template is used to pick from the library via the keyword :collect:

```(setf template '(11 12 7 9 15 13 12 4 2 6))
(setf lh-rhy
(library 'binary-rhythmics '4-bit-binary
nil :collect template))
=> ((1 1 0 1) (0 0 1 1) (1 1 1 0) (1 0 0 1) . . .)```

In the pitch parameter, intervals are added with CHORD-INTERVAL-ADD, but only to lists that have one or two notes:

```(setf lh-pitches-s
(chord-interval-add '(-5 -6)
(binary-map lh-rhythms lh-pitches)
:section '(1 3 6 8)))
=> ((c3 bb2 d3) (fs3cs3 eb3a2) (c3 g3 fs3) . . .)```

In the rhythm parameter, LENGTH-AUGMENTATION is used to create bars of 5/8 rather than the 2/8 bars of the right hand. This is the reason only 10 rhythms and pitch selections have been made from the library collections:

```(setf lh-rhythms-s
(length-augmentation
2 (binary-map lh-rhythms '(s))))
=> ((1/8 1/8 -1/8 1/8) (-1/8 -1/8 1/8 1/8)
(1/8 1/8 1/8 -1/8) . . .)```

Notice in the :layout part of the expression there is the keyword :ignore-velocity t. This enables you to block the appearance of dynamics signs in the notation output:

```(def-score lesson-28
(:key-signature 'chromatic
:time-signature '((1 1 1 1 1) 8)
:tempo '(q 60)
:layout (piano-solo-layout 'piano-rh 'piano-lh
:ignore-velocity t))

(piano-rh
:omn (merge-voices rh-1 rh-2)
:channel 1
:sound 'gm
:program 'acoustic-grand-piano
:controllers (ped '(0 127 0 127 0 0 0 0 127 0
0 0 127 0 127 0 127 0 127)))
(piano-lh
:omn lh-1)
)```

## Score

```(create-library 'Binary-Rhythmics '4-bit-binary 'binr
(combination2 4 '(1 0)))

(def-library binary-rhythmics
(:section 4-bit-binary
binr0 '(0 0 0 0)
binr1 '(1 0 0 0)
binr2 '(0 1 0 0)
binr3 '(1 1 0 0)
binr4 '(0 0 1 0)
binr5 '(1 0 1 0)
binr6 '(0 1 1 0)
binr7 '(1 1 1 0)
binr8 '(0 0 0 1)
binr9 '(1 0 0 1)
binr10 '(0 1 0 1)
binr11 '(1 1 0 1)
binr12 '(0 0 1 1)
binr13 '(1 0 1 1)
binr14 '(0 1 1 1)
binr15 '(1 1 1 1)
))

(def-library Slonimsky-s
(:section tritone27-31
s27u '(c4 cs4 fs4 b4)
s27d '(c5 b4 fs4 cs4)
s28u '(c4 d4 fs4 as4)
s28d '(c5 as4 fs4 d4)
s29u '(c4 ds4 fs4 a4)
s29d '(c5 a4 fs4 ds4)
s30u '(c4 e4 fs4 gs4)
s30d '(c5 gs4 fs4 e4)
s31u '(c4 f4 fs4 g4)
s31d '(c5 g4 fs4 f4)))

;; Right-hand
(setf rh-pitches
(library 'slonimsky-s 'tritone27-31 nil
:random 20 :seed 61))

(setf rh-rhythms
(library 'binary-rhythmics '4-bit-binary nil
:random 20 :seed 51))

(setf rh-pitches-s (binary-map rh-rhythms rh-pitches))
(setf rh-rhythms-s (binary-map rh-rhythms '(s)))
(setf rhythm-inversion
(length-invert
rh-rhythms-s
:section '(0 3 4 5 6 8 11 12 14 16 18)))

(setf rhythm-inversion-p
(span rhythm-inversion rh-pitches))

(setf dynamics '((mp) (f) (f) (mp) (p )
(mp) (mf) (f f f f mf)
(p) (ff)))

(setf rh-1 (make-omn
:length rh-rhythms-s
:pitch rh-pitches-s
:velocity dynamics))

(setf rh-2 (make-omn
:length rhythm-inversion
:pitch rhythm-inversion-p
:velocity (reverse dynamics)))

;; Left-hand
(setf lh-pitches
(ambitus '(g2 g3)
(library 'slonimsky-s
'tritone27-31 nil
:random 10
:seed 52
:transpose -12)))

(setf template '(11 12 7 9 15 13 12 4 2 6))
(setf lh-rhythms
(library 'binary-rhythmics '4-bit-binary
nil :collect template))

(setf lh-pitches-s
(chord-interval-add
'(-5 -6)
(binary-map lh-rhythms lh-pitches)
:section '(1 3 6 8)))

(setf lh-rhythms-s
(length-augmentation
2 (binary-map lh-rhythms '(s))))

(setf lh-1 (make-omn
:length lh-rhythms-s
:pitch lh-pitches-s
:velocity '(f)))

(def-score lesson-28
(:key-signature '(c maj)
:time-signature '((5) 8)
:tempo '(q 60)
:ignore-velocity t
:layout (piano-layout
'piano-rh 'piano-lh))

(piano-rh
:omn (merge-voices rh-1 rh-2)
:channel 1
:sound 'gm
:program 'acoustic-grand-piano
:controllers (ped '(0 127 0 127 0 0 0 0 127 0
0 0 127 0 127 0 127 0 127)))

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

## Notation

Go back to Reference page.

Edited by opmo

• ### Introduction to OMN the language

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
• #### GUI

• Buy
×
• Create New...