diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e258a9..52fcf72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## bliss 0.2.5 +* Updates to docs + ## bliss 0.2.4 * Make `Analysis::to_vec()` public. diff --git a/Cargo.lock b/Cargo.lock index 673b1f4..a10dc94 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -75,7 +75,7 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "bliss-audio" -version = "0.2.4" +version = "0.2.5" dependencies = [ "bliss-audio-aubio-rs", "crossbeam", diff --git a/Cargo.toml b/Cargo.toml index a1f2637..b73c9de 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bliss-audio" -version = "0.2.4" +version = "0.2.5" authors = ["Polochon-street "] edition = "2018" license = "GPL-3.0-only" diff --git a/README.md b/README.md index 8a7b33d..585873e 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,6 @@ used by C-bliss, since it uses different, more accurate values, based on [actual literature](https://lelele.io/thesis.pdf). It is also faster. -Note 2: The `bliss-rs` crate is outdated. You should use `bliss-audio` -(this crate) instead. - ## Examples For simple analysis / distance computing, a look at `examples/distance.rs` and `examples/analyse.rs`. @@ -32,20 +29,20 @@ Ready to use examples: ### Compute the distance between two songs ``` -use bliss_audio::Song; +use bliss_audio::{BlissError, Song}; -fn main() { - let song1 = Song::new("/path/to/song1"); - let song2 = Song::new("/path/to/song2"); - - println!("Distance between song1 and song2 is {}", song1.distance(song2)); +fn main() -> Result<(), BlissError> { + let song1 = Song::new("/path/to/song1")?; + let song2 = Song::new("/path/to/song2")?; + + println!("Distance between song1 and song2 is {}", song1.distance(&song2)); + Ok(()) } ``` ### Make a playlist from a song ``` -use bliss_rs::{BlissError, Song}; -use ndarray::{arr1, Array}; +use bliss_audio::{BlissError, Song}; use noisy_float::prelude::n32; fn main() -> Result<(), BlissError> { @@ -56,18 +53,9 @@ fn main() -> Result<(), BlissError> { .collect::, BlissError>>()?; // Assuming there is a first song - let analysis_first_song = arr1(&songs[0].analysis); + let first_song = songs.first().unwrap().to_owned(); - // Identity matrix used to compute the distance. - // Note that it can be changed to alter feature ponderation, which - // may yield to better playlists (subjectively). - let m = Array::eye(analysis_first_song.len()); - - songs.sort_by_cached_key(|song| { - n32((arr1(&song.analysis) - &analysis_first_song) - .dot(&m) - .dot(&(arr1(&song.analysis) - &analysis_first_song))) - }); + songs.sort_by_cached_key(|song| n32(first_song.distance(&song))); println!( "Playlist is: {:?}", songs diff --git a/src/lib.rs b/src/lib.rs index 3b69b6b..d415017 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -38,7 +38,6 @@ //! ### Make a playlist from a song //! ```no_run //! use bliss_audio::{BlissError, Song}; -//! use ndarray::{arr1, Array}; //! use noisy_float::prelude::n32; //! //! fn main() -> Result<(), BlissError> { diff --git a/src/temporal.rs b/src/temporal.rs index 8aa41d7..74acad4 100644 --- a/src/temporal.rs +++ b/src/temporal.rs @@ -19,7 +19,7 @@ use noisy_float::prelude::*; * It indicates the (subjective) "speed" of a music piece. The higher the BPM, * the "quicker" the song will feel. * - * It uses `WPhase`, a phase-deviation onset detection function to perform + * It uses `SpecFlux`, a phase-deviation onset detection function to perform * onset detection; it proved to be the best for finding out the BPM of a panel * of songs I had, but it could very well be replaced by something better in the * future.