pub struct ChromaVector {
pub bins: [f32; 12],
}Expand description
A 12-bin chroma vector representing energy per pitch class.
Bins are ordered: C, C#, D, D#, E, F, F#, G, G#, A, A#, B.
§Examples
use resonant_analysis::chroma::ChromaVector;
let cv = ChromaVector { bins: [0.0; 12] };
assert_eq!(cv.bins.len(), 12);Fields§
§bins: [f32; 12]Energy in each of the 12 pitch classes.
Implementations§
Source§impl ChromaVector
impl ChromaVector
Sourcepub fn dominant_class(&self) -> usize
pub fn dominant_class(&self) -> usize
Returns the index (0–11) of the dominant pitch class.
Sourcepub fn dominant_name(&self) -> &'static str
pub fn dominant_name(&self) -> &'static str
Returns the name of the dominant pitch class.
Trait Implementations§
Source§impl Clone for ChromaVector
impl Clone for ChromaVector
Source§fn clone(&self) -> ChromaVector
fn clone(&self) -> ChromaVector
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ChromaVector
Source§impl Debug for ChromaVector
impl Debug for ChromaVector
Source§impl<'de> Deserialize<'de> for ChromaVector
impl<'de> Deserialize<'de> for ChromaVector
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ChromaVector
impl PartialEq for ChromaVector
Source§impl Serialize for ChromaVector
impl Serialize for ChromaVector
impl StructuralPartialEq for ChromaVector
Auto Trait Implementations§
impl Freeze for ChromaVector
impl RefUnwindSafe for ChromaVector
impl Send for ChromaVector
impl Sync for ChromaVector
impl Unpin for ChromaVector
impl UnsafeUnpin for ChromaVector
impl UnwindSafe for ChromaVector
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
Mutably borrows from an owned value. Read more