pub struct Analysis {
pub features_version: FeaturesVersion,
/* private fields */
}Expand description
Object holding the results of the song’s analysis.
Only use it if you want to have an in-depth look of what is happening behind the scene, or make a distance metric yourself.
Under the hood, it is just an array of f32 holding different numeric features.
For more info on the different features, build the
documentation with private items included using
cargo doc --document-private-items, and / or read up
this document, that contains a description
on most of the features, except the chroma ones, which are documented
directly in this code.
Fields§
§features_version: FeaturesVersionIt is bumped every time a change is introduced in the features that makes them incompatible with previous versions.
Implementations§
Source§impl Analysis
impl Analysis
Sourcepub fn new(
analysis: Vec<f32>,
features_version: FeaturesVersion,
) -> BlissResult<Analysis>
pub fn new( analysis: Vec<f32>, features_version: FeaturesVersion, ) -> BlissResult<Analysis>
Create a new Analysis object.
Usually not needed, unless you have already computed and stored features somewhere, and need to recreate a Song with an already existing Analysis yourself.
Sourcepub fn as_arr1(&self) -> Array1<f32>
pub fn as_arr1(&self) -> Array1<f32>
Return an ndarray Array1 representing the analysis’ features.
Particularly useful if you want to make a custom distance metric.
Sourcepub fn as_vec(&self) -> Vec<f32>
pub fn as_vec(&self) -> Vec<f32>
Return a Vec<f32> representing the analysis’ features.
Particularly useful if you want iterate through the values to store them somewhere.
Sourcepub fn distance(&self, other: &Analysis) -> f32
pub fn distance(&self, other: &Analysis) -> f32
Return the distance between the analysis and another analysis, using the default distance for the FeaturesVersion.
Will underperform if used over a large number of songs: for bulk playlist generation, use distance_metric with a bulk-playlist generation function in the playlist module, such as closest_to_songs.
Panics if the analysis’ features have mismatched versions.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Analysis
impl<'de> Deserialize<'de> for Analysis
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 Index<AnalysisIndex> for Analysis
impl Index<AnalysisIndex> for Analysis
impl StructuralPartialEq for Analysis
Auto Trait Implementations§
impl Freeze for Analysis
impl RefUnwindSafe for Analysis
impl Send for Analysis
impl Sync for Analysis
impl Unpin for Analysis
impl UnsafeUnpin for Analysis
impl UnwindSafe for Analysis
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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