Humdrum Extras

hum2mid manpage


COMMAND

    hum2mid -- Convert Humdrum files into standard MIDI files.

SYNOPSIS

    hum2mid [input[options[-o output.mid | > output.txt]

OPTIONS

-C Do not store Humdrum file comments in the output MIDI data.
-i mapping Re-map instrumental codes to specific MIDI timbre codes, or assign MIDI timbre codes to non-standard instrumental codes.
-I Ignore Humdrum instrumental tandem interpretations.
-n string Comment string to embed into output MIDI file.
-o filename Filename into which to save Standard MIDI File output data.
-p Output MIDI file data does not realize articulations (plain).
-P Do not pad the end of the MIDI file output with a dummy note-off to prevent playback programs from clipping the duration of the last note.
-f # Use the given timbre number to play all MIDI notes with the same instrumental sound.
-r # Scale rhythmic durations by given number.
-t # Scale tempo by given factor.
-T Do not save non-**kern spines in output MIDI data as text meta-messages.
-0 Output a type-0 MIDI file (single track for all notes).
--autopan Pan each channel in a multi-spine Humdrum file from hard stereo left for the first **kern spine to hard stereo right for the last **kern spine.
--bend # Utilize pitch bend information in the input data to create pitches outside of 12-tone equal temperament. The parameter number is set to the maximum absolute deviation in cents of the pitch-bend wheel from the unaltered state. This should almost always be 200 cents.
--hv # Apply a random variation to note-attack loudnesses.
--mv # Apply a metric variation to note-attack loudnesses.
--no-rest Don't store initial rests in MIDI file output.
--plus Store pitch spellings and phrase information in the MIDI Plus format within the output MIDI file data.
--temperament file Use a temperament definition file to tune pitch classes in the input Humdrum data.
--tempo Use the first **tempo spine found in the input data as the tempo track for the output MIDI file.
--timbres string Give a list of instrument names and patch change values for given timbre. Instrument names are stored in spines starting with *I" in (small>**kern data. patch changes are offset from 0. Entries are separated by semicolons (;), and patch changes are separated from instrument names by colons (:). Example: --timbres "soprano:45;alto:37;tenor:46;bass:49"
--time Use the first **time spine found in the input data to control the timing of notes in the output MIDI file.

DESCRIPTION

    Hum2mid converts Humdrum files containing **kern data into Standard MIDI Files. There are many options, but the most important one is the -o which specifies the name of the file into which Standard MIDI File output data from the program will be stored. If you do not specify an output filename with -o, a text-based version of the MIDI data will be output (this may later change to **MIDI data output in the Humdrum file syntax):

    hum2mid scale.krn -o scale.mid
    hum2mid scale.krn > scale.txt

    Timbre selection

    Tandem interpretations starting with *I and followed by a timbre code (typically five characters) are understood by hum2mid. These codes are converted into MIDI timbre messages. 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. Below are example uses of timbre interpretations in **kern data and their results in MIDI files. Click on filenames ending in .mid to download/listen to the resulting MIDI files.

    hum2mid timbre1.krn -o timbre1.mid
    hum2mid timbre2.krn -o timbre2.mid

    The -f option can be used to force all **kern data to be played with a particular timbre, overriding any instrumental codes found within the data. The -f option requires an integer in the range from 0 to 127.

    hum2mid timbre1.krn -f 19 -o timbre1f.mid
    hum2mid timbre2.krn -f 42 -o timbre2f.mid

    If you are playing the resulting MIDI files back on a General-MIDI compatible synthesizer, the instrument numbers will have a fixed mapping to particular timbres which are listed in the table below. Click on the name of the timbre to hear a sample MIDI file playing a C major scale in using that timbre.

    Piano Timbres:
     0Acoustic Grand Piano
     1Bright Acoustic Piano
     2Electric Grand Piano
     3Honky-tonk Piano
     4Rhodes Piano
     5Chorused Piano
     6Harpsichord
     7Clavinet
    Chromatic Percussion:
     8Celesta
     9Glockenspiel
    10Music Box
    11Vibraphone
    12Marimba
    13Xylophone
    14Tubular Bells
    15Dulcimer
    Organ Timbres:
    16Hammond Organ
    17Percussive Organ
    18Rock Organ
    19Church Organ
    20Reed Organ
    21Accordion
    22Harmonica
    23Tango Accordion
    Guitar Timbres:
    24Acoustic Nylon Guitar
    25Acoustic Steel Guitar
    26Electric Jazz Guitar
    27Electric Clean Guitar
    28Electric Muted Guitar
    29Overdriven Guitar
    30Distortion Guitar
    31Guitar Harmonics
     
    Bass Timbres:
    32Acoustic Bass
    33Fingered Electric Bass
    34Plucked Electric Bass
    35Fretless Bass
    36Slap Bass 1
    37Slap Bass 2
    38Synth Bass 1
    39Synth Bass 2
    String Timbres:
    40Violin
    41Viola
    42Cello
    43Contrabass
    44Tremolo Strings
    45Pizzicato Strings
    46Orchestral Harp
    47Timpani
    Ensemble Timbres:
    48String Ensemble 1
    49String Ensemble 2
    50Synth Strings 1
    51Synth Strings 2
    52Choir "Aah"
    53Choir "Ooh"
    54Synth Voice
    55Orchestral Hit
    Brass Timbres:
    56Trumpet
    57Trombone
    58Tuba
    59Muted Trumpet
    60French Horn
    61Brass Section
    62Synth Brass 1
    63Synth Brass 2
     
    Reed Timbres:
    64Soprano Sax
    65Alto Sax
    66Tenor Sax
    67Baritone Sax
    68Oboe
    69English Horn
    70Bassoon
    71Clarinet
    Pipe Timbres:
    72Piccolo
    74Flute
    74Recorder
    75Pan Flute
    76Bottle Blow
    77Shakuhachi
    78Whistle
    79Ocarina
    Synth Lead:
    80Square Wave Lead
    81Sawtooth Wave Lead
    82Calliope Lead
    83Chiff Lead
    84Charang Lead
    85Voice Lead
    86Fifths Lead
    87Bass Lead
    Synth Pad:
    88New Age Pad
    89Warm Pad
    90Polysynth Pad
    91Choir Pad
    92Bowed Pad
    93Metallic Pad
    94Halo Pad
    95Sweep Pad
     
    Synth Effects:
      96Rain Effect
      97Soundtrack Effect
      98Crystal Effect
      99Atmosphere Effect
    100Brightness Effect
    101Goblins Effect
    102Echoes Effect
    103Sci-Fi Effect
    Ethnic Timbres:
    104Sitar
    105Banjo
    106Shamisen
    107Koto
    108Kalimba
    109Bagpipe
    110Fiddle
    111Shanai
    Sound Effects:
    112Tinkle Bell
    113Agogo
    114Steel Drums
    115Woodblock
    116Taiko Drum
    117Melodic Tom
    118Synth Drum
    119Reverse Cymbal
    Sound Effects:
    120Guitar Fret Noise
    121Breath Noise
    122Seashore
    123Bird Tweet
    124Telephone Ring
    125Helicopter
    126Applause
    127Gun Shot

    If you want to reassign the mapping of Humdrum instrumental codes to different MIDI timbres (because you want to use a different timbre, or you are using a non-General-MIDI synthesizer), then use the -i option followed by a list of the remappings. The remapping string contains a list of the instrument code followed by a colon (:) and then the new MIDI timbre number. Multiple remappings can be separated by spaces within the remapping string. For example, to cause the *Ivox tandem interpretation to sound like a French horn in the output MIDI file use the setting -i "vox:60".

    hum2mid vox.krn -o vox.mid
    hum2mid -i "vox:60" vox.krn -o newvox.mid

    The -i option can also be used to assign MIDI timbre mappings for non-standard instrumental codes. If an unknown instrumental code is found in the Humdrum input data, it will be ignored. This causes the default timbre of the synthesizer (typically the grand piano timbre) to be used. The following example demonstrates how to map an unknown instrumental code to a particular MIDI timbre number:

    hum2mid cuckoo.krn -o piano.mid
    hum2mid -i "cuckoo:123" cuckoo.krn -o tweet.mid

    To prevent Humdrum instrumental codes from being processed and stored in the output MIDI file as timbre messages, use the -I option to ignore them.

    hum2mid violin.krn -o violin.mid
    hum2mid -I violin.krn -o noviolin.mid

    Tempo control

    There are many methods to control the tempo in the output MIDI file. The most basic method is to encode a tempo marking within the score in a tandem interpretation recording starting with *MM and followed by the number of quarter notes per minute in the desired tempo, such as *MM180 for 180 quarter notes per minute. If no tempo is given in the data, hum2mid will use a tempo of 120 quarter notes per minute (Actually, hum2mid will not store a tempo marking in the MIDI file in this case, but most MIDI playback programs use 120 as the default tempo). If the beat is different than a quarter note (such as in a compound meter like 6/8 or cut time), the metronome marking is still expressed in terms of quarter notes, so you must have to multiply a dotted-quarter-note tempo marking by 1.5, or a cut-time tempo marking by 2, to get the correct playback tempo within the MIDI file.

    hum2mid tempo.krn -o tempo.mid
    hum2mid tempo180.krn -o tempo180.mid

    Only one tempo can be active at a time, so if different tempo markings occur in different spines at the same time, one of them will be ignored. However, the tempo can be changed at any point in the score by placing another *MM tempo marking in the music:

    hum2mid tempochange.krn -o tempochange.mid

    To change the tempo without altering the contents of a Humdrum file, you can use the -t option to scale the tempo values found within the input data. A factor of 2 will double the tempo marking, making the music sound twice as fast. Likewise, a tempo scaling value of 0.5 will halve the tempo marking, making the tempo twice as slow. If there is no tempo marking in the file, a default tempo marking of 100 quarter notes per minute will be used as the base tempo to be scaled (note that this is different from the default playback tempo of 120 if there is no tempo marking -- the default of 120 is defined by the MIDI playback program in that case).

    Tempo scaling behavior when no tempo marking is found in the score (using 100 as the default tempo):

    hum2mid -t 2 tempo.krn -o 200.mid
    hum2mid -t 0.5 tempo.krn -o 50.mid

    Tempo scaling behavior when there is a tempo marking of 180 quarter notes per minute in the input data:

    hum2mid -t 2 180.krn -o 360.mid
    hum2mid -t 0.5 180.krn -o 90.mid

    If tempo changes occur often in the music (such as for every note in an actual performance), the tempo values can be stored in a separate spine rather than in tandem interpretations. Add the --ts option to use the first **tempo spine found within the file as the tempo control for the music. If there is a **tempo spine in the file, it will be ignored if the --ts option is not given.

    hum2mid --ts tempospine.krn -o accel.mid
    hum2mid tempospine.krn -o flat.mid

    The time2tempo program can be used to convert absolute time values into a tempo spine:

    time2tempo -p time.krn > tempo.krn
    hum2mid tempo.krn --ts -o timetempo.mid

    Alternatively, a **time spine can directly control the timings of notes without converting it first into a **tempo spine. When using the --time option, note durations and onset times are stored as SMPTE frames (25 frames/second with 40 sub-frames per frame) with each SMPTE tick equivalent to a millisecond. Some (lower-quality) MIDI playback programs cannot play MIDI files which are encoded with SMPTE timing values, so MIDI files using the --time option are less portable than using the --tempo method described above.

    hum2mid time.krn --time -o time.mid

    Dynamics

    Hum2mid will parse **dynam spines found in the input file. Currently the program will ignore **dyn spines. The first **dynam spine found to the right of a **kern spine will be applied to the notes of the **kern spine.

    hum2mid loudsoft.krn -o loudsoft.mid
    hum2mid loudsoft2.krn -o loudsoft2.mid

    **kern spines will share **dynam spines if any **kern spine does not have its own local **dynam spine to its right before the next **kern spine.

    hum2mid sharedynam.krn -o sharedynam.mid

    Crescendos and decrescendos are be processed in **dynam spines as gradual increases or decreases in loudness. The loudness interpolation occur between the current dynamic at the start of the mark, and continue to the next dynamic found in the spine.

    hum2mid cresc.krn -o cresc.mid

    If the associated dynamics spines are not in the conventional order, staff assignment interpretations can be used to map **kern spines to specific **dynam spines. Currently, all staff assignments must occur on the same line before any data lines in the file.

    hum2mid staffdyn.krn -o staffdyn.mid

    Metric accentuation

    The --mv (metric volume) option will emphasize beats with louder notes on the beats.

    "Humanized" accentuation

    The --hv (humanized volume) option will apply a random variation to the note-attacks within the range of the number given with the option.

    Articulations

    Several **kern articulation marks will be interpreted by hum2mid when realizing a MIDI file:

     
     
     
    '     staccato Shortens sounding duration of note by 50%
    ` staccatissimo    Shortens sounding duration of note by 50%
    " pizzicato    Shortens sounding duration of note by 50%
    s spiccato    Shortens sounding duration of note by 50%
    ^ accent Increases loudness of note by 30%
    z sforzando Increases loudness of note by 50%
    hum2mid accent.krn -o accent.mid

    If you do not want the output MIDI file to have realized articulations (for example, if you are importing the MIDI file into a notation program for printing), use the -p option (for plain) to suppress the articulation realization.

    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:

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

    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 alterations while 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 pitch-bend depth.

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

    hum2mid --bend 200 calibration.krn -o calibration.mid
    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 an equal-tempered wholetone (200 cents). 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. How to change the pitch-bend range is device dependent. If you change the pitch-bend range to an octave, then you can have values in the **Dcent spine ranging from +/- 1200 cents. In general, deviations up to 100 cents in the **Dcent spine should be used, since all frequencies can be specified between MIDI note numbers using this range.

    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:

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

    Here is a collection of intervals sorted from small to large which utilize this method to control the tuning of notes in the resulting MIDI files.

    Method 2: Temperaments

    Method 1 cannot be used independently to alter 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, 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 pitches in temperament definition files 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 frequencies will be used for those pitch classes. 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 last 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 to use the -f option to force a particular MIDI timbre for all channels when using Method 2. 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.

    Stereo panning

    Hum2mid will convert tandem interpretations in the form of *pan=# into left/right panning messages within the output MIDI file. The panning values run either from 0.0 to 1.0 for left to right as floating-point values, or integers from 0 to 127 if you prefer a more MIDI-centric specification for the stereo panning location.

    Below are two examples of panning. The first example on the left has a melody gradually move from left to right, and the second example on the right demonstrates a static panning of voices to specific points in the stereo field. In this case the first violin is panned to hard left (*pan=0.0 or *pan=0, the cello to hard right (*pan=1.0 or *pan=127), and the inner parts are distributed evenly in the stereo field: second violin (*pan=0.33) and viola (*pan=0.67).

    hum2mid pan.krn -o pan.mid
    hum2mid quartet07-4.krn -o quartet07-4.mid

    The value 1 cannot be used in the integer panning system, but you can use 1.1 to represent 1 since the fractional part is is ignored. The *pan= interpretation can be used independently in multiple channels as shown in the above string-quartet example. Typically each spine of a Humdrum file will be performed in a separate MIDI channel. For large orchestral files, different spines with the same instrument must share MIDI channels, and then only one of the panning commands would be used. In other words, in MIDI there is only one panning message active in a single MIDI channel at any given time. Since there are only 16 MIDI channels, files with large spine counts will have to share channels, and thus the panning information cannot be fully realized for spines which have to share the same channel.

    Multi-track versus Single-track MIDI files

    Standard MIDI files can come in three different formats:
    • "type-0" which means all notes are stored in a single "track" within a MIDI file.
    • "type-1" which means that more than one parallel track can be found in the MIDI file.
    • "type-2" which means that more than one serial track can be found in the MIDI file. (This is a very rare type which was intended to be used to store multiple movements/songs within a single MIDI file). This format cannot be output by hum2mid currently, but may be added in the future.

    By default, hum2mid will output a MIDI file in the type-1 format, with one track for each **kern spine in the input data. In these cases, the very first track of a MIDI file is reserved for special messages such as tempo markings which affect all tracks equally. The following tracks map sequentially to spines within the input Humdrum data.

    When using the -0 (or -O to avoid orthographic confusion) option, the output MIDI file will be in the single-track type-0 format, with the data from all spines collapsed into a single track. Below is a demonstration of what the output of a type-0 and type-1 MIDI file (in ASCII representation) looks like for the following Humdrum input:

    hum2mid track.krn > track.txt
    hum2mid -0 track.krn > track0.txt

    Notice in the above example that, when a type-0 MIDI file is created, the text spine data are stored in the same track, and become irreversibly mixed together. If you do not want to store non-**kern data spines as text meta-messages in the output MIDI data (either type-0 or type-1 MIDI files), use the -T option to suppress preserving text messages:

    hum2mid -0 track.krn > track0.txt
    hum2mid -0 -T track.krn > track0notext.txt

    By default, Humdrum comments are also preserved in the MIDI file (so, for example, the MIDI file is self-documented with embedded reference records). To prevent Humdrum comments from being stored in the output MIDI data, use the -C option:

    hum2mid comment.krn > comment.txt
    hum2mid -C comment.krn > no-comment.txt

    Local comments are currently not stored in the output MIDI data, but this will probably change in the future.

    A comment string can be added to the output MIDI file by using the -n option. This comment can be used, for example, to store the date on which the MIDI file was created.

    hum2mid -n "embedded comment" comment.krn > ecomment.txt

    MIDI Plus extensions

    MIDI data does not allow for musical spelling of pitches to be encoded. Instead the MIDI protocol, and MIDI files by extension, store pitch information as a note number (integer) value in the range from 0 to 127. For example, the pitch C-sharp a half-step above middle C is the number 61. D-flat a half-step above middle C is also the number 61 (as is B-double-sharp a half-step above middle C). Therefore, the diatonic pitch spelling of the MIDI note number 61 is ambiguous (as are all note numbers). When standard MIDI file data is loaded into a music notation program, the program must decide how the pitch 61 is to be diatonically spelled. The program can use a simple algorithm (such as always use C-sharp for 61, or use C-sharp or D-flat depending on the prevailing key), or more complex algorithms which take into account melodic and harmonic contexts for the note. In any case, no algorithm can produce 100% correct spellings (consider for example the case where the composer intentionally misspells a diatonic note name).

    There are several non-standard extensions to the MIDI file format which allow for diatonic spellings of note numbers to be preserved. Three basic possibilities exist:

    1. store the pitch name as a meta message
    2. store the pitch name as an exclusive message
    3. store the pitch name within the low-order bits of the note attack volume.

    The MIDI Plus extension to MIDI uses the third method. This guarantees that the note spelling does not get detached from the note if the MIDI data is manipulated (such as multiple tracks sorted into a single list). The --plus option activates the MIDI Plus extension within the output MIDI file data.

    MIDI Plus pitch spelling codes

    MIDI note-on messages contain three bytes: (1) A command byte which indicates a note-on and which MIDI channel to play the note on, (2) the MIDI note number (0-127), and (3) the attack velocity which will control how loud the note is played (also 0-127). The attack-velocity byte contains 7 bits of information. In the MIDI Plus system, the least-significant two bits of this value are used to store the diatonic spelling, allowing up to double-sharp/double-flat spellings.

    The four states represented by these two bits are:

    1. 00 = No MIDI Plus spelling information stored for note.
    2. 01 = Use the flattest possible diatonic spelling
    3. 10 = Use the middle possible diatonic spelling.
    4. 11 = Use the sharpest possible diatonic spelling.

    Examples: For MIDI note 60, if the attack velocity lowest two bits are 00 then no spelling information is stored and the diatonic spelling is undefined. 01 means that note number 60 maps to the diatonic spelling D-double-flat; 02 means that the note number 60 maps to C-natural; and 03 means that the note number 60 maps to B-sharp. One triple-sharp is allowed in the border case of the system: MIDI note number 68 can be: 01=A-flat, 02=G-sharp, or 03=F-triple-sharp.

    MIDI Plus slur markings are partially implemented in hum2mid as well (only at the first phrase level).

    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 rhythmic 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
     

    Miscellaneous options

    No padding

    By default, the hum2mid program will add an extra note-off at the end of the tracks to prevent some MIDI playback programs from clipping the duration of the last note in the MIDI file. This feature can be turned off by using the -P option.

    hum2mid -0 pad.krn > pad.txt
    hum2mid -P -0 pad.krn > nopad.txt

    No initial rests

    By default, any initial rests in the input Humdrum file will cause a delay of the first notes in the output MIDI file. If these initial rests are not wanted, the pause can be removed from the MIDI file by using the --no-rest option.

    hum2mid rest.krn -o rest.mid
    hum2mid --no-rest rest.krn -o norest.mid

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

    • humplay: real-time MIDI performance of Humdrum files.
    • time2tempo: convert **time spines into **tempo spines which can be used to control the tempo using the --ts option.

LIMITATIONS

    Currently ornaments (trills, turns, mordents, arpeggiation) are ignored. Future enhancements to hum2mid may include ornament realization.

    Another future enhancement is using the General MIDI pizzicato timbre for string instrument when the pizzicato articulation is used.

DOWNLOAD

    The compiled hum2mid program can be downloaded for the following platforms:
    • Linux (i386 processors) (dynamically linked) compiled on 28 Jun 2012.
    • Windows compiled on 29 Jun 2012.
    • Mac OS X/i386 compiled on 13 Nov 2013.
    • Mac OS X/PowerPC (version 10.2 and higher) compiled on 13 May 2009.

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