Skip to main content

Module step

Module step 

Source
Expand description

ABC’s tokens and the handler that reads them: music21’s abcFormat.

The text is cut into tokens one character at a time (Handler::tokenize), each token is told what is in force where it stands – the default length, the key, a tuplet, a tie – and then read (Handler::process). A processed handler is cut into tunes, voices and measures by token index, so a caller keeping tokens of its own can cut those the same way. The order and the oddities are music21’s throughout.

Each step is one music21 exposes: a token starts as music21’s does, with only its text, and its fields are filled by the step music21 calls (pre_parse, parse, update_ratio), so a token can be read, changed and read on between steps.

Structs§

AbcMetadata
A line of metadata, T:Title and the like: music21’s ABCMetadata. Its tag and data are empty until AbcMetadata::pre_parse.
AbcNote
A note, a rest, or with is_chord a chord: music21’s ABCNote and ABCChord. Its context is filled by Handler::process, its pitch and length by AbcNote::parse.
AbcTuplet
A tuplet’s opening, (3 or (p:q:r: music21’s ABCTuplet. Its ratio is unknown until AbcTuplet::update_ratio.
Bar
A bar token: music21’s ABCBar. Its fields are empty until Bar::parse.
BrokenRhythm
A broken rhythm, > to <<<: music21’s ABCBrokenRhythmMarker. Its data is empty until BrokenRhythm::pre_parse.
Comment
A comment read by comment_at.
Handler
music21’s ABCHandler: the tokens of a text and what reading them keeps.
MeasureSplit
A measure of Handler::split_by_measure’s, by token index.
Spanning
A spanner as the handler makes one: what kind, and the notes it joins.

Enums§

Closes
What a closing mark closes.
Merge
One handler of merge_plan’s.
Side
Which side of a broken-rhythm mark a note stands on.
Token
One token of ABC: music21’s ABCToken and its subclasses.

Constants§

BARS
Every bar token and what music21 calls it, in the order music21 tries them: music21’s ABC_BARS.
DEFAULT_VERSION
The ABC version a file is read as where it names none: music21’s defaults.abcVersionDefault.

Functions§

comment_at
music21’s processComment: the comment at pos, to the end of its line.
extract_reference_number
music21’s ABCFile.extractReferenceNumber: the lines of one tune, and how many lines of the text stand before them.
linear_context
music21’s _getLinearContext: the items before, at, after and two after index.
measure_boundaries
music21’s _buildMeasureBoundaryIndices: the start and end of each measure from the places of its barlines, a span of one passed over.
merge_plan
music21’s mergeLeadingMetaData, given whether each bar’s handler holds notes: a handler of nothing but metadata is joined to the one after it, and a tune of one measure or none is one handler.
next_line_break
music21’s _getNextLineBreak: where the next line break after index stands, or the end.
starts_metadata
music21’s startsMetadata: a capital letter, or w, then a colon, then something other than a barline.
strip_comment
music21’s ABCToken.stripComment: the text before any %.
version_in
%abc-(\d+)\.(\d+)\.?(\d+)? searched for: the first ABC version named.

Type Aliases§

Context
The items before, at, after and two after a place.