Skip to main content

Module stream

Module stream 

Source
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§

ChordifyOptions
How Stream::chordify_with makes its chords: music21’s keyword arguments to chordify.
ConsecutiveOptions
Which notes Stream::find_consecutive_notes passes over, and where it marks a break: music21’s keyword arguments to findConsecutiveNotes. 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_length is given: a crate stream knows nothing outside itself. Stream::in_force_before reads them off a part.
LyricsOptions
How a stream’s lyrics are gathered: music21’s lyrics keywords.
MelodicInterval
The interval from one note of a line to the next, as Stream::melodic_intervals finds it.
OffsetMapEntry
One element of a stream with where it starts and ends and the voice it is in: music21’s OffsetMap.
OffsetSpan
A span of offsets to search, and which elements on its edges the search takes: music21’s getElementsByOffset and 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.
StaffGroup
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.
StreamEvent
A timestamped stream item.
SungPlace
Where a lyric of a line is sung, for a caller holding something of its own beside each element: SungLyric said in positions.
TemplateOptions
What Stream::template keeps: music21’s template arguments.
TempoSpan
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_offsets holds still while it scales: music21’s anchorZero.
BarTogether
How a staff group’s barlines are drawn: music21’s barTogether.
StreamElement
A musical object that can live on a timeline.
StreamKind
Which of music21’s Stream subclasses a stream stands for.
SungAt
SungLyric said 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.
SungLyric
What stands at one note’s place in a line of lyrics: music21’s RecursiveLyricList.
VoiceAllocation
Which parts Stream::parts_to_voices puts together as the voices of one part: music21’s voiceAllocation.

Functions§

removed_by_default
What music21’s template takes away unless told otherwise: its GeneralNotes – 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.