transpose
- pitchtools.transpose(notename, interval, white_enharmonic=True)[source]
Transpose a note by an interval taking spelling into account
The main difference with just doing
m2n(n2m(notename)+interval)
is that here the spelling of the note is taken into consideration when transposing. Notice that as the interval is given as a float there is no means to convey enharmonic intervals, like augmented second, etc.notename
interval
transpose
m2n(n2m(name)+interval)
4Eb
5
4Ab
4G#
4D#
5
4G#
4G#
4Db
2
4Eb
4D#
4C#
2
4D#
4D#
4Db
4.2
4F+20
4F+20
4C#
4.2
4E#+20 (white_enharmonic=True)
4F+20
- Parameters:
notename (
str
) – the noteinterval (
float
) – an interval in semitoneswhite_enharmonic – if True, allow pitches like 4E# or 5Cb or any microtonal variation (4E#+20). If False, such pitches are replaced by their enharmonic (4F, 4B).
- Return type:
str
- Returns:
the transposed pitch
See also