pub struct Hasher {Show 16 fields
pub include_reference: bool,
pub hash_pitch: bool,
pub hash_midi: bool,
pub hash_note_name_octave: bool,
pub hash_octave: bool,
pub hash_duration: bool,
pub round_duration_and_offset: bool,
pub hash_offset: bool,
pub granularity: u32,
pub hash_interval_from_last_note: bool,
pub hash_is_accidental: bool,
pub hash_is_tied: bool,
pub hash_chords_as_notes: bool,
pub hash_chords_as_chords: bool,
pub hash_normal_order_string: bool,
pub hash_prime_form_string: bool,
}Expand description
What a hasher hashes of each note, rest and chord: music21’s Hasher.
By default a note is its MIDI pitch, its length and its offset, each rounded to a 32nd of a quarter, and a chord is hashed note by note.
Fields§
§include_reference: boolWhether each hash says what it was made from.
hash_pitch: boolWhether a note’s pitch is hashed.
hash_midi: boolWhether the pitch is its MIDI number rather than its name.
hash_note_name_octave: boolWhether a named pitch leaves out its octave: music21’s
hashNoteNameOctave.
hash_octave: boolWhether the octave is hashed.
hash_duration: boolWhether the length is hashed.
round_duration_and_offset: boolWhether lengths and offsets are rounded to granularity.
hash_offset: boolWhether the offset in the element’s own measure or voice is hashed.
granularity: u32How many parts of a quarter lengths and offsets are rounded to.
hash_interval_from_last_note: boolWhether the interval class from the note before in the same part is hashed; a part’s first note has none.
hash_is_accidental: boolWhether whether a note is altered is hashed: music21 hashes nothing for it yet, so the value is always nothing.
hash_is_tied: boolWhether ties are hashed: music21 does not use it.
hash_chords_as_notes: boolWhether a chord is hashed note by note.
hash_chords_as_chords: boolWhether a chord is hashed as one.
hash_normal_order_string: boolWhether a chord’s normal order is hashed, where chords are hashed as chords.
hash_prime_form_string: boolWhether a chord’s prime form is hashed, where chords are hashed as chords.
Implementations§
Source§impl Hasher
impl Hasher
Sourcepub fn tuple_list(&self) -> Vec<&'static str>
pub fn tuple_list(&self) -> Vec<&'static str>
The names of the values each hash holds, in order: music21’s
tupleList.
Sourcepub fn hash_stream(&self, stream: &Stream) -> Result<Vec<NoteHash>>
pub fn hash_stream(&self, stream: &Stream) -> Result<Vec<NoteHash>>
Every note, rest and chord of a stream, hashed in the order music21’s
recurse walks them: music21’s hashStream. A chord is hashed note
by note, as one, or not at all as the hasher says. Offsets are each
element’s own in its measure or voice.
music21 also rounds each element’s own length and offset in the stream as it hashes them; the stream here is left as it is.
§Errors
An interval from the note before that cannot be measured, a chord symbol whose notes cannot be worked out, or octaves asked of chords hashed as chords, which music21 cannot hash.
Trait Implementations§
impl Eq for Hasher
impl StructuralPartialEq for Hasher
Auto Trait Implementations§
impl Freeze for Hasher
impl RefUnwindSafe for Hasher
impl Send for Hasher
impl Sync for Hasher
impl Unpin for Hasher
impl UnsafeUnpin for Hasher
impl UnwindSafe for Hasher
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,
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