The Meter Program
The meter program takes a list of notes, and produces a framework of rows of beats.
The input file for the metrical analyzer must consist of a series of note statements, with the word "Note" followed by an on-time (in milliseconds), an off-time (in milliseconds) and a pitch (using the standard convention of middle C=60). Any lines which do not fit this format will be ignored. Here is part of the notefile for the melody "Yankee Doodle" (available as notefiles/misc/yankee.q.notes):
Note 0 250 67 Note 250 500 67 Note 500 750 69 Note 750 1000 71 Note 1000 1250 67 Note 1250 1500 71 Note 1500 1750 69 Note 1750 2000 62 Note 2000 2250 67 Note 2250 2500 67 Note 2500 2750 69 Note 2750 3000 71 Note 3000 3500 67 Note 3500 4000 66Another format is also acceptable: on-times and off-times can be listed on separate lines, beginning with "Note-on" and "Note-off". For example, the beginning of "Yankee Doodle" would look like this:
Note-on 0 67 Note-off 250 67 Note-on 250 67 Note-off 500 67The notes need not be listed in chronological order. Notes of the same pitch may overlap; if they do, the earlier note will simply be truncated at the point where the later note begins.
Notefiles can be generated from MIDI files, by using the program "mftext", which we provide. (Besides note statements, the mftext program may generate other things such as time signature and track statements; these will simply be ignored by the meter program.)
What the meter program does is generate a framework of rows of beats. There are normally five levels of beats, which we call levels 0, 1, 2, 3 and 4. Each beat must also be a beat at the next level down; and exactly one or two beats must elapse between each pair of beats at the next level up. The first thing that the program does is to quantize the timepoints of the input to small units called "pips". Pips are normally 35 milliseconds. It also assumes that all beats occur at the beginnings of pips. The program then generates levels one at a time. It begins with the middle level of meter, the "tactus" level; it then generates two lower levels and two higher levels. In finding the best metrical analysis, the program tries to align beats with the beginnings of notes, particularly longer notes; it also tries to maximize the regularity of beats at each level (so that differences in interval between adjacent beat pairs are minimized).
The output of the meter program looks like this (this is the output for the first two measures of "Yankee Doodle", shown above):
Beat: 0 x x x x x (67) Beat: 105 x () Beat: 245 x x (67) Beat: 350 x () Beat: 490 x x x (69) Beat: 595 x () Beat: 735 x x (71) Beat: 875 x () Beat: 1015 x x x x (67) Beat: 1120 x () Beat: 1260 x x (71) Beat: 1365 x () Beat: 1505 x x x (69) Beat: 1610 x () Beat: 1750 x x (62) Beat: 1855 x () Beat: 1995 x x x x x (67) Beat: 2100 x () Beat: 2240 x x (67) Beat: 2345 x () Beat: 2485 x x x (69) Beat: 2625 x () Beat: 2765 x x (71) Beat: 2870 x () Beat: 3010 x x x x (67) Beat: 3115 x () Beat: 3255 x x () Beat: 3360 x () Beat: 3500 x x x (66) Beat: 3605 x () Beat: 3745 x x () Beat: 3850 x ()Each line represents a beat at the lowest level. The number on the left represents the timepoint at which that beat begins. The x's to the right of the timepoint show the levels of beats that are present at that timepoint. For example, at the timepoint 490, there are beats at levels 0, 1, and 2, not levels 3 and 4. To the right of that are shown the pitch-events that begin at that timepoint. (Remember that all event timepoints have been quantized to pips.) If the onset of a pitch does not coincide with any beat (which is possible), it is not shown at all in this display.
The graphic display shown above is outputted when the "verbosity" parameter is set to 1. (See below for discussion of parameters.) If verbosity is set to 0, the output will be something like this (again, this is for the opening of Yankee Doodle):
Beat 0 4 Beat 105 0 Beat 245 1 Beat 350 0 Beat 490 2 Beat 595 0 Beat 735 1 Beat 875 0 Beat 1015 3 Beat 1120 0 Beat 1260 1 Beat 1365 0 Beat 1505 2 Beat 1610 0 Beat 1750 1 Beat 1855 0This gives the same information as the graphic output, except that the beats present at a given timepoint are indicated by a number, giving the highest beat level present at that point. This "beat list" is followed by a listing of the notes (with their timepoints quantized to "pips" as described above). This output format can then serve as input to the harmonic program discussed below.
Parameters. The user-settable parameters for the meter program are as follows. We also show the default value for each parameter. All time values are in milliseconds.
verbosity=1 The amount of information outputted by the program. With verbosity=0, it outputs just a list of notes and beats; with verbosity=1, it outputs the graphic display; with verbosity=2, it outputs much other information. pip_time=35 The length in milliseconds of pips (see above). tactus_min=400 The minimum time interval allowed between tactus beats. tactus_max=1600 The maximum time interval allowed between tactus beats. tactus_width=1.8 The maximum ratio allowed between the longest and shortest time interval in the tactus level. tactus_step=1.1 Given a global range for the tactus intervals (specified by tactus_min and tactus_max), the program searches a series of smaller ranges (whose width is specified by tactus_width). The tactus_step value specifies how close together these ranges are: specifically, the ratio between the limits of adjacent ranges. beat_interval_factor=3.0 The weight of the "beat interval scores". Each beat in a tactus-level analysis contributes a score reflecting its regularity in the pattern; the score is given by the difference between adjacent beat intervals. (This is also used at lower levels; here it applies to the lower-level beat intervals between a pair of higher-level beats.) These beat interval scores are multiplied by this factor. note_factor=1.0 The weight of the "note scores": the preference for beats on event-onsets and long event-onsets. Each note that coincides with a beat in an analysis contributes a score. The score is a function of the effective length of the note (see below) and the number of other notes that begin at that point. This factor multiplies all these note scores. beat_slop=35 If a beat is within this distance of a note-onset, it is considered aligned with that note-onset for scoring purposes. meter_change_penalty=0.3 At sub-tactus levels, switching from a duple division to a triple division of the beat (or vice versa) carries this penalty. raising_change_penalty=3.0 At higher levels, switching from a duple grouping to a triple grouping of the beat (or vice versa) carries this penalty. duple_bonus=0.05 At sub-tactus levels, each duple division of a beat carries this additive bonus relative to a triple division. triple_bonus=1.4 At levels above the tactus, each triple division of a beat carries this bonus relative to a duple division. (The bonus is "multiplicative"; all the note scores for a triple meter analysis are multiplied by this factor.) max_effective_length=1.0 The effective length of a note is the maximum of its duration and its "registral inter-onset interval": the distance to the next note within a range of nine semitones. However, the effective length is never allowed to exceed this value. note_bonus=.2 This is a bonus that is added to the note score for each note. highest_level_to_compute=4 The highest metrical level to be generated by the program. The tactus level - the first one generated - is always level 2. lowest_level_to_compute=0 The lowest metrical level to be generated by the program. (No levels lower than 0 are allowed. If you want to have three levels below the tactus, what you must do is rename the tactus level as level 3 in the meter.h file.) duration_augmentation=0 This allows an arbitrary number of pips to be added to the length of each note (after first rounding its length off to the nearest pip).