#define C 0
#define Cs 1
#define Db 1
#define D 2
#define Ds 3
#define Eb 3
#define E 4
#define F 5
#define Fs 6
#define Gb 6
#define G 7
#define Gs 8
#define Ab 8
#define A 9
#define As 10
#define Bb 10
#define B 11
Here, the "s" appelation denotes a sharp and "b" a flat. These constants are used in conjuction with an octave specification to specify which notes play, chord, and others are to produce.
There are also absolute constants defined as well:
#define C0 0
#define Cs0 1
#define Db0 2
#define D0 2
...
#define B0 11
#define C1 12
#define Cs1 13
#define Db1 13
#define D1 14
...
...
...
#define B10 131
These constants are used with the notePlaying? and filters? commands, among others.
A special set of note constants is used for playing percussion. By songlib covention, the following notes correspond to the following percussion instruments:
|
note suffix | named constant | explanation |
| 3 | BLOCK_LOW | wood block, low |
| 6 | BLOCK_MIDDLE | wood block, middle |
| 9 | BLOCK_HIGH | wood block, high |
| 12 | BASS_LOW | bass drum, low |
| 15 | BASS_MIDDLE | bass drum, middle |
| 18 | BASS_HIGH | bass drum, high |
| 21 | CLAP | hand clap |
| 24 | COWBELL | cowbell |
| 27 | CRASH | crash cymbal |
| 30 | CRASH_ALT | crash cymbal, alternate |
| 33 | HAT_CLOSED | high hat, closed |
| 36 | HAT_OPEN | high hat, open |
| 39 | HAT_PEDAL | high hat, pedal |
| 42 | KICK | pedal drum |
| 45 | KICK_ALT | pedal drum, alternate |
| 48 | RIDE_ | ride cymbal |
| 51 | RIDE_ALT | ride cymbal, alternate |
| 54 | RIDE_BELL | ride cymbal, bell |
| 57 | SNARE | snare drum |
| 60 | SNARE_ALT | snare drum, alternate |
| 63 | STICK | stick on rim |
| 66 | STICKS | stick on stick |
| 69 | TIM_LOW | timbale, low |
| 72 | TIM_MIDDLE | timbale, middle |
| 75 | TIM_HIGH | timbale, high |
| 78 | TOM_LOW | tomtom, low |
| 81 | TOM_MIDDLE | tomtom, middle |
| 84 | TOM_HIGH | tomtom, high |
| 87 | CRASH_CHOKE | short crash |
| 90 | BELL | bell |
| 93 | CHINA | china cymbal |
| 96 | SPLASH | splash cymbal |
| 99 | TAMBOURINE | tambourine |
| 102 | SHAKER | shaker |
| 105 | RIMSHOT | rim shot |
| 108 | PERC8 | percussion |
| 111 | PERC9 | percussion |
| 114 | PERC10 | percussion |
| 117 | PERC11 | percussion |
| 120 | PERC12 | percussion |
| 123 | PERC13 | percussion |
| 126 | PERC14 | percussion |
| 129 | PERC15 | percussion |
Assuming the notes have been set up properly, one would use these constants thusly:
drumset = readScale("/usr/local/share/samples/drums/","hydrogen_");
snplay(Q,drumset,COWBELL);
snplay(I,drumset,CRASH);
Drums are usually played with the snplay playing function, since the entire note will play but the song will advance only the requested number of beats. There is a version of snplay that randomly introduces some slop into the amplitude, pitch and timing of the note:
for (i = 0; i < 4; ++i)
drum(I,drumset,TOM_MIDDLE)
This makes a repetitive series of beats sound less mechanical.
lusth@cs.ua.edu