Struct bliss_rs::Song[][src]

pub struct Song {
    pub path: String,
    pub artist: String,
    pub title: String,
    pub album: String,
    pub track_number: String,
    pub genre: String,
    pub analysis: Vec<f32>,
}
Expand description

Simple object used to represent a Song, with its path, analysis, and other metadata (artist, genre…)

Fields

path: String
Expand description

Song’s provided file path

artist: String
Expand description

Song’s artist, read from the metadata ("" if empty)

title: String
Expand description

Song’s title, read from the metadata ("" if empty)

album: String
Expand description

Song’s album name, read from the metadata ("" if empty)

track_number: String
Expand description

Song’s tracked number, read from the metadata ("" if empty)

genre: String
Expand description

Song’s genre, read from the metadata ("" if empty)

analysis: Vec<f32>
Expand description

Vec containing analysis, in order: tempo, zero-crossing rate, mean spectral centroid, std deviation spectral centroid, mean spectral rolloff, std deviation spectral rolloff mean spectral_flatness, std deviation spectral flatness, mean loudness, std deviation loudness, chroma interval feature 1 to 10.

All the numbers are between -1 and 1.

Implementations

impl Song[src]

pub fn distance(&self, other: &Self) -> f32[src]

Compute the distance between the current song and any given Song.

The smaller the number, the closer the songs; usually more useful if compared between several songs (e.g. if song1.distance(song2) < song1.distance(song3), then song1 is closer to song2 than it is to song3.

pub fn new(path: &str) -> Result<Self, BlissError>[src]

Returns a decoded Song given a file path, or an error if the song could not be analyzed for some reason.

Arguments

  • path - A string holding a valid file path to a valid audio file.

Errors

This function will return an error if the file path is invalid, if the file path points to a file containing no or corrupted audio stream, or if the analysis could not be conducted to the end for some reason.

The error type returned should give a hint as to whether it was a decoding (DecodingError) or an analysis (AnalysisError) error.

Trait Implementations

impl Clone for Song[src]

fn clone(&self) -> Song[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Song[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Default for Song[src]

fn default() -> Song[src]

Returns the “default value” for a type. Read more

impl PartialEq<Song> for Song[src]

fn eq(&self, other: &Song) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Song) -> bool[src]

This method tests for !=.

impl StructuralPartialEq for Song[src]

Auto Trait Implementations

impl RefUnwindSafe for Song

impl Send for Song

impl Sync for Song

impl Unpin for Song

impl UnwindSafe for Song

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Pointable for T

pub const ALIGN: usize

The alignment of pointer.

type Init = T

The type for initializers.

pub unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more

pub unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more

pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more

pub unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V