-
Notifications
You must be signed in to change notification settings - Fork 0
05 Specifying durations

MIDI-Perl has typing shortcuts for note duration values. For a quarter-note this is qn. For a whole-note this is wn. A dotted half-note is indicated with dhn. A single triplet eighth-note is indicated with ten.
Also a MIDI duration can be given as 'd' . $num, where $num can be any integer from 1 on up. A quarter-note is equal to d96. In this tutorial, we will only use the traditional valued, note duration shortcuts.
Please use the midi-simple-dump program to inspect these values (and more). Hunting through the MIDI-Perl documentation can leave you scratching your head...
For finer grained note durations, like 32nd, 64th, and 128th notes, use the Music::Duration module. These are given by the typing shortcuts y, x, and z respectively. So for example, yn would be a 32nd note, and tzn would be a 128th note triplet!
Example 1 (Run, then replace "Music::Duration" with "MIDI::Simple", then re-run and notice the difference.)
A span of length (like a measure of 4 beats) can be partitioned into smaller fragments with the Music::Duration::Partition module, thus making a rhythmic motif.