Struct bliss_audio::Song[][src]

pub struct Song {
    pub path: PathBuf,
    pub artist: Option<String>,
    pub title: Option<String>,
    pub album: Option<String>,
    pub track_number: Option<String>,
    pub genre: Option<String>,
    pub analysis: Analysis,
}
Expand description

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

Fields

path: PathBuf

Song’s provided file path

artist: Option<String>

Song’s artist, read from the metadata

title: Option<String>

Song’s title, read from the metadata

album: Option<String>

Song’s album name, read from the metadata

track_number: Option<String>

Song’s tracked number, read from the metadata

genre: Option<String>

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

analysis: Analysis

bliss analysis results

Implementations

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.

Currently uses the euclidean distance, but this can change in an upcoming release if another metric performs better.

Compute distance between two songs using a user-provided distance metric.

For this function to be integrated properly with the rest of bliss’ parts, it should be a valid distance metric, i.e.:

  1. For X, Y real vectors, d(X, Y) = 0 ⇔ X = Y
  2. For X, Y real vectors, d(X, Y) >= 0
  3. For X, Y real vectors, d(X, Y) = d(Y, X)
  4. For X, Y, Z real vectors d(X, Y) ≤ d(X + Z) + d(Z, Y)

Note that almost all distance metrics you will find obey these properties, so don’t sweat it too much.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

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

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

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

Should always be Self

The resulting type after obtaining ownership.

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

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

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.