Songlib: chords

written by: Song Li Buser

Revision Date: January 22, 2015

Printable Version

Generating Chords

In addition to the fundamental chord function, songlib provides some specialized chord generating functions. The most powerful and easiest to use are the modal chords. Modal chords are explained in the key signatures and modes documents.

Although the use of modal chords is strongly encouraged, songlib provides for a number of chord functions outside of the modal system, described below.

Integer notation of pitches

The classical naming of chords is based upon both subjective and objective measures and is inherently ambiguous. An alternate method of name chords is strictly objective and unambiguous. For example, a major chord (regardless of key) is identified by the integer notation:


meaning the second note in the chord is four semitones up from the base (or root) note, and the third note is seven semitones up from the root.

The equivalent songlib chord using this notation is:

    void i47(double beats,int instrument,int octave,int pitch)

The root note of the chord is specified by the octave/pitch pair, while the name specifies the second and third notes are four and seven semitones above the root. The call:


is therefore exactly equivalent to:

    chord(beats,instrument,octave,pitch,4,7,(int) 0);

The advantage of using the i-chord functions is that they are only defined for nice-sounding chords, that is chords that are commonly used in composition. The other advantage is that it saves you a bit of typing.

The defined i-chords are:

i3, i4, i5, i6, i7, i8, and i9
i37, i38, i47, i49, i57, and i59

Each of these chords has a version suffixed by the letter 'p', which indicates an additional note, one octave above the root. Thus,

    i47p(beats,instrument,octave,pitch); equivalent to:

    chord(beats,instrument,octave,pitch,4,7,12,(int) 0);

Keep in mind that music composed solely of nice sounding chords is often boring.