pub enum StreamElement {
Note(Note),
Chord(Chord),
Rest(Rest),
Stream(Box<Stream>),
KeySignature(KeySignature),
TimeSignature(TimeSignature),
MetronomeMark(MetronomeMark),
}Expand description
A musical object that can live on a timeline.
Variants§
Note(Note)
A single pitched note.
Chord(Chord)
A chord containing one or more notes.
Rest(Rest)
A silent rest.
Stream(Box<Stream>)
A stream nested inside this one: a part in a score, a measure in a part. Boxed, since a stream holds these by value.
KeySignature(KeySignature)
The key signature in force from here on.
TimeSignature(TimeSignature)
The metre in force from here on.
MetronomeMark(MetronomeMark)
The tempo in force from here on.
Implementations§
Source§impl StreamElement
impl StreamElement
Sourcepub fn duration(&self) -> Option<&Duration>
pub fn duration(&self) -> Option<&Duration>
Returns the assigned duration, if present.
The marks that only say what is in force from a point — a key, a metre, a tempo — have none, as they take no time in music21 either.
Sourcepub fn quarter_length(&self) -> FloatType
pub fn quarter_length(&self) -> FloatType
Returns the duration in quarter lengths.
A nested stream is as long as its own contents; a mark takes no time; anything else with no duration of its own defaults to a quarter, as music21’s does.
Sourcepub fn pitches(&self) -> Vec<Pitch>
pub fn pitches(&self) -> Vec<Pitch>
Returns all pitches contained by this element, a nested stream’s included.
Sourcepub fn is_note_or_chord(&self) -> bool
pub fn is_note_or_chord(&self) -> bool
Whether this element sounds — music21’s .notes, which is notes and
chords but not rests.
Trait Implementations§
Source§impl Clone for StreamElement
impl Clone for StreamElement
Source§fn clone(&self) -> StreamElement
fn clone(&self) -> StreamElement
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StreamElement
impl Debug for StreamElement
Source§impl<'de> Deserialize<'de> for StreamElement
Available on crate feature serde only.
impl<'de> Deserialize<'de> for StreamElement
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<Chord> for StreamElement
impl From<Chord> for StreamElement
Source§impl From<KeySignature> for StreamElement
impl From<KeySignature> for StreamElement
Source§fn from(value: KeySignature) -> Self
fn from(value: KeySignature) -> Self
Source§impl From<MetronomeMark> for StreamElement
impl From<MetronomeMark> for StreamElement
Source§fn from(value: MetronomeMark) -> Self
fn from(value: MetronomeMark) -> Self
Source§impl From<Note> for StreamElement
impl From<Note> for StreamElement
Source§impl From<Rest> for StreamElement
impl From<Rest> for StreamElement
Source§impl From<Stream> for StreamElement
impl From<Stream> for StreamElement
Source§impl From<TimeSignature> for StreamElement
impl From<TimeSignature> for StreamElement
Source§fn from(value: TimeSignature) -> Self
fn from(value: TimeSignature) -> Self
Auto Trait Implementations§
impl Freeze for StreamElement
impl RefUnwindSafe for StreamElement
impl Send for StreamElement
impl Sync for StreamElement
impl Unpin for StreamElement
impl UnsafeUnpin for StreamElement
impl UnwindSafe for StreamElement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more