Transposition by a musical intervalUsing the -t option, all **kern spines in the input data can be transposed by the specified musical interval. Follow the -t option name with one of these example interval abbreviations:
By default the transposition will be to a higher pitch, but you can be explicit in the direction by placing a plus sign (+) in front of the interval, such as -t +P5 for transposing up a perfect fifth. If you want to transpose down, then prepend a minus sign (-) to the interval, such as -t -P5 to transpose down a perfect fifth. Here is an example of transposing a musical phrase up by a major second:
transpose -t M2 sarabande-c.krn > sarabande-d.krnWhere the input and output files are as follows:
Transposition to a specific key
If you know what the new key for the music should be, you can have the transpose program calculate the correct transposition interval for you automatically. To transpose the music from C minor into D minor which will yield the same result as illustrated above:
transpose -k d sarabande-c.krn > sarabande-d.krn
In this case -k d requests that the music be transposed into D minor. The option setting -k D would also give the same result of a transposition to D minor rather than D major, since the transpose program does not alter the mode of the music.
In order to use the -k option for transposition to a new key, a key designation must be present in the file. in the above example the key designation is *c: for C minor. If there is more than one key designation in a file, then the first one found will be used to calculate the transposition. [A -K option may be added in the future to provied dynamic transposition to a single output key from multiple different key regions in the input data.]
Sharps and flats are represented as in **kern data. You should place single quotes around keys which contain a sharp, such as -k 'F#' to transpose to F-sharp major/minor. This is because the command-line interpreter would otherwise treat everything after the # sign as a comment and ignore it. Alternatively, you can add a backslash before the # sign, such as -k F\#. Transposing to a key containing a flat in the name would be similar to this transposition to A-flat: -k A-, where the dash (-) is the **kern flat symbol.
The -o option can be used in conjunction with the -k option in order to transpose in the right direction. If the music is in C major, for exmaple, and you want to transpose to G major, then the music will be transposed down by a perfect fourth by default. If you add the option -o 1 to -k G, then the music will be transposed an octave higher than the default transposition.
Aggressive key transpositionAggressive key transposition is done by using -K instead of -k. In this form of transposition, whenever a new key is defined, that will generate a new transposition interval to force the music into the requested key. This option is useful for generating statistics on functional analyses. For example, if you want to calculate the frequency of tonic pitch classes in a file containing modulations, you can use -K to transpose all key regions to C major, and then count the number of C pitches in the resulting data.
Below is an example of the differences between using -k and -K to transpose music which contains multiple key designations. Using the -k option will transpose with a fixed interval based on the first key marker in the file, while -K will readjust the transposition interval based on each key designation that it find while processing the input file.
Transposition by base-40 value
Base-40 intervals enumerations are built from two values: 5 for minor seconds, and 6 for major seconds. A perfect fifth is composed of 3 major seconds and one minor second, so the base-40 interval value for a perfect fifth is: 6 * 3 + 5 * 1 = 23. Here is a list of possible base-40 interval values within the span of an octave:
To transpose by more than one octave, add 40. For example transposing down two octaves is -b -80; transposing up three octaves and a fifth is -b 143. Alternatively, you can use the -o option to indicate octave transpositions in addition to the base transposition with the -b option. For example, -o 3 -b 23 is equivalent to -b 143.
In order to be compatible with the Humdurm Toolkit program trans the transpose command can also represent transposition values by using the -d and -c options. These two options are used together to indicate the transposition interval. For example, to transpose up a major second (such as from C major to D major), that would mean transposing up one diatonic note (C to D, D to E, E to F, etc.), and up two chromatic notes (two half-steps). Unlike trans, the transpose command cannot do modal transpositions using the -c and -d options.
Selective spine transposition
Transposition can be limited to particular spines of data in the input. This is useful, for example, in an orchestral score to transpose a single transposing instrument to concert pitch when doing data input from a written score.
To transpose a particular spine, use the -s option followed by a spine enumeration. For example, if the first spine on the left in the file is the only one to transpose, then use -s 1. If there are multiple spines to be transpose by the same amount, you can place a command between each spine enumeration in the list, such as -s 1,3,5,8. For a range of spines, you can place a dash between the first and last enumeration in the range, such as -s 4-11. The dollar sign ($) can be used in a similar manner as in the -s spine list in the extractx program. You can include non-kern spines in the list to -s; they will be silently ignored.
The -s option can be used in conjunction with the -k, -t, and -b options. The following example usage of the transpose program transposes the second spine in the input to E-flat major.
transpose -k E- -s 2 input.krn > output.krn
Concert/Written pitch score conversionsThe two options -C and -W can be used to switch between concert-pitch and written-pitch scores. The default storage format for orchestral scores in Humdrum files is concert pitch. However, if you want to print a traditional score or generate printed parts, a written pitch score is desirable.
The following three files demonstrate how the -C and -W options work. The first file contains a score for a B-flat clarinet which is in concert pitch. The *ITrd1c2 indicates that the written score for the instrument should be transpose up a major second. The second file applies the -W option which converts a concert-pitch score into a written pitch score. Now the music is transpose up a major second as required by the clarinetist in order to play the correct pitches for a scale in C major. Also note the *ITrd1c2 marker has been converted into *Trd1c2 which is a marker indicating that the music has been transposed up by a major second. These markers are used to control the behavior of the -C and -W options. The final file shows that applying -C to a written-pitch score will generate the original file again. Note that applying -W and then -C should generate the original input file.
The -C option is also useful for data entry from music scanning programs. Output from OMR programs can be edited by hand to add *Tr markers in transposing instruments. Then, the transpose program can be run with the -C option to produce the final score.
Instrument transposition codes insertion
When encoding a transposing instrument, the -I option is useful to prepare a final score in concert pitch. Normally a *Tr marker is added to the file indicating the amount of transposition applied to the file using the transpose command. However when using -I, the output parts will instead contain an *Itr marker which can be used to later generate written parts from the sounding score.
The first example in the above set of files contains a written-pitch score for flute and B-flat clarinet. The two instruments are playing a C major scale in unison, but the clarinet's pitches are transposed up a major second since it is a transposing instrument. In order to transpose the
The tranpose program understands key interpretations which contain modal information after the colon character. Here is a list of sample keys starting on the pitch C which include modal abbreviations:
Notice that the letter case of the tonic note in the key interpretation is upper case if the third scale degree is a major third and is lower case if the third scale degree is a minor third. Only constant interval transpositions are possible with the transpose program, so conversion between different modes is not possible. If you want to change the mode of the music, then use the Humdrum Toolkit program called trans.
transpose -k d input.krn > output.krn
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:
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
The transpose program only works on **kern data, but may be expanded to other exclusive interpretation types in the future.