Expand description
Streams: notes, chords and other events placed on a timeline, nested as
scores, parts and measures.
Music on a timeline: music21’s stream.Stream and the subclasses it
nests inside one another.
A Stream is a list of things at quarter-length offsets, and one of
those things may be another stream: a score holds parts, a part holds
measures, a measure holds voices and notes. Stream::flatten dissolves
that nesting into one timeline the way music21’s does, adding each
stream’s own offset to its contents’.
What is deliberately not here is music21’s sites. There an object
can sit in several streams at once and carry a different offset in each,
which is why it needs a back-reference to every stream holding it and why
getContextByClass has a graph to walk. A stream here owns what it
holds, so the nesting is a tree; asking what key or metre is in force at
an offset is then a backwards look through the flattened timeline rather
than a search through a graph. That is the same answer for music that is
written once, which is all a stream built here can be.
Where an element sits is asked for, not stored: Stream::placed
answers each element with its offset, its measure offset and the key,
metre and tempo in force, as one Placed value. music21’s author
names keeping objects and sites apart this way as what he would do
again.
Structs§
- Chordify
Options - How
Stream::chordify_withmakes its chords: music21’s keyword arguments tochordify. - Consecutive
Options - Which notes
Stream::find_consecutive_notespasses over, and where it marks a break: music21’s keyword arguments tofindConsecutiveNotes. Every option is off by default. - InForce
- The clef, key and time signature in force before a measure, which
music21 finds by searching the measure’s context and
Stream::split_at_quarter_lengthis given: a crate stream knows nothing outside itself.Stream::in_force_beforereads them off a part. - Lyrics
Options - How a stream’s lyrics are gathered: music21’s
lyricskeywords. - Melodic
Interval - The interval from one note of a line to the next, as
Stream::melodic_intervalsfinds it. - Offset
MapEntry - One element of a stream with where it starts and ends and the voice it
is in: music21’s
OffsetMap. - Offset
Span - A span of offsets to search, and which elements on its edges the search
takes: music21’s
getElementsByOffsetand the keywords it reads. - Placed
- One element of a stream with its place in it: its offset, its offset in the measure holding it, and the key signature, metre and tempo in force where it stands.
- Staff
Group - Parts of a score bracketed together: music21’s
layout.StaffGroup, which holds the parts it spans. - Stream
- An ordered stream of music, which may hold other streams.
- Stream
Event - A timestamped stream item.
- Sung
Place - Where a lyric of a line is sung, for a caller holding something of its
own beside each element:
SungLyricsaid in positions. - Template
Options - What
Stream::templatekeeps: music21’stemplatearguments. - Tempo
Span - One stretch of a stream and the tempo sounding through it: a boundary
of music21’s
metronomeMarkBoundaries.
Enums§
- Analysis
- What an analysis of a stream answers, which in music21 depends on the method asked for: a key, or the span of its pitches.
- Anchor
- Where
Stream::scale_offsetsholds still while it scales: music21’sanchorZero. - BarTogether
- How a staff group’s barlines are drawn: music21’s
barTogether. - Stream
Element - A musical object that can live on a timeline.
- Stream
Kind - Which of music21’s
Streamsubclasses a stream stands for. - SungAt
SungLyricsaid in positions: what stands at one note’s place in a line of lyrics, for a caller that keeps the objects it read the stream from.- Sung
Lyric - What stands at one note’s place in a line of lyrics: music21’s
RecursiveLyricList. - Voice
Allocation - Which parts
Stream::parts_to_voicesputs together as the voices of one part: music21’svoiceAllocation.
Functions§
- removed_
by_ default - What music21’s
templatetakes away unless told otherwise: itsGeneralNotes – notes, chords, rests, unpitched strokes, percussion chords and chord symbols – its dynamics, and its expressions written on their own: text expressions, rehearsal marks and repeat expressions.