alterTonal: segment x integer -> segment
alterTonal: sequence x integer -> sequence
Returns the segment obtained from segm by altering the accidentals of each note such that, when using only diatonic base pitch-classes, whenever possible, the specified number i of accidentals is used while sounding pitches remain unchanged. For positive values of i a corresponding number of sharps, for negative values the respective number of flats is generated whenever possible. i=0 causes all accidentals to be removed.
alterTonal is only defined for values of i between -2 and +2 (double flats to double sharps)!
As a side-effect, alterTonal substitutes all chromatic pitch-classes by equivalent diatonic pitch-classes and alterations. To achieve this, for positive values of int, sharps are used, while flats are being used in case of negative int. For int=0, the following standard substitutions are used: cis -> c#, dis -> e&, gis -> g#, ais -> h&.
alterTonal can also be applied to sequences instead of segments.
> alterTonal([c1/4 d e f#],1)
Result= [ h#0/4 d1/4 e1/4 f#1/4 ]
> alterTonal([c1/4 d e f#],0)
Result= [ c1/4 d1/4 e1/4 f#1/4 ]
> alterTonal([c1/4 d e f#],-1)
Result= [ c1/4 d1/4 f&1/4 g&1/4 ]
Result= [ e&&1/4 ]
Result= [ c##1/4 ]
Result= [ a&1/4 ]
Result= [ g#1/4 ]
See also: alter.