The relative module¶
Utilities and functions to manipulate music written in relative pitches.
-
class
Rel2abs(processor=None, first_pitch_absolute=None)[source]¶ Bases:
quickly.dom.edit.EditConvert
\relativemusic to absolute.Removes the
\relativecommand and makes all pitches absolute.processor: aPitchProcessor; a default one is used if none is specified.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.
-
processor= None¶ The
PitchProcessor; a default one is used if None is specified.
-
first_pitch_absolute= None¶ Whether to consider the first pitch in a
\relativeexpression absolute if a start pitch is not used (by default dependent on LilyPond version).
-
-
rel2abs(music)[source]¶ Convenience function to convert relative music to absolute in music.
The
musicmay be a parce document or cursor, a node range or an element node.
-
class
Abs2rel(processor=None, start_pitch=True, first_pitch_absolute=None)[source]¶ Bases:
quickly.dom.edit.EditConvert music in absolute notation to
\relativenotation.The topmost
MusicList({…}or<<…>>) that has child notes gets aRelativeparent node.processor: aPitchProcessor; a default one is used if none is specified.start_pitch: if True, a starting pitch is written after the\relativecommand.start_pitch: if False, thefirst_pitch_absoluteattribute determines the meaning of the first pitch in the new Relative expression. Iffirst_pitch_absoluteis True, the first pitch in the\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 start pitch 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.
-
processor= None¶ The
PitchProcessor; a default one is used if None is specified.
-
start_pitch= None¶ Whether to write a starting pitch after the
\relativecommand.
-
first_pitch_absolute= None¶ Whether to consider the first pitch in a
\relativeexpression absolute if a start pitch is not used (by default dependent on LilyPond version).
-
make_relative(node)[source]¶ Make al notes and pitched rests in the specified
MusicListorSimultaneousMusicListnode relative.Returns a
Relativenode with the modified music list appended.Replace the node in its parent with the returned node if desired.
-