Type:
alter: segment x integer -> segment
alter: sequence x integer -> sequence
Call syntax:
alter(segm,
i)
alter(seq,
i
Description:
Returns the segment obtained from segm by
altering the accidentals of each note such that
the specified number i of accidentals is used;
sounding pitches remain unchanged.
Positive values of i generate the corresponding
number of sharps, negative values the respective number
of flats. i=0 causes all accidentals to be removed.
alter is only defined for values of i between -2 and +2 (double flats to double sharps)!
In general, to enforce the specified accidentals may require using chromatic pitch-classes (cis, dis, fis, gis, ais). However, depending on the "noteNames" settings, these may back-translated into diatonic pitches with accidentals when displaying the corresponding segment. When working with diatonic material, therefore one should rather use transpTonal for altering accidentals.
Example:
> set("noteNames",
"chromatic")
> alter({[c1/4 d e]},2)
Result= SEGM([ ais##0/4 c##1/4 d##1/4])
> alter({[c1/4 c# _ e]},1)
Result= SEGM([ h#0/4 c#1/4 _/4 e1/4 ])
> alter({[cis1/4 dis d h&]},-1)
Result= SEGM([ d&1/4 e&1/4 dis&1/4 h&1/4 ])
See also: transp, alterTonal.