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.:
- For X, Y real vectors, d(X, Y) = 0 ⇔ X = Y
- For X, Y real vectors, d(X, Y) >= 0
- For X, Y real vectors, d(X, Y) = d(Y, X)
- 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
Auto Trait Implementations
impl RefUnwindSafe for Song
impl UnwindSafe for Song
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self