Skip to main content

Module step

Module step 

Source
Available on crate feature musicxml only.
Expand description

music21’s per-element steps of reading MusicXML: what its MeasureParser makes of one <clef>, one <note>, one <measure>.

Each takes the element’s text and reads it as the whole-document reader reads it in place. A step that depends on what came before it in the measure – a note’s duration on the divisions in force, a rest on the measure it fills – reads the element inside a measure of its own, so that the reader’s own measure logic decides it.

use music21::musicxml::step;

let clef = step::read_clef("<clef><sign>F</sign><line>4</line></clef>")?;
assert_eq!(clef.sign(), Some("F"));

let measure = step::read_measure(
    "<measure><note><pitch><step>D</step><octave>5</octave></pitch>\
     <duration>2</duration><type>half</type></note></measure>",
    &mut step::MeasureContext::with_divisions(2),
)?;
assert_eq!(measure.pitches()[0].name_with_octave(), "D5");

Structs§

Encoding
What an <encoding> says of the program that wrote the document.
FitAsked
What is known of a measure as it goes into its part.
MeasureContext
What a <measure> read on its own is read within: what music21’s MeasureParser takes from the measures before it.
MeasureFit
How a measure sits in its part: music21’s adjustTimeAttributesFromMeasure.
PartRead
A part read, and what music21 warns of as it reads it.
SpannerId
A spanner a SpannerState is building, by where it stands there.
SpannerState
The spanners a reading is building, which outlive one element: the state music21 keeps in its spannerBundle. A reading of one element at a time keeps it between elements, as music21’s parsers do.
SpannersRead
What one step of spanner reading did: the spanners it handed back and the ones it began, and the pedal’s bounces and gaps it put in the measure, each with its uid and offset.

Enums§

DuplicateIds
Whether a spanner of a number already open is joined or another begun: music21’s allowDuplicateIds.
SpannerStep
Which of music21’s spanner-reading steps to take.

Functions§

measure_fit
Decides how a measure sits in its part, as music21’s adjustTimeAttributesFromMeasure does.
read_accidental
music21’s xmlToAccidental: an <accidental>, or an alteration written by another tag’s text.
read_appearance
music21’s xmlAppearanceToStyle: an <appearance>.
read_articulation
music21’s xmlToArticulation: one mark of <articulations>, None for one music21 does not know.
read_barline
music21’s xmlToBarline and xmlToRepeat: what a <barline> draws, a repeat in the direction written.
read_beams
music21’s xmlToBeams: <beam>s, in order.
read_clef
music21’s xmlToClef: a <clef>.
read_creator
music21’s creatorToContributor: a <creator>, its type its role.
read_credit
music21’s xmlCreditToTextBox: a <credit>.
read_default_instrument
music21’s getDefaultInstrument: the instrument a <score-part> names, before the part’s own names are put on it, and what music21 warns of as it reads it.
read_defaults_style
music21’s styleFromXmlDefaults: the appearance, fonts and lyric languages a <defaults> gives.
read_encoding
music21’s processEncoding: an <encoding>.
read_key
music21’s xmlToKeySignature: a <key>, as a key signature, or a key where it names a mode.
read_key_octaves
music21’s mxKeyOctaves: the octaves a <key>’s <key-octave>s put signature’s altered pitches in.
read_lyric
music21’s xmlToLyric: a <lyric>.
read_lyrics
music21’s updateLyricsFromList: <lyric>s of one note, one numbered nought taking its place among them.
read_measure
music21’s MeasureParser.parse: a <measure>, read within context, whose tuplets it leaves as the measure ends.
read_metronome
music21’s xmlToTempoIndication: a <metronome>.
read_non_traditional_key
music21’s nonTraditionalKeySignature: a <key> of steps and their alterations, its octaves read too.
read_page_layout
music21’s xmlPageLayoutToPageLayout: a <page-layout>.
read_part
music21’s PartParser.parse: a <part> with its <score-part>.
read_pitch
music21’s xmlToPitch: the pitch of a <note>, C4 where it has none.
read_print_page
music21’s xmlPrintToPageLayout: the page a <print> starts.
read_print_system
music21’s xmlPrintToSystemLayout: the system a <print> starts.
read_rights
music21’s rightsToCopyright: a <rights>, its type its role.
read_senza_misura
The text of a <time> of no meter, where it is one: what music21 reads as a SenzaMisuraTimeSignature.
read_spanners
One of music21’s spanner-reading steps on an element – a direction type, a <notations>, or one slur or other spanner mark – within state, which keeps the spanners from one to the next. target, a uid of the state’s, is the note it joins or ends a spanner with.
read_staff
music21’s getStaffNumber: the staff an element is written on, nought where it does not say.
read_staff_details
music21’s xmlStaffLayoutFromStaffDetails: a <staff-details> written into layout.
read_staff_layout
music21’s xmlStaffLayoutToStaffLayout: a <staff-layout>.
read_system_layout
music21’s xmlSystemLayoutToSystemLayout: a <system-layout>.
read_technical
music21’s xmlTechnicalToArticulation: one mark of <technical>, None for one music21 does not know; a bend’s release is read in divisions to the quarter.
read_tie
music21’s xmlToTie: the tie of a <note>, where it has one.
read_time
music21’s xmlToTimeSignature: a <time>; None for one that only hides the meter.
read_transpose
music21’s xmlTransposeToInterval: a <transpose>.
read_voice_ids
music21’s updateVoiceInformation: the voices a <measure>’s notes and forwards are written in, sorted.

Type Aliases§

ActiveTuplets
The tuplets a part is inside, by number: music21’s activeTuplets, nought being the one a note’s <time-modification> alone implies.