home tune search software learn abc discuss about blog Starbound/LOTRO contact  

  [abc standard: home | current | route-map | updating | proposals]

 

Transposition proposal - summary

This page contains the fourteenth draft of a proposal to extend the transcription capabilities within abc. It involves a fairly fundamental change from the thirteen in that all four modifiers, instrument, shift, score and sound are now considered as independent.

Some parts of both proposals (version 13 and version 14) are identical - in particular sections 13.2.1 Transposing instruments - extended example, 13.2.2 Transposing instrument examples and 13.3 Transposing a file.

I have included some notes and comments at the end.


4.6 Clefs and key/voice parameters

Additional text for section 4.6 Clefs and transposition

This section discusses support within abc for clefs and other features which affect the placement of the notes relative to the staff. It briefly mentions transposition, because the relevant syntax appears in the K:key and V:voice fields, but this topic is discussed in full in section 13, Transposition.

Clef, transposing instrument and related indications appear as modifiers to the K:key and V:voice fields; the possible modifiers are:

[clef=]<clef name>[<line number>][+8|-8] stafflines=<lines> octave=<number>
  score=<note1><note2> sound=<note1><note2> shift=<note1><note2>
  instrument=<note>;[abc@]concert|written

(where <…> denotes a value, […] denotes an optional parameter, and | separates alternative values).

Within a given voice, the modifiers of each K: or V: field are inherited from the previous K: or V: field, unless overriden - see scope and inheritance of modifiers for more details.

… unchanged …

  • score=<note1><note2> transposes the typeset score according to the specified interval (the playback is not affected) - for more information see transposition operators;
  • sound=<note1><note2> transposes the playback according to the specified interval (the typeset score is not affected) - for more information see transposition operators;
  • shift=<note1><note2> transposes the abc according to the specified interval (the typeset score and playback are both affected accordingly) - for more information see transposition operators;
  • instrument=<note>;abc@concert transposes the typeset score according to the interval <note> to c (the playback is not affected) - for more information see writing abc code for transposing instruments;
  • instrument=<note>;abc@written transposes the playback according to the interval c to <note> (the typeset score is not affected) - for more information see writing abc code for transposing instruments;

… unchanged …

Note:

  • The transpose=<semitones> modifier of abc 2.1 and earlier is now deprecated (replaced by the sound modifier - see transposition).
  • The middle=<pitch> modifier of abc 2.0 and earlier has been compromised in terms of what it was supposed to do and how it has actually been implemented. It is therefore deprecated.

TODO: Update deprecated list.

… unchanged …

4.6.1 Scope and inheritance of modifiers

As a fundamental rule, within each voice, each successive V: or K: field inherits the modifiers of the previous V: or K: field, unless it specifically overrides them.

Note: in other words, within a voice V: inherits from a K: field as well as from another V: field (and vice-versa).

Recommendation: In single-voice tunes these modifiers will normally be applied to the K: field. In multi-voice tunes it is recommended that they are only applied to V: fields (an additional V: field can even be introduced if one of the modifiers needs to change at a K: change). If a single-voice tune contains V: fields (for example, if it is a part extracted from a multi-voice score), then it is recommended that modifiers are applied to the V: fields.

All modifiers are independent and so their effects are cumulative. For example, shift=CG score=Gc sound=GD has the cumulative effect of raising the typeset score by an octave (up a fifth from the shift modifier and up a further fourth from the score modifier) and raising the playback by a tone (up a fifth from the shift modifier, but down a fourth from the sound modifier).

Within each K: or V: field, modifiers may be arranged in any order but may not be repeated (if they are, software should issue a non-fatal error message).

However, modifiers written in each successive K: or V: field override modifiers inherited from previous fields. For example, [V:1 shift=CG][V:1 shift=GF] represent two different fields and so a modifier of the first is overridden by modifier of the second, in this case resulting in shift=GF.

Finally note that there are two ways to specify octave shifts and, for example, octave=1 is equivalent to shift=Cc. However these operators can be used independently and so neither overrides the other.

Extended comment for developers: The large number of independent transposition modifiers which can affect the typeset score and the playback are designed to assist users who may take different views on transposition.

To calculate their combined effects it is recommended that software records the current settings for each active modifier as the tune is parsed. Then, at each change (i.e. each K: or V: field where transposition modifiers are set), their cumulative effect can be assessed by evaluating two internal variables which record the current transposition applied to the typeset score and playback (named, for example, score_transpose and sound_transpose respectively). These two variables are impacted by the modifiers as follows - at each change reset their values and then add in any active modifiers as follows:

  • score=<note1><note2> adds the interval <note1><note2> to score_transpose;
  • sound=<note1><note2> adds the interval <note1><note2> to sound_transpose;
  • shift=<note1><note2> adds the interval <note1><note2> to both score_transpose and sound_transpose;
  • instrument=<note>;abc@concert adds the interval <note>c to score_transpose;
  • instrument=<note>;abc@written adds the interval c<note> to sound_transpose;
  • octave=1 (or octave=-1) adds the interval Cc (or cC) to both score_transpose and sound_transpose and similarly for octave=2 (or octave=-2), etc.

Example: This in an artificial example designed to demonstrate inheriting, overriding and resetting for the score_transpose variable (the sound_transpose uses the same principles but would result in different outcomes). In the following code, the active modifiers from the first K: field are octave=1 shift=cF score=CD which add the intervals Cc, cF and CD to the score_transpose resulting in a cumulative transposition of a fifth (C to G) so that the typeset score shows the notes GGGG in the key of G. In the second K field the octave=0 modifier overrides (and resets) the original octave modifier, the shift=CF overrides the previous shift modifier and the score=CD is inherited; the score_transpose variable is reset but then has the CF and CD intervals added resulting in cumulative transposition of a fifth (C to G) so that the typeset score again shows the notes GGGG in the key of G.

K:C octave=1 shift=cF score=CD
CCCC|
K:C octave=0 shift=CF
CCCC|

Finally note that typesetting programs only need to evaluate score_transpose and playback programs only need sound_transpose (obviously programs which do both need to evaluate both).

13 Transposition

13.1 Transposition operators

The basic transposition operators are sound, score and shift which act as modifiers for K:key and V:voice fields:

  • score=<note1><note2> transposes the typeset score according to the specified interval (the playback is not affected)
  • sound=<note1><note2> transposes the playback according to the specified interval (the typeset score is not affected)
  • shift=<note1><note2> transposes the abc according to the specified interval (the typeset score and playback are both affected accordingly)

In addition, the instrument modifier is provided for use with transposing instruments - see writing abc code for transposing instruments.

Transpositions are applied to notes, grace notes, chords and key signatures.

The transposition interval is specified by two notes, <note1><note2>. Here <note1> refers to the transcribed abc code and <note2> refers to the rendered output (i.e. the typeset score in the case of score, the playback in the case of sound or both in the case of shift).

Example: In the following the typeset score is raised by a fifth and is rendered the same as if the abc code was transcribed as [K:D] efga. The playback is lowered by a tone and is rendered the same as if the abc code were [K:F] GABc.

K:G score=CG sound=DC
ABcd

Note: The interval system is clear with regard to enharmonics so, for example, the interval C to _G is distinct from C to ^F. However, to compute transpositions it may be helpful to use the MusicXML concept of specifying the interval as a combination of diatonic steps and semitones. Both of these can be easily calculated and make it simple to work out what the resulting note is using the diatonic steps to give the letter and the semitones to indicate whether it is flat, natural or sharp.

Examples: C to ^F is 6 semitones in 3 diatonic steps - C to D, D to E, E to F (as opposed to C to _G which is 6 semitones in 4 diatonic steps). Using this interval:

  • Eb (_E in abc code) transposes to A since A is 3 steps (letters) above E (in the cycle ABCDEFG) and the A is natural, since that note is 6 semitones above Eb
  • G transposes to C# (^c in abc code) since C is 3 steps above G and C# is 6 semitones above G
  • C# transposes to F## (^^F in abc code) since F is 3 steps above C and F## is 6 semitones above C#

Notes for developers: You should correct any transposition which goes beyond the specified abc limits to available key signatures, K:Cb (7 flats) to K:C# (7 sharps), and double/triple accidentals. For example, in principle K:C# score=CG raises the key up to K:G# (8 sharps), so to keep with the limits it should be rendered as K:Ab (4 flats).

TODO (elsewhere in the standard): Limit the range of key signatures supported by abc to K:Cb (7 flats) through to K:C# (7 sharps). (Also limit accidentals - e.g. double sharp and double flat accidentals should be supported, but triples are entirely optional.)

13.2 Writing abc code for transposing instruments

Transposing instruments sound notes at a different pitch to which they are written. For example, a C written on a Bb clarinet score would be sounded as a Bb (and similarly a written D would be sounded as a C).

This section uses written pitch (i.e. the pitch that is written on a transposing instrument's score) and concert pitch (i.e. the pitch that is actually sounded) to distinguish between the two.

Note: The term "concert pitch" is also used elsewhere in the musical lexicon to indicate "play A (above middle C) at 440Hz". However, here it refers to the pitches that transposing instruments actually sound.

There are two ways of writing abc code for transposing instruments:

  1. The abc code can be transcribed at concert pitch with an instrument=<note>;abc@concert modifier used to indicate that the typeset score should be transposed by the interval <note>c. Here the abc@ is optional so this could be written instrument=<note>;concert. (If preferred instrument=<note>;abc@concert could be replaced with score=<note>c.)
  2. The abc code can be transcribed at written pitch with an instrument=<note>;abc@written modifier used to indicate that the playback should be transposed by the interval c<note>. Again the abc@ is optional so this could be written instrument=<note>;written. (If preferred instrument=<note>;abc@written could be replaced with sound=c<note>.)

In both cases the typeset score is rendered at written pitch by default.

If a concert pitch score is required the I:concert-score instruction can be applied, either in the file header or the tune header. For transcriptions at concert pitch this has the effect of cancelling all of the instrument=<note>;abc@concert and score modifiers. For transcriptions at written pitch it has the effect of altering instrument=<note>;abc@written and sound modifiers to shift modifiers.

Note: The <note> in the instrument=<note> syntax is a note and not a key (so that different octaves may be specified and so that the letter b is not ambiguous). Therefore, for a Bb instrument you must write instrument=_B and not instrument=Bb.

The following example illustrates the principles of writing for transposing instruments.

13.2.1 Transposing instruments - extended example

Suppose a Bb clarinet player and a violinist wish to play the same piece which simply consists of the notes CDEF in the key of C.

Since the violin is not a transposing instrument, the violinist's part is written (and sounded):

V:1 name=violin
K:C
CDEF|

For the clarinet part, there is a choice. If, say, the composer of the piece prefers to work at concert pitch, the clarinet part can be transcribed as sounded, either using score:

V:2 name=clarinet score=_Bc
K:C
CDEF|

or using instrument as a alternative:

V:2 name=clarinet instrument=_B;abc@concert
K:C
CDEF|

This will be rendered by abc typesetting software according to the shift (i.e. [K:D] DEFG) but sounded as transcribed (i.e. CDEF). If a concert pitch score is required it can be typeset by adding an I:concert-score instruction.

Alternatively, if the composer wants the abc code at written pitch, the same piece can be transcribed:

V:2 name=clarinet sound=c_B
K:D
DEFG|

or using instrument as a alternative:

V:2 name=clarinet instrument=_B;abc@written
K:D
DEFG|

This will be rendered by abc typesetting software as transcribed (DEFG) but sounded according to the shift (i.e. CDEF). Again, if a concert pitch score is required it can be typeset by adding an I:concert-score instruction.

Note: Written pitch voices will almost always need their own K: field to set the key correctly (which will be different from concert pitch voices).

The whole piece could then be transcribed at concert pitch as:

K:C
V:1 name=violin
CDEF|
V:2 name=clarinet instrument=_B;abc@concert
CDEF|

or at written pitch as:

K:C
V:1 name=violin
CDEF|
V:2 name=clarinet instrument=_B;abc@written
K:D
DEFG|

In either case the typeset score will be rendered at written pitch (and the playback at concert pitch). To obtain a concert pitch score, add an I:concert-pitch instruction in the file or tune header.

Re-transposition: Finally, suppose that the clarinet player has fallen ill and is to be replaced by an alto sax player who now needs a transposed part to read. If the abc code has been transcribed at concert pitch this is extremely easy by replacing instrument=_B;abc@concert with instrument=_E;abc@concert in the clarinet part (the name can also be changed too):

V:2 name="alto sax" instrument=_E;abc@concert
CDEF|

If the abc code has been transposed at written pitch (in this case for a Bb instrument), it is a little harder.

The instrument=_B;abc@written can remain, as it is adjusting the playback to concert and also will serve as a reminder that the part was originally transcribed at written pitch for a Bb instrument.

To adjust the score, consider that the Bb clarinet score is written a major second higher than it is sounded (so C is written D) whereas the alto sax is written a major sixth higher than it is sounded (so C is written A). Since the abc code is already transcribed a tone higher, it needs to be raised by a further fifth (i.e. a major sixth less a major second) and so one way to do it is to use score=CG (or score=DA if that is easier to think about). The resulting code is:

V:2 name="alto sax" instrument=_B;abc@written score=CG
K:D
DEFG|

This can be thought of as a reminder that the part is encoded at written pitch for a Bb instrument but the score is additionally transposed a fifth higher (i.e. for an instrument a fifth lower).

Another way to express this is to use the fact that a second V: field overrides parts of the first. In this following excerpt, the first V: field shows details of the original transcription for clarinet, whilst the second shows the re-transposition adjustments for alto sax:

V:2 name=clarinet instrument=_B;abc@written
V:2 name="alto sax" score=CG
K:D
DEFG|

Depending on how you think about re-transposition, a further way to do this is to write:

V:2 name="alto sax" instrument=_E;abc@written shift=CG
K:D
DEFG|

This can be thought of as a reminder that the score is at written pitch for an Eb instrument but that the abc is encoded for an instrument a fifth lower (so needs to be raised by a fifth).

Once again overriding can be brought into play - however, both new modifiers (instrument and shift) are required for the re-transposition to work and so in fact the second V: field completely overrides everything in the first:

V:2 name=clarinet instrument=_B;abc@written
V:2 name="alto sax" instrument=_E;abc@written shift=CG
K:D
DEFG|

One final way to do this, if you consider that the instrument modifier is ambiguous (the abc is encoded for a Bb instrument but the score will be typset for an Eb instrument) is just to use score and sound modifiers:

V:2 name="alto sax" score=CG sound=c_B
K:D
DEFG|

However, these examples suggest that, all other things being equal, it is rather more flexible to transcribe the abc code at concert pitch rather than at written pitch.

Finally note that all of the transposing instrument information would normally be collected up in the tune header to make it more visible (it only needs to appear in the body if something changes halfway through, such as a switch from Bb clarinet to A clarinet). So the written pitch clarinet to alto sax re-transposition excerpt could be transcribed as:

T:Duet for violin and clarinet (actually played on an alto sax)
V:1 name=violin
V:2 name=clarinet instrument=_B;abc@written
V:2 name="alto sax" score=CG
K:C
V:1
CDEF|
V:2
K:D
DEFG|

13.2.2 Transposing instrument examples

The following table lists some example transposing instruments and the modifiers they would need

abc at concert pitch abc at written pitch
Instrument score=<n1><n2> instrument=<n>;abc@concert sound=<n1><n2> instrument=<n>;abc@written
piccolo score=c'c instrument=c';abc@concert sound=cc' instrument=c';abc@written
Bb clarinet score=_Bc instrument=c';abc@concert sound=c_B instrument=c';abc@written
soprano sax score=_Bc instrument=_B;abc@concert sound=c_B instrument=_B;abc@written
A clarinet score=Ac instrument=A;abc@concert sound=cA instrument=A;abc@written
alto flute score=Gc instrument=G;abc@concert sound=cG instrument=G;abc@written
cor anglais score=Fc instrument=F;abc@concert sound=cF instrument=F;abc@written
alto sax score=_Ec instrument=_E;abc@concert sound=c_E instrument=_E;abc@written
tenor sax score=_B,c instrument=_B,;abc@concert sound=c_B, instrument=_B,;abc@written

13.3 Transposing a file

To transpose an entire file, use the instruction I:score <note1><note2>, I:sound <note1><note2> or, as a shorthand for both, I:shift <note1><note2>. When placed in the file (or tune) header they have the the effect of adding the corresponding score=, sound= or shift= modifiers to every K: and V: field in the file (tune) which will then be combined with existing modifiers.

Example: The following excerpts are equivalent; in the former the I:score cC (downwards octave transposition) is applied to the K: field and combines with the existing score modifier to give the latter.

I:score cC
K:C score=_Bc
CCCC|
K:C score=_BC
CCCC|

Notes and comments on the proposal

The exact syntax of instrument=<note>;abc@concert and instrument=<note>;abc@written is still to be decided - however, the proposal above strongly suggests that the modifier name to the left of the = sign (currently instrument) is the same for both. If it is different (e.g. instrument-concert / instrument-written or their shorthands instrument-c / instrument-w) this would suggest to the casual user that they are two independent modifiers and so to switch from concert pitch to written pitch (or vice-versa) would involve cancelling the first at the same time as specifying the second.

For example, under the proposed syntax above switching from concert pitch to written pitch could be done as follows:

K:C instrument=_B;abc@concert
CCCC| % abc code now at concert pitch
K:D instrument=_B;abc@written
DDDD| % abc code now at written pitch

If the modifier name is different, this would need to be

K:C instrument-concert=_B
CCCC| % abc code now at concert pitch
K:C instrument-concert=c % to cancel the previous instrument-concert modifier
K:D instrument-written=_B
DDDD| % abc code now at written pitch

Other notes:

  • Because of the way it is defined it might make sense to rename shift=<note1><note2> to abc=<note1><note2>, since it effectively transposes the abc code by the specified interval.
  • One mechanism missing from the proposal is allowing provision for clefs which change between a concert pitch score its written pitch counterpart. However, since transposing instruments are always typeset at written pitch (except when I:concert-score is present), that means we just need something like concert-clef=treble (which would only apply when I:concert-score is present) to handle this.
  • A recurring question is whether independent score and sound modifiers are actually necessary. I have discussed this separately in the independent-shift use-case.

Chris Walshaw, July 2014

abc/standard/v2.1/proposals/transposition/v14.txt · Last modified: 2014/08/02 07:53 by cwalshaw
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki