Humdrum Extras

prange manpage


COMMAND

    prange -- Generate pitch histogram data from **kern input data.

SYNOPSIS

    prange [-d[-f | -p percentile[input(s)[> output]

OPTIONS

    -d Generate pitch histograms which are weighted by the duration of the notes.
    -f Also print the fraction of total notes contained in one frequency bin. **fracL contains the lowest fractional value, **fracH contains the highest fractional value, and **fracA contains the average fractional value for each pitch bin. Fractions are described from lowest pitch (0.0) to highest pitch (1.0)
    -c range Count the number of notes in a given pitch range. The range can either be in MIDI note numbers, such as -c 60-71 for the fourth (middle C) octave, or in terms of **kern pitches: -c c:b where the range separator is a colon (:) or a space (-c "c b") so as not to confuse the dash sign (-) between a range separator and a **kern flat sign. MIDI ranges may substitute the dash with a colon.
    -p percentile Identify the MIDI note number of the pitch which occurs at the specified percentile in the range of the music.

DESCRIPTION

    The prange program generates a pitch histogram from input **kern data and then displays this histogram, or you can have it display a pitch (as a MIDI note number) which occurs at a given percentile in the histogram.

EXAMPLES

    Analysis data generated in the examples below are generated from the Prelude from J.S. Bach's first cello suite in G Major, BWV 1007:


    MIDI

    The command:

       prange bwv1007-01.krn
    will give the note-count pitch histogram sorted by pitch from low to high. The first column of the output is the MIDI note number, the second column is the **kern equivalent value for the MIDI note number, and the third column is the count of notes in the score which have the given pitch. (tied notes count as 2 or more pitches in this count):

    Note that the lowest note is on key 36 (C2 -- the bottom note of cello), and the highest note is 67 which is the G4 above middle C. The most common note is the A3 below middle C which occurs 113 times in the score.

    Now, suppose that you want the pitch which falls in the 33% percentile of the histogram above. To do this use the command option -p 33 (or -p .33):

       prange -p 33 bwv1007-01.krn
    The result will be 52 which is E3. For the 67% percentile:
       prange -p 67 bwv1007-01.krn
    you will get 57 which is A3. The average pitch is at the 50% percentile:
       prange -p 50 bwv1007-01.krn
    which is 54, or F#3. Notice that the 33% percentile and the 50% percentile pitch are just a whole tone away from each other.

    You may also want to weight the importance of a pitch by its duration, so that a lot of short notes do not overpower long sustained notes in the music. To do this you use the -d option to weight the pitches by their durations. For example, here is the pitch histogram for the same piece using the duration weighting:

    C2 occured for a duration of 0.75 quarter notes, and the highest pitch occured for a duration of 7 quarter notes. A3 still is the most important pitch in the piece since it lasts a total of 28.25 quarter notes.

    To get the average pitch:

       prange -p 50 -d bwv1007-01.krn
     	55
    Compare to not using -d option:
       prange -p 50 bwv1007-01.krn
     	54
    The 33% percentile based on duration weighting:
      prange -d -p 33 bwv1007-01.krn
     	52
    The 67% percentile based on duration weighting:
       prange -d -p 67 bwv1007-01.krn
     	57

    The prange program can also accept multiple input files so that the pitch profile of an entire corpus can be calculate at the same time. For example, here is the duration-weighted pitch histogram for all 52 of Chopin's Mazukas:

    The duration-weighted median pitch of the Chopin Mazurkas is MIDI note 61 (C#-4) which is a semi-tone above middle C.

    Displaying fractional histogram values

    The -f option is used to add extra information to the basic output when there are no other option flags. In the following example output from the cello prelude, the **fracL indicates the bottom fraction of notes on the given pitch, **fracH indicates the top fraction of notes on the given pitch, and **fracA indicates the average histogram fraction for the given pitch on the line.

       prange -f bwv1007-01.krn

    Counting pitches in a range

    The -c option is useful for counting the number of notes in a give range of pitches. For example, the following command counts the number of notes in the fourth octave which is from MIDI note 60 to 71:

       prange -c 60-71 bwv1007.krn
        86
    This can also be done by specifying the **kern start and stop pitches:
       prange -c c:b bwv1007.krn
        86

    Counting the number of pitches below middle C:

       prange -c 0-59 bwv1007.krn
        571

    Counting the number of pitches middle C and higher:

       prange -c 60-127 bwv1007.krn
        86

    Counting pitches in all registers:

       prange -c 0-127 bwv1007.krn
        657

    More example usages of the prange program are avaliable on the prange examples page

SEE ALSO

    pitchhist

DOWNLOAD

    The compiled prange program can be downloaded for the following platforms:
    • Linux (i386 processors) compiled on 1 Apr 2005.
    • Windows compiled on 1 Jun 2006.

    The source code for the program was last modified on 1 Apr 2005.