Humdrum Extras

notearray manpage


COMMAND

    notearray -- Extract 2-D array of notes from **kern spines for numeric analysis.

SYNOPSIS

    notearray [-md[-MClaAN[input(s)[>output]

OPTIONS

-a Store the absolute beat position for each line starting from the beginning of the music.
-b Store only bibliographic record (reference records) as comments in the output data.
-c Insert a column-type description number as the starting row of the note array.
-d Represent notes as absolute diatonic (base-7) numbers.
-e Store and ending sonority which preserves the note-off state of the last notes in the score.
-f Represent metric position and absolute beat positions as rational numbers, using only fractional values. Also see the -r option.
-j Use Josquin preset options: "-t 1 --double".
-k Generate a column of note names in the text-based **kern format.
-l (lowercase L) Display the line number in the original file for the sonority as a value in a column on the far left of the array.
-m Represent notes as absolute MIDI key (base-12) numbers.
-o # Octave offset for pitch numbers.
-r Represent metric position and absolute beat positions as rational numbers. Integer part of the number is separated from the fractional part by a plus sign. For example, 3.5 is displayed as 3+1/2. Also see the -f option.
-t beat Specifies the timebase of a beat with which to do a rhythmic analysis of the score. By default, the beat will be defined by time signatures within the score. However, if a fixed-width beat should be used throughout the score to identify beat locations, then use this option. For example, -t 2 means to set the beat duration to a half note; -t 4. would set the beat to a dotted quarter note.
-1 (digit 1) For --attack, --next and --last options, start the index values at 1 rather than 0.
-A Display all location information columns at left-side of note array. Equivalent to using the options -l (lowercase L) and -a.
-B Do not display a column for the beat position of the sonority within the measure.
-C Do not display any comments (including bibliographic records) in the output data from the original input file. See also the -b option.
-D Generate a column of durations for each row.
-H Print output data in a Humdrum file format.
-I Don't show the header comment describing the data type of each column.
-M Do not display a column for the measure number in which the sonority occurs.
-N Do not display any information columns to the left of the notes on each line of the array. Equivalent to using both of the options -C and -M.
-S Suppress display of data lines which only contain note sustains and no note attacks or rests.
-T Print tie start/stop markers on a single note if a note attack does not continue as a sustain on successive rows in the array.
--attack Generate an index column for the attack of each note in a note column.
--double Place a row of rests when a double barline is encountered in the data.
--last Generate an index of notes preceding the currently sounding note within the given voice's note column
--math var Output the data in a format which can be loaded into Mathematica. The var string is the variable name for the note array in the output data.
--mel Display all melodic note index columns (equivalent to --attack --last --next).
--mo # Measure number offset between multiple input files, typically using a value such as 1000, which would store the file number in the thousands digit, and the measure numbers within the file in the first three digits.
--next Generate an index of notes following the currently sounding note within the given voice's note column
--no-tie When the -k option is used, do not include tie information ([ = start of tied note group; _ = middle note in tie group; ] = end note in tie group.
--offset # Indices for the index column as well as attack, last and next index columns start at the given positive integer rather than 0, or 1 (when the -1 option is used).
--quote Place quote characters around pitch names generated with the -k option.
--sa Generate a single absolute beat count across multiple input files.
--sep Place a separator comment line between analysis data from different input files.

DESCRIPTION

    The notearray program takes an input Humdrum file with one or more **kern spines and outputs pitch information for the musical score as a two-dimensional array. Each row of the output data represents a sonority within the score with note attacks represented by positive integers, notes sustained from previous sonorities as negative integers, and rests as the value 0. Each column represents a voice in the score.

    By default, two columns of rhythmic information are stored at the start of the note array: (1) the measure number in which the sonority occurs, and (2) the starting beat position of the sonority within the measure. Each **kern part should be monophonic by itself; otherwise, only the primary (left-most) notes in a part will be extracted. Here is an example run of the notearray program with no additional options being used:

    input data
    notearray input > output

    In this example, the first column of output data shown on the right contains the measure number in which the notes on each line were extracted. The second column list the beat within the measure at which the notes occur. Then there are four columns (one for each input **kern spine) which stores the pitch information of each spine. The default numbering system used in the output data is the base-40 system (described below). In this case the number 128 means D3, or the note D a seventh below middle C. When a note value is negative, this indicates that the note is being sustained from a previous sonority within the score. Note values of 0 represent rests.

    Pitch numbering methods

    Each of the three output one-dimensional numbering methods for pitches is based on chroma (or pitch-class) and octave values. The base value indicates the octave number, and the chroma can be extracted from the modulo, or remainder:
      octave  = number  /  base
      chroma = number % base
    For example, in base-12, the note number 60 represents middle C, with the octave being 5 and the chroma being 0:
      octave  = 60  /  12 = 5
      chroma = 60 % 12 = 0

    For base-12, the default octave for middle C is 5 so that it matches MIDI key numbers, while in base-40 and base-7, middle C's octave is set to 4 so as to match the ISO labeling of octaves. If the input data contains very low notes, then some pitches will incorrectly be assigned to negative octaves (and 0 may represent a pitch as well as a rest). To avoid these cases, use the -o # option to transpose the integer values for pitch up the specified number of octaves to avoid negative octaves in the output data (since negative values are intended to represent sustained notes).

    input
    notearray
    notearray -o 1
    notearray -o 2
    Note in the above example that 202 is 40 (the base-40 octave) greater than 162, since the notes in the "-o 1" column are an octave higher, and the notes in the next column are 80 greater than the original data since they are two octaves higher.

    Base-40

    Base-40 is a method of encoding diatonic pitches with accidentals up to double sharps or flats. The base-40 chroma for pitches can be built up from the property that a minor second is a difference of 5 between pitch numbers in the base-40 system, and major seconds are a difference of 6. The C chroma value is set to the value 2 rather than 0 so that the octave values for C♭ and C♭♭ remain in the same octave as C♮ just above these pitches when using division by the base to extract the octave number. Here is a complete table of the base-40 chroma, using C=2 as the reference:

    Base-40 chroma values (pitch classes)
    0=C♭♭
    1=C♭
    2=C♮
    3=C♯
    4=C♯♯
    5=[D♭♭♭]
    6=D♭♭
    7=D♭
    8=D♮
    9=D♯
    10=D♯♯
    11=[E♭♭♭]
    12=E♭♭
    13=E♭
    14=E♮
    15=E♯
    16=E♯♯
    17=F♭♭
    18=F♭
    19=F♮
    20=F♯
    21=F♯♯
    22=unused
    23=G♭♭
    24=G♭
    25=G♮
    26=G♯
    27=G♯♯
    28=[A♭♭♭]
    29=A♭♭
    30=A♭
    31=A♮
    32=A♯
    33=A♯♯
    34=[B♭♭♭]
    35=B♭♭
    36=B♭
    37=B♮
    38=B♯
    39=B♯♯

    To calculate an absolute pitch such as G4 (The G above middle C), multiply the octave by 40 and add the chroma value for the G pitch-class:

    G4 = 4 * 40 + 25 = 160 + 25 = 185
    Alternatively, G4 can be calculated by adding 3 half-steps (major seconds) and one minor second to C4 (represented as the number 162 in base-40):
    G4 = C4 + 3 * M2 + m2 = 162 + 3 * 6 + 5 = 162 + 23 = 185

    Note that base-40 pitch representations preserve chromatic alterations of diatonic pitch-classes (up to double sharps/flats). Therefore F♯4 (180) is not in the same as the base-40 pitch G♭4 (184). A useful property of the base-40 system is that the difference between pitch numbers in the base-40 system represent one-to-one mappings with diatonic intervals:

    Base-40 interval classes (d=diminished, m=minor, M=major, P=perfect, A=augmented)
    -2=dd1
    -1=d1
    0=P1
    1=A1
    2=AA1
    3=[dd2]
    4=d2
    5=m2
    6=M2
    7=A2
    8=AA2
    9=[dd3]
    10=d3
    11=m3
    12=M3
    13=A3
    14=AA3
    15=dd4
    16=d4
    17=P4
    18=A4
    19=AA4
    20=unused
    21=dd5
    22=d5
    23=P5
    24=A5
    25=AA5
    26=[dd6]
    27=d6
    38=m6
    29=M6
    30=A6
    31=AA6
    32=[dd7]
    33=d7
    34=m7
    35=M7
    36=A7
    37=AA7
    (40=octave)

    As an example, consider the interval between E4 (174) and C4 (162) which is 174-162 = 12, representing a major third according to the table shown above. All intervals can be constructed by observing that major seconds are 6 and minor seconds are 5, so note that a major third, consisting of two major seconds, is 6 + 6 = 12. Below is an example segment of music with the pitches labeled in the base-40 system. Try subtracting values and comparing the results to numbers in the base-40 interval-class table above.

    Base-12

    Base-12 numbering of pitches assigns 12 notes to an octave as on a standard musical keyboard. The values output by the notearray program match the values used as MIDI key numbers, where middle C is assigned to be 60, C♯4/D♭4 to 61, D4 to 62, etc. This makes the octave value for middle C up to the B a major seventh above to be one higher than for the base-40 or base-7 outputs from notearray at 5, compared to 4 for the other numbering methods' middle octave. Using the option "-o -1" will make the base-12 numbers match the same octaves as base-40 and base-7; or conversely, you can use "-o 1" for base-40 and base-7 outputs so that the middle-C octave is 5 to match that of the base-12 output.

    Base-12 chroma do not map one-to-one with diatonic-based pitch-classes. For example, C♯4 and D♭4 belong to different diatonic pitch-classes, but they have the same base-12 pitch value (represented by the number 61).

    Base-12 chroma values
    0=B♯, C♮, D♭♭, etc.
    1=B♯♯, C♯, D♭, etc.
    2=C♯♯, D♮, E♭♭, etc.
    3=D♯, E♭, F♭♭, etc.
    4=D♯♯, E♮, F♭, etc.
    5=E♯, F♮, G♭♭, etc.
    6=E♯♯, F♯, G♭, etc.
    7=F♯♯, G♮, A♭♭, etc.
    8=G♯, A♭, B♭♭♭, etc.
    9=G♯♯, A♮, B♭♭, etc.
    10=A♯, B♭, C♭♭, etc.
    11=A♯♯, B♮, C♭, etc.
    Base-12 maps one-to-one with pitch frequencies in an equal-tempered scale, but not necessarily in other temperaments. For example C♯4 and D♭4 are both represented by the base-12 number 61, and they also map to 277.183 Hz in equal temperament when setting A4 to 440 Hz. However, in other tuning systems and temperaments with more than 12 notes, C♯4 and D♭4 may map to different fundamental frequencies (for example in string-quartet performances).

    Essentially, representing pitches in base-12 is equivalent to stripping off the accidental information of base-40 diatonic values. Or another way of stating this is that you can unambiguously map base-40 values to base-12 values, but not the other way around. Here is the same example segment of music, with pitches given base-12 numbers:

    Base-7

    Base-7 is a representation of the pitches in diatonic form without any accidental alterations. For example, C♭4, C♮4, and C♯4 are all represented by the number 28 = 0 + 4 * 7, where 0 is the base-7 C chroma, 4 is the octave and 7 is the base. Base-7 values are another method of stripping accidental information off of base-40 values.
    Base-7 chroma values
    0=C♭♭, C♭, C♮, C♯, C♯♯ etc.
    1=D♭♭, D♭, D♮, D♯, D♯♯ etc.
    2=E♭♭, E♭, E♮, E♯, E♯♯ etc.
    3=F♭♭, F♭, F♮, F♯, F♯♯ etc.
    4=G♭♭, G♭, G♮, G♯, G♯♯ etc.
    5=A♭♭, A♭, A♮, A♯, A♯♯ etc.
    6=B♭♭, B♭, B♮, B♯, B♯♯ etc.

    Here is the same example segment of music, with pitches given base-7 numbers:

    Note names

    The -k option can be used to include a column of note names before each numeric column describing the notes. The --quote option may be used to enclose the kern pitch name in quotes. The --no-tie option can be given to hide tied note information on the **kern note name. The -T option can be used to mark a tie-start ([) and tie-end (]) on a note which only exists on a single row (i.e., it does not sustain past the current row).

    Output formats

    The output note array data can be formatted in three styles. The default output style is suitable for loading into matlab, where the data represents a matrix with tab characters separating values in each row. The -H option will generate data in a proper Humdrum file format. The --math option will format the output data into a form which can be read into Mathematica.

    For automatic identification of each column's data type, the -c option can be specified. This will insert a row of integers at the top of the array which describes the data stored in each column:

    1000
    =
    **kern-style (text-based) note names.
    1007
    =
    Note column for a voice/part in the score, specifically in base-7 encoding (diatonic pitches without accidentals).
    1012
    =
    Note column for a voice/part in the score, specifically in base-12 encoding (MIDI key numbers).
    1040
    =
    Note column for a voice/part in the score, specifically in base-40 encoding (diatonic pitches with up to double accidentals).
    2000
    =
    Line number of sonority/matrix row in input file.
    3000
    =
    Measure number of row.
    4000
    =
    Beat position of row within the measure.
    5000
    =
    Absolute beat position of the row within the score.
    6000
    =
    Duration of the current row of notes.
    7100
    =
    Indices to the attack of the current note
    7200
    =
    Reverse indices to the attack of the previous note.
    7300
    =
    Forward indices to the attack of the next note

    An index column (generated with the -i option) will not have a type number, and all rows in the index column will represent line indices for that row of the array. Typically the index column is not needed by processing program which can count the lines of the array by themselves, and the index column is more useful for human readability of note index values.

    In the following example, the -c option adds the column description number, and the -I option suppresses the textual comment describing the column type. The -C option can be used to suppress echoing any comments in the input data into the output, generating purely numeric data:

    input data
    notearray -cIC input > output

    Matlab

    This is the default output format. Each data row consists of a constant number of values (unless multiple input files containing different numbers of parts are given) which can be loaded into a matrix in matlab or octave with the following command:
       load('data')
    where "data" is the name of the file in which the output data is stored, plus the extension ".mat". Alternatively, if the filename is data.dat or with some other extension, then load with the command load('data.dat'). The loaded data will be stored in a matrix with the same name as the file (without the extension) which can be further processed, such as with the size() function which reports the number of rows and columns in the matrix:
             octave:2> size(data)
             ans =
          
                190     5

    The matlab-style note array can be loaded into python with code like this:

    Humdrum

    Specifying the -H option will format the output data as a Humdrum file which can be further processed with Humdrum tools.
    notearray -H input > output

    Note that the two commands in the following example will produce the same results, where rid is a standard Humdrum Toolkit program which is removing interpretations and global comments, leaving only data lines:

    notearray -CI input
    notearray -H | rid -GI input

    Mathematica

    For generating data which can be loaded into Mathematica, use the --math option. When using the --math option, you must also specify a variable name for the array in the output data. For example:

    notearray -am --math twobars input > data.ma

    Notice that the text string after the --math option name (twobars) was used to set the name of the data in the above output. The -a option was used to add an additional column of information showing the absolute beat position within the score of each data row (the score duration since the start of the music). The -m option was used to display pitches in base-12 (MIDI key number) format.

    The Mathematica output data can be loaded into Mathematica using the Read[] function:

           SetDirectory["C:/wherever"];
           Read["data.ma"]

    An example application of this data would be to load into Mathematica, and then generate piano-roll notation from the data with the following function:

    which generates this plot, with pitch on the y-axis and score duration (in quarter notes) on the x-axis:

    The default output from notearray can also be loaded into Mathematica via a different method, provided that the -C option is used to suppress comment lines in the output data, and the -I is used to suppress the column data-type comments. The raw numeric data (without comments) can be loaded into Mathematica as tab-separated values:
            SetDirectory["C:/wherever"];
      	variable = Import["file.dat", "TSV"];
     
    When multiple input files are processed by notearray, the Mathematica-formatted output will contain a nested list of data for each input file.

    Position information columns

    Five types of positional information can be given on the left side of the note array. By default the first two columns of data for each row in the array are the measure number and the starting beat position of the sonority within the measure. These columns can be suppressed with the -M and -B options, respectively. Use both options to suppress both columns of information, or use the -N option to suppress both columns of positional information, so that only note columns are output:

    input data
    notearray -N

    Two additional informational columns are also available. The -l option will display the line number in the input Humdrum data from which the sonority was extracted. This is useful when linking analysis data back to the orignal score. The -a option will display the absolute beat position which is the duration between the start of the music and the beginning of the sonority. All five information columns can be displayed by using the -A option, which is equivalent to giving the -l, -a and -D options. Information columns will always be displayed in a fixed order: (1) line number in original file, (2) measure number, (3) metric position, (4) absolute beat position, and (5) row duration.

    notearray -A

    Using the -i option will cause the first column in the array to display the line index for each row of the array. By default, the indexing starts at 0, but can be started at 1 by using the -1 (numeral one) option. Other positive starting index values can be specified with the --offset # option, where # is a positive integer. This option is useful when concatenating individual arrays together into a larger array.

    Here is a summary of the options which can be used to display or suppress position information to the left of the note columns:

    -a
    Add a column of numbers which indicates the starting position of the sonority relative to the start of the music.
    -l
    (lowercase L) Add a column of numbers which indicates the line in the input Humdrum data from which the notes in the row were extracted.
    -D
    Add a column of with the duration of each row. This is equivalent to subtracting the absolute beat position of the next row from the current row. The duration of the last row in the array is similar to including a rest row with the -e option to record the absolute beat position of the ending of the last row sonority.
    -i
    Add a column of numbers which indicates the row index of the current line in the note array. Index values start at 0 unless the -1 option is used to start them at 1, or the --offset option is used to start the line indexing at another value.
    -N
    Suppress display of default position information columns (measure numbers and beat positions within the measure). Equivalent to using the two options "-MB".
    -A
    Display all position information columns (except the index column generated by the -i option). Equivalent to using the two options "-la".
    -M
    Suppress the display of the measure number column.
    -B
    Suppress the display of the beat number column.

    Rational values for beat positions

    Beat and absolute beat positions are displayed as floating-point numbers by default. If you need to avoid round-off errors for tuplets, you can use the -r option to display these values are rational numbers. In the following examples, numbers such as 1.5 in the beat column are converted into numbers such as "1+1/2".

    notearray
    notearray -r

    To display the beat values as rational fractions and not as a compound integer value plus fractional part, use the -f option. This will convert 1.5 into "3/2" rather than "1+1/2":

    notearray
    notearray -f

    Parallel indexing arrays

    The note data consists of rows of sonorities which can be composed of note sustains (negative integers), note attacks (positive integers) and rests (zeros). In order to navigate melodically through the columns, several options can be used to store indices of the current, previous and following note within each note column:
    --attack Store an index of the note attack for the currently sounding note. The attack index column will be placed immediately to the right of the note column it describes.
    --last Store an index of the previous note attacked in the note column. The last-note index column will be placed immediately to the right of the note column it describes.
    --next Store an index of the note attack for the currently sounding note. The next-note index column will be placed immediately to the right of the note column it describes.
    --mel Store all melodic index columns for each note column. Equivalent to using the options --attack, --last, and --next.
    The current, last and next note-attacks information stored in these index columns can be generated relatively easily in the programming environment which loads the note information, but the indexing options are provided for convenience.

    With the information in these index column, the duration of each note can be calculated from a simple algorithm: The duration of the current note is the difference between the absolute attack time of the next note minus the absolute time of the attack of the current note. See the -e option for details on determining the duration of the last note in each note column.

    notearray --mel -Naie input

    Note that index values of -1 are used to indicate that there are no notes before the first note in the column (for --last data), and no notes after the last note in the column (for --next data). When multiple input files are given to the program, the next and last data columns do not span multiple inputs, so -1 indices will be found at the boundaries. However, the non-negative index values will increment continuously between multiple inputs.

    Comments and reference records

    By default all global comments and reference records will be echoed into the output data as comments. These comments can be suppressed by using the -C option. To suppress global comments and only echo bibliographic (reference) records, use the -b option. For output formats other than the Humdrum file format (generated with the -H option), an initial comment line before the first data line describing each data column will be given unless the -I option is used to prevent its printing.

    Ending rests

    By default, the notearray program generates one row in the output array for each data line in the input Humdrum file. The duration of each row can be calculated from the information column produced by the -a option (the absolute beat position for the row). The difference between each absolute beat position is the duration for the sonority of each row. However, the duration of the last row cannot be calculated without knowing when the last sonority is released. Therefore, the -e option can be used to generate a rest sonority after the end of the last sonority in the score to allow calculating the duration of the last row in the note array.
    notearray -am
    notearray -ame

    In this example, the extra row in the output data allows the duration of the last sonority to be determined (6 - 4 = 2 beats). And the duration of the entire score is the absolute beat position of the rest in the last row (6 beats).

    Double-barline rests

    A row of rests can be inserted in the output data when double barline occur in the score by specifying the --double option. This is useful to separate phrases in certain types of music.

    Sustained sonority suppression

    Using the -S option will suppress all output lines which contain only sustained notes. This is used to generate more parsimonious data.

    Beat duration

    The -t option can be used to specify the duration of beats within the music. For example music in 6/8 will automatically be assumed to be in a compound meter with the beat equal to the dotted quarter note ("-t 4."). However, in certain cases the beats might instead be defined on the eighth-note level ("-t 8").

    input
    notearray -r -t 4.
    notearray -t 8

    Multiple input files

    The following options work when multiple input files are given to the notearray program.

    Measure numbers

    The -mo option can be used to generate unique measure numbers in the output data when multiple files are given as an input. The -mo option is useful for keeping track of the source file in the output data when there are multiple input files. The option takes an integer argument which is the an increment in the measure number offset for each input file. For example if --mo 1000 is used, then a value of 1000 will be added to the measure numbers of the first file's output, 2000 to the second file's output, and so on. This allows the originating file to be identified in the output data (provided in this case that no file contains a measure number greater than 1000, in which case the increment should be set to 10,000).

    input 1
    input 2
    notearray -I --mo 1000 input1 input2

    Absolute beat values

    When multiple files are input, the absolute beat values generated by the -a option will continue across multiple files. To rest the absolute beat values for each input, use the --sa (--separate-absolute) option. Note in the following example that the third column (absolute beat) in the first output reset to zero at the start of the output for the second input file, while in the second notearray output starts the absolute beat position of the second file at the ending duration of the first file.

    input 1
    input 2
    notearray -Ia input*
    notearray -Ia --sa input*

EXAMPLES

    Constant-duration sonorities

    To generate note arrays with a constant duration for each row, pre-process the Humdrum data with the standard Humdrum Toolkit program timebase. The timebase command is used to insert null record rows into the original data so that a constant spacing at the given rhythmic duration is given to each line of data.

    In the following example, the smallest rhythm is a sixteenth note, so the timebase rhythm is set to 16 which makes each line of data represent a sixteenth note.

    timebase -t 16 input
    timebase -t 16 input | notearray

    Bach chorales

    Here is a demonstration of how to generate data for 370 Bach chorales in a single step:
        notearray --mo 1000 --mel --sep -ali *.krn > bachchorales.txt
     

    The output file contains 30279 sonorities from all of the chorales, with a total duration of 19814 quarter notes.

    The --sep option is used to place a comment line between analyses from different input files. The "--mo 1000" option is used to store the file name in the 1000's digit of the measure numbers in the output data.

    Separating sonorities into beats/offbeats

    A simple method of separating sonorities occurring on the beat or off-beat can be done using the hgrep program to select tokens in the **beat column depending on whether they contain a decimal point or not. Sonorities on beats will have an integer beat position without a decimal point, while sonorities on offbeats will have a beat position containing a decimal point and a fractional part.

    Extracting sonorities off of the beat:

    notearray -HMk h://371chorales/chor002.krn | hgrep -Fx '**beat' '\.'

    Extracting sonorities on the beat:

    notearray -HMk h://371chorales/chor002.krn | hgrep -Fvx '**beat' '\.'

    Extract sonorities on the beat, including sonorities containing only sustained notes:

    humcat h://371chorales/chor002.krn | timebase -t 8 \
       | notearray -HMk | hgrep -Fvx '**beat' '\.'

    Count the pitch classes in sonorities on offbeats:


    notearray -HMk h://371chorales/chor002.krn --no-ties \
    | hgrep -Fx '**beat' '\.' | extract -i '**kern' \
    | serialize | rid -GLId | tr -s "a-g" "A-G" | sort | uniq -c

    Count the number of pitch classes attacked on offbeats:


    notearray -HMTk h://371chorales/chor002.krn \
    | hgrep -Fx '**beat' '\.' | extract -i '**kern' \
    | serialize | rid -GLId | grep '\[' | sed 's/[][]//g' \
    | tr -s "a-g" "A-G" | sort | uniq -c

    Using data in MS Excel

    The output from notearray can be loaded into MS Excel as a tab-deliminated text file (either the default matlab-style output, or the Humdrum output generated by the -H option). In addition, the output data can be copy/pasted from text editors/word processors which preserve tab charcters, such as the following textarea box on this HTML page:

    Below is a screenshot of the above data loaded into an MS Excel spreadsheet (xlsx, xls). The intervals between each voice are shown in the dark green box in the middle, with a histogram calculated in the light green box on the right which is plotted underneath. Note that the hightlighed cell (H2) contains the equation "=MOD(ABS(D2))-ABS(C2),40)" which is the interval between the tenor and bass voices (collapsed to less than an octave). Columns O and P contain a mapping of the interval value to a more musical name for the interval, with 11 being a minor third (m3). Click on the image for a larger view.

    More example usages of the notearray program are available on the notearray examples page

ONLINE DATA

    Input arguments or piped data which are expected to be Humdrum files can also be web addresses. For example, if a program can process files like this:
           program file.krn
    It can also read the data over the web:
           program http://www.some-computer.com/some-directory/file.krn
    Piped data works in a somewhat similar manner:
           cat file.krn | program
    is equivalent to a web file using ths form:
           echo http://www.some-computer.com/some-directory/file.krn | program

    Besides the http:// protocol, there is another special resource indicator prefix called humdrum:// which downloads data from the kernscores website. For example, using the URI humdrum://brandenburg/bwv1046a.krn:

          program humdrum://brandenburg/bwv1046a.krn
    will download the URL:
    Which is found in the Musedata Bach Brandenburg Concerto collection.

    This online-access of Humdrum data can also interface with the classical Humdrum Toolkit commands by using humcat to download the data from the kernscores website. For example, try the command pipeline:

          humcat humdrum://brandenburg/bwv1046a.krn | census -k

SEE ALSO

  • The notearray program can only process monophonic parts. To process parts containing sub-spines, treated as independent voices, you can use the sub-spine extraction options of extractx.

LIMITATIONS

  • Only a single voice will be extracted from each **kern spine. If the music in that spine splits into sub-voices, only the left-most subspine after the split will be stored in the output data. See the subspine options of extractx for methods of generating monophonic lines out of a polyphonic part.
  • Only the first note in a chord (left-most note in a multi-stop token) are extractable into the note array.
  • For music with very low notes, use the -o option to shift the octave encoding level upwards; otherwise, note attacks and sustains will become mixed up. For piano music, this means the bottom three notes of the keyboard: A-1, B♭-1, and B-1. C0 with the -d option and C♭♭0 for the default base-40 pitch enumerations will also cause problems, since the number 0 is intended to represent rests.
  • Fermatas should be used to mark rest segmentation boundaries in the output data. Currently only the --double option will produce a rest segmentation.

DOWNLOAD

    The compiled notearray program can be downloaded for the following platforms:
    • Linux (i386 processors) (dynamically linked) compiled on 13 Nov 2013.
    • Windows compiled on 29 Jun 2012.
    • Mac OS X/i386 compiled on 13 Nov 2013.

    The source code for the program was last modified on 12 Nov 2013. Click here to go to the full source-code download page.