Merge pull request #12 from Polochon-street/change-docs

Change some docs
This commit is contained in:
Polochon-street 2021-06-08 21:59:32 +02:00
commit 3236baacc6
6 changed files with 16 additions and 26 deletions

View File

@ -1,5 +1,8 @@
# Changelog
## bliss 0.2.5
* Updates to docs
## bliss 0.2.4
* Make `Analysis::to_vec()` public.

2
Cargo.lock generated
View File

@ -75,7 +75,7 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
[[package]]
name = "bliss-audio"
version = "0.2.4"
version = "0.2.5"
dependencies = [
"bliss-audio-aubio-rs",
"crossbeam",

View File

@ -1,6 +1,6 @@
[package]
name = "bliss-audio"
version = "0.2.4"
version = "0.2.5"
authors = ["Polochon-street <polochonstreet@gmx.fr>"]
edition = "2018"
license = "GPL-3.0-only"

View File

@ -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::<Result<Vec<Song>, 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

View File

@ -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> {

View File

@ -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.