The transpose module
- class AbstractTransposer
Base class for a Transposer.
- octave = 0
a Transposer at least has an
octaveattribute, specifying how many octaves a pitch will be transposed.
- class Transposer(from_pitch, to_pitch, scale=None)
Instantiate with a from- and to-Pitch. The
scaleattribute is a list with the pitch height of the unaltered step (0 .. 6). The default scale is the normal scale: C, D, E, F, G, A, B.
Adding a Transposer to a Transposer creates a new Transposer, adding up both transpositions. Subtracting a Transposer from a Transposer creates a new one, reverting the last transposition.
- class Transpose(transposer, processor=None, relative_first_pitch_absolute=None)
Transpose pitches using the specified transposer. Arguments:
relative_first_pitch_absolute: if True, the first pitch in a
\relativeexpression is considered to be absolute, when a startpitch is not given. This is LilyPond >= 2.18 behaviour. If False, the first pitch in a
\relativeexpression is considered to be relative to c’, if no startpitch is given. This is LilyPond < 2.18 behaviour. If not specified, the function looks at the LilyPond version from the document. If the version can’t be determined, defaults to False, the old behaviour.
You may change these attributes after instantiation.
Whether to consider the first pitch in a
\relativeexpression absolute (by default dependent on LilyPond version)
Perform the transposing on the specified range.
- transpose(music, transposer)
Convenience function to transpose all notes in music using transposer.
musicmay be a parce document or cursor, a node range or an element node.