Humdrum Extras

hum2mid manpage


COMMAND

    hum2mid -- Convert Humdrum files into standard MIDI files.

SYNOPSIS

    hum2mid [input[-o output | > output]

OPTIONS

    -r # Scale rhythmic durations by given number.

DESCRIPTION

    Timbre selection

    Here is a list of the Humdrum instrumental codes which hum2midi can understand: humdrumidi.pdf The first column in the list contains the Humdrum instrumental code which follows "*I" in a **kern column. The second column in the table lists the General MIDI instrument which maps to that Humdrum instrumental code, and the third column lists the full name of the instrument.

    Altered Tunings

    There are two methods of generating altered tunings using hum2mid. By default, MIDI synthesizers are usually tuned in equal temperament. Some, but not all, synthesizers can be adjusted to tune each key individually into other temperaments or micro-tonal tunings. hum2mid simulates altered tunings by using the pitch bend MIDI message. This kernscores page gives examples of altered tunings which can be heard in the converted MIDI files generated on-demand at the website.

    Method 1: Alter tunings of individual notes

    The first method of generating microtonal adjustments to equal-tempered pitches is accomplished by placing a tandem spine, **Dcent, to the right of **kern spines in a Humdrum file. This additional spine represents the deviation in cents from equal-temperament for the pitch. For example, here is the note A4 played unaltered at 440 Hz, Then played 50 cents sharp (quarter-tone sharp), then 50 cents flat (quarter-tone flat), and finally back to the default equal-tempered frequency:

    To generate a MIDI file which utilizes the **Dcent spine, you must include the option --bend 200. This indicates to hum2mid that the **Dcent is to be searched for tuning alteration when storing notes in the MIDI file and also specifies the depth of the pitch bend. In general, 200 should be used since most synthesizers use this as a default depth. Here is the command for generating a MIDI file using the **Dcent data in the above example:

        hum2mid --bend 200 quartertones.krn -o quartertones.mid
     

    To determine if the value 200 is correct for your synthesizer, use the following test file:

    If you convert this file into MIDI with the --bend option, the first four notes should sound exactly like the second four notes if the pitch-bend depth of your synthesizer is set to a wholetone:
        hum2mid --bend 200 calibration.krn -o calibration.mid
     
    If the two sets of notes do not sound equivalent, then your pitch-bend depth is not set to a wholetone. Try one of these other range settings to determine the current settings for your synthesizer:
    --bend
    100 200 300 400 500 600
    700 800 900 1000 1100 1200
    Note that if the pitch-bend depth of your synthesizer is set to a wholetone (2 half-steps, or 200 cents), then the maximum cents deviation which you can use in the **Dcent spine is +/- 200 cents. If you specify a deviation of 250 cents in this case, the deviation will be clipped to 200 cents. You can set the pitch-bend depth up to +/- an octave for most synthesizers.

    If you want to play more than one pitch with an independent tuning at the same time, then you will have to place each note in a separate spine with a separate companion **Dcent spine. By default, hum2mid will place these notes in separate channels, and each MIDI channel can have one unique pitch-bend setting at a time. Here is an example of controlling the tuning of multiple notes simultaneously:


    multitune.mid

    Method 2: Temperaments

    Method 1 cannot be used to alter independently two or more pitches using the same MIDI channel at the same time. If you need to tune chord notes independently to a fixed temperament of 12 notes per octave, then Method 2 can be used. In this case an auxiliary temperament file is needed to specify the deviation for each 12-tone pitch class in the output MIDI file. Here is an example of standard meantone temperament:


    meantone.mid

    To apply this temperament to a file, you use the --temperament option for hum2mid:

        hum2mid -f 19 --temperament meantone.krn chorale11.krn -o chorale11-meantone.mid
     
    Compare to the same music using equal temperament:
        hum2mid -f 19 chorale11.krn -o chorale11-eq.mid
     
    Also, listen to the same music transposed to C-sharp major, but still using the meantone tuning optimized for C major. This will cause the thirds to fall onto cracks in the temperament (such as using diminished fourths instead of major thirds):
        transpose -k 'C#' chorale11.krn > chorale11-csharp.krn
        hum2mid -f 19 --temperament meantone.krn chorale11-csharp.krn -o chorale11-csharp.mid
     
    The order of the pitches in the temperament file is irrelevant. If any pitch-classes are not specified in the temperament file, then the cent deviation for that pitch-class will be 0, and the default equal-temperament frequency will be used for those pitches. Rhythm values are not required in the **kern spine of the temperament file, but are included in the above example temperament so that the chromatic scale in that file can be head by processing the file through hum2mid itself. If you specify tunings for enharmonic pitch classes (such as C-sharp, and D-flat), only the latter setting in the file will be used. The octave of the pitch-class value is also ignored.

    Method 2 is designed for single-timbre scores, since it requires 12 channels to play the notes in the MIDI file (which can use a maximum of 16 channels). If you have multiple instruments, or instruments other than piano for the first spine of **kern data, the timbres will be independent of the spines, and instead map onto particular pitch-classes. It is recommended that you use the -f option to force a particular MIDI timbre for all channels. For example -f 19 uses the organ timbre for all channels (as given in the example above). The number after the -f option is a general MIDI instrument number, starting with 0 for grand piano.

    The --bend option can be used in conjunction with the --temperament option, but only the tuning-depth will be used, and **Dcent data will be ignored in the Humdrum file being converted into MIDI. By default a pitch-bend depth of 200 is used for the --temperament option, but by using --bend you can change this to a different value.

    A collection of temperaments to use as input to hum2mid can be found here. You can listen to a Bach prelude played in various transpositions in various temperaments here.

    Rhythmic-scaling option

    If you have music written in 3/16 meter, for example, and you want the MIDI file to be used to identify beats, an easy method is to scale the rhthymic durations by 4 so that the 3/16 meter appears as if it is in 3/4 in the converted MIDI file. To do this, use the -r option:

          hum2mid -r 4 file.krn -o file.mid
     
    Fractional values can be used. For example, 6/8 could be mapped to 2/4 in the output MIDI file using a rhythmic scaling value of 0.666667 (two-thirds):
          hum2mid -r 0.666667 file.krn -o file.mid
     

EXAMPLES

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

DOWNLOAD

    The compiled hum2mid program can be downloaded for the following platforms:
    • Linux (i386 processors) statically compiled on April version: 2002.
    • Windows compiled on 1 Jun 2006.
    • Mac OS X/i386 compiled on 10 Sep 2009.
    • Mac OS X/PowerPC (version 10.2 and higher) compiled on 13 May 2009.

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