SYNOPSIS
OPTIONS
DESCRIPTION
Timbre selectionTandem 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.
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.
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.
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".
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:
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.
Tempo controlThere 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.
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: 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):
Tempo scaling behavior when there is a tempo marking of 180 quarter notes per minute in the input data:
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.
The time2tempo program can be used to convert absolute time values into a tempo spine:
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. DynamicsHum2mid 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.
**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. 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.
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. Metric accentuationThe --mv (metric volume) option will emphasize beats with louder notes on the beats."Humanized" accentuationThe --hv (humanized volume) option will apply a random variation to the note-attacks within the range of the number given with the option.ArticulationsSeveral **kern articulation marks will be interpreted by hum2mid when realizing a MIDI file:
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.
hum2mid -p accent.krn -o noaccent.mid Altered TuningsThere 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 notesThe 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 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:
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:
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: TemperamentsMethod 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.midCompare to the same music using equal temperament: hum2mid -f 19 chorale11.krn -o chorale11-eq.midAlso, 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.midThe 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 panningHum2mid 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).
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 filesStandard MIDI files can come in three different formats:
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:
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:
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:
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. MIDI Plus extensionsMIDI 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:
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 codesMIDI 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:
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 optionIf 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.midFractional 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 optionsNo paddingBy 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.
No initial restsBy 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.
ONLINE DATA
program file.krnIt can also read the data over the web: program http://www.some-computer.com/some-directory/file.krnPiped data works in a somewhat similar manner: cat file.krn | programis 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.krnwill 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
LIMITATIONSCurrently 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 source code for the program was last modified on 11 Dec 2013. Click here to go to the full source-code download page. |