pub struct DataInstance { /* private fields */ }Expand description
A piece prepared for feature extraction, with each representation of it
worked out once: music21’s DataInstance and the StreamForms it keeps.
Implementations§
Source§impl DataInstance
impl DataInstance
Sourcepub fn new(stream: &Stream) -> Result<Self>
pub fn new(stream: &Stream) -> Result<Self>
Prepares a piece: its ties stripped, and each part of a score and each voice anywhere in it prepared on its own.
§Errors
A tie the piece cannot be stripped of.
Sourcepub fn parts(&self) -> &[DataInstance]
pub fn parts(&self) -> &[DataInstance]
Each part of a score prepared on its own, then each voice: music21’s
data['parts'].
Sourcepub fn parts_count(&self) -> usize
pub fn parts_count(&self) -> usize
How many parts a score has: music21’s partsCount, nought for a
stream that is not a score.
Sourcepub fn pitches(&self) -> &[Pitch]
pub fn pitches(&self) -> &[Pitch]
Every pitch of the piece’s notes, chords and chord symbols: music21’s
Stream.pitches.
Sourcepub fn midi_pitch_histogram(&self) -> &[(IntegerType, usize)]
pub fn midi_pitch_histogram(&self) -> &[(IntegerType, usize)]
How often each MIDI note number sounds, in the order each is first
met: music21’s midiPitchHistogram, a Counter.
Sourcepub fn pitch_class_histogram(&self) -> &[usize; 12]
pub fn pitch_class_histogram(&self) -> &[usize; 12]
How often each pitch class sounds: music21’s pitchClassHistogram.
Sourcepub fn midi_interval_histogram(&self) -> &[usize]
pub fn midi_interval_histogram(&self) -> &[usize]
How often each melodic interval, in semitones either way, comes
between neighbouring notes of each part, chords and rests passed
over: music21’s midiIntervalHistogram, 128 bins.
Sourcepub fn contour_list(&self) -> &[IntegerType] ⓘ
pub fn contour_list(&self) -> &[IntegerType] ⓘ
Every melodic step of each part in semitones, rising steps positive,
a chord read as its highest note: music21’s contourList.
Sourcepub fn metronome_mark_boundaries(
&self,
) -> Result<Vec<(FloatType, FloatType, MetronomeMark)>>
pub fn metronome_mark_boundaries( &self, ) -> Result<Vec<(FloatType, FloatType, MetronomeMark)>>
The stretches of the piece each tempo holds, start, end and the mark
sounding there: Stream::metronome_mark_boundaries of the piece as
this instance prepared it.
§Errors
Sourcepub fn seconds_map(&self) -> Result<&[Seconds]>
pub fn seconds_map(&self) -> Result<&[Seconds]>
When each note, chord and chord symbol of the piece sounds, in
seconds, in the order the piece holds them: the notes of music21’s
secondsMap, read over the piece flattened, where music21’s own
secondsMap reads only what a stream holds directly. The features
that read it want every note of the piece.
§Errors
A tempo that says no number, or as
DataInstance::metronome_mark_boundaries.
Sourcepub fn parts_sounding(&self) -> Result<&[usize]>
pub fn parts_sounding(&self) -> Result<&[usize]>
How many parts sound in each chord of the piece chordified, in order:
music21’s chordify(addPartIdAsGroup=True), read as the number of
part ids on each chord’s pitches. A piece that is not a score is not
chordified, and its own chords carry no part ids, so each counts
nought.
§Errors
A score that cannot be chordified.
Sourcepub fn chordified_chords(&self) -> Result<&[Chord]>
pub fn chordified_chords(&self) -> Result<&[Chord]>
The chords of the piece chordified with every pitch kept: music21’s
chordify.flat.getElementsByClass(Chord). A piece that is not a
score is not chordified, so these are its own chords and chord
symbols, a symbol that sounds nothing an empty chord.
§Errors
A score that cannot be chordified.
Sourcepub fn quarter_length_histogram(&self) -> &[(FloatType, usize)]
pub fn quarter_length_histogram(&self) -> &[(FloatType, usize)]
How often each length in quarters comes among the piece’s notes, in
the order each is first met: music21’s
flat.notes.quarterLengthHistogram, a Counter.
Sourcepub fn analyzed_key(&self) -> Option<&[KeyEstimate]>
pub fn analyzed_key(&self) -> Option<&[KeyEstimate]>
The keys the piece is likely in, best first, by Aarden and Essen’s
weights: music21’s flat.analyzedKey, the key and its
alternateInterpretations. Nothing for a piece with no pitched
notes.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for DataInstance
impl !RefUnwindSafe for DataInstance
impl !Sync for DataInstance
impl Send for DataInstance
impl Unpin for DataInstance
impl UnsafeUnpin for DataInstance
impl UnwindSafe for DataInstance
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> 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