COMMAND

kern -- translate selected Humdrum pitch-related representations to **kern


SYNOPSIS

kern [-x] [inputfile ...] [> outputfile.krn]


DESCRIPTION

The kern command transforms various pitch-related inputs to corresponding **kern representations. For example, the **pitch token `Ab2' will be output as the **kern token `AA-'. Continuous pitch-related representations, such as frequency (**freq) and cents (**cents) are rounded-off to the nearest equally-tempered pitch. Hence, **freq values between 254.178 and 269.291 will be output as the **kern token for middle C -- `c'.

Pitches in **kern are encoded as equally-tempered values at concert pitch. Kern is not able to represent pitch deviations from equal temperament. Diatonic pitch names are encoded using the letters A to G. Octaves are indicated by a system of upper- and lower-case letters, and by letter repetition. Middle C is represented by the single lower-case letter `c'. The C an octave above is represented by two lower-case letters: `cc' -- with each successive octave adding another letter. The C an octave below middle C is represented by a single upper-case `C'. The C an octave lower yet is represented by two upper-case letters: `CC' -- and so forth. Changes of octave are deemed to occur between the pitches B and C. Thus the B below middle `c' is rendered as a single upper-case `B'; the B below `cc' is `b' and so forth. Sharps are indicated by the octothorpe sign (#) whereas flats are indicated by the minus sign (-).

The kern command is able to translate any of the pitch-related representations listed below. In each case, a tuning standard of A4 equals 440 hertz is assumed. For descriptions of the various input representations (including **kern) refer to Section 2 (Representation Reference) of this reference manual.

**centshundredths of a semitone with respect to middle C=0
**degreescale degree including octave designation
**freqfrequency in hertz (abbreviated Hz.)
**fretfretted-instrument pitch tablature
**MIDIMusic Instrument Digital Interface key-press tablature
**pitchAmerican National Standards Institute pitch notation (e.g. "A#4")
**semitsequal-tempered semitones with respect to middle C=0
**solfgFrench solfège system (fixed `doh')
**specCspectral centroid (in hertz)
**TonhGerman pitch system
Input representations processed by kern.

For numerically-oriented inputs, such as **cents, **freq, **MIDI, **semits, and **specC, variant enharmonic spellings are selected for output according to the prevailing key signature or explicit key indication. (Refer to key and key signatures in Section 3 (Humdrum Tandem Interpretations). Hence, in the key of G minor, F-sharp and E-flat spellings will be output rather than G-flat and D-sharp. Kern recognizes the presence of key, or key signature tandem interpretations. If no key or key signature is encountered in the input, a default key of C major is assumed. Kern is sensitive to both pitch-class and pitch-height key signatures. In the case of pitch-height key signatures, the user can specify complex spelling preferences, such as F#2 rather than Gb2, but Gb3 rather than F#3, etc. See SAMPLE OUTPUT below.

It is recommended that output files produced using the kern command should be given names with the distinguishing `.krn' extension.


OPTIONS

The kern command provides the following options:
-hdisplays a help screen summarizing the command syntax
-xsuppresses printing of non-pitch-related signifiers
Options are specified in the command line.

In the default operation, kern outputs any non-pitch-related signifiers in addition to the kern value. For example, the **pitch token "A6zzz" will result in the output "aaazzz" -- that is, after translating A6 to "aaa", the "zzz" signifiers are retained in the output. For some applications, echoing non-pitch-related signifiers in the output is useful. However, in other situations, the result can prove confusing -- especially, when the non-pitch-related signifiers are upper- or lower-case letters from A-G. Consider the case of the **freq token "aA#5"; after translating "A#5" to "aa", the leading non-pitch-related signifier "a" will be prepended to the output, hence the value "aaa" -- which will undoubtedly cause confusion. The -x option is useful for eliminating non-pitch-related signifiers from the output. For most inputs, the -x option is recommended.


SAMPLE OUTPUTS

The following example illustrates the use of kern. The input contains six pitch-related spines -- two of which (**deg and **cocho) cannot be processed by kern. In addition, there are two non-pitch-related spines (**embell and **metpos).
!! `kern' example #1
**specC**pitch**MIDI**deg**metpos**cocho**Tonh**embell
*M2/4*M2/4*M2/4*M2/4*M2/4*M2/4*M2/4*M2/4
*****tb8***
=1=1=1=1=1=1=1=1
foo2000G#4foo/60/bar1foo1rGis2ct
../-60/.....
2321A3+20/62/239.89H2upt
..48/-62/.....
1807Ab30/70/64127.07B2ct
..48/-70/.....
2487C#4/61/637.135Cis4sus
../-61/.....
=2=2=2=2=2=2=2=2
3323r.51rr.
...735.5Heses2ct
3471D4-8/48/ /52/128.11C3ct
../-48/.....
.D4 F4/-52/237.33 6.4C3 Es3ct
=3=3=3=3=3=3=3=3
rG4.r1rH2 D3.
========================
*-*-*-*-*-*-*-*-
Executing the command

kern -x input > output.krn

produces the following result:

!! `kern' example #1
**kern**kern**kern**deg**metpos**cocho**kern**embell
*M2/4*M2/4*M2/4*M2/4*M2/4*M2/4*M2/4*M2/4
*****tb8***
=1=1=1=1=1=1=1=1
bbbg#c1foo1rGG#ct
........
ddddAd239.89BBupt
........
aaaA-b-127.07BB-ct
........
eeee-c#d-637.135c#sus
........
=2=2=2=2=2=2=2=2
aaaa-r.51rr.
...735.5BB--ct
aaaadC E128.11Cct
........
.d f.237.33 6.4C E-ct
=3=3=3=3=3=3=3=3
rg.r1rBB D.
========================
*-*-*-*-*-*-*-*-
Both processed and unprocessed spines are output. Also notice that the non-pitch-related signifiers (e.g. foo) in the first notes of the **specC, **pitch, and **MIDI, spines have been stripped away (due to the -x option).

Key signature sensitivity is illustrated in the following example. The input contains a "pitch-height key signature" -- where flats and sharps pertain to only a specific absolute pitch. For example, Bb3 is preferred to A#3, although A#4 is preferred to Bb4. Similarly, C#4 is preferred to Db4, although Db5 is preferred to C#5.

!! `kern' example #2
**semits
*K[B3-C4#F4#A4#D5-]
-2
10
1
6
13
*-
Notice in the corresponding output given below, that all pitches are rendered with the correct enharmonic spelling.
!! `kern' example #2
**kern
*K[B3-C4#F4#A4#D5-]
B-
a#
c#
f#
dd-
*-

FILES

The file x_option.awk is used by this program when the -x option is invoked.


PORTABILITY

DOS 2.0 and up, with the MKS Toolkit. OS/2 with the MKS Toolkit. UNIX systems supporting the Korn shell or Bourne shell command interpreters, and revised awk (1985).


SEE ALSO

**cents (2),
cents (4), **degree (2), degree (4), **freq (2), freq (4), **fret (2), hint (4), **kern (2), mint (4), **MIDI (2), midi (4), **pitch (2), pitch (4), proof (4), **semits (2), semits (4), **solfg (2), solfg (4), **specC (2), specc (4), **Tonh (2), tonh (4)


BUGS

When translating **pitch, **solfg, or **Tonh, inputs, kern ignores cents deviation. Hence C#6+80 is rendered as `ccc#' rather than the nearest pitch `ddd'.


WARNINGS

Humdrum representations are expected to avoid context dependency insofar as possible. This can lead to unexpected results. For example, the letter `x' in **pitch is intended to signify the presence of a double sharp. Thus the **pitch input token `xyzC4' is correctly translated by kern as `yzc##'. Similarly, the **pitch input token `1yzC4' becomes `yzCCC4'. (The first numerical value is interpreted as the octave number and the trailing number 4 is interpreted as a non-pitch-related signifier.)