music21.musicxml.xmlSoundParser

Functions that convert <sound> tag to the many music21 objects that this tag might represent.

Pulled out because xmlToM21 is getting way too big.

SoundTagMixin

class music21.musicxml.xmlSoundParser.SoundTagMixin

This Mixin is applied to MeasureParser – it is moved out from there because there is still a lot to write here and xmlToM21.py is getting too big.

SoundTagMixin methods

SoundTagMixin.setSound(mxSound: Element, mxDir: Element | None, staffKey: int, totalOffset: float) None

Takes a <sound> tag and creates objects from it. Presently only handles <sound tempo=’x’> events and inserts them as MetronomeMarks. If the <sound> tag is a child of a <direction> tag, the direction information is used to set the placement of the MetronomeMark.

SoundTagMixin.setSoundTempo(mxSound: Element, mxDir: Element | None, staffKey: int, totalOffset: float) None

Add a metronome mark from the tempo attribute of a <sound> tag.

SoundTagMixin.xmlSound(mxSound: Element) None

Convert a <sound> tag to one or more relevant objects (presently just MetronomeMark), and add it or them to the core and staffReference.