crate build doc

bliss music analyser - Rust version

bliss-rs is the Rust improvement of bliss, a library used to make playlists by analyzing songs, and computing distance between them.

Like bliss, it eases the creation of « intelligent » playlists and/or continuous play, à la Spotify/Grooveshark Radio, as well as easing creating plug-ins for existing audio players.

For now (and if you're looking for an easy-to use smooth play experience), blissify implements bliss for MPD.

There are also python bindings.

Note 1: the features bliss-rs outputs is not compatible with the ones used by C-bliss, since it uses different, more accurate values, based on actual literature. It is also faster.

Examples

For simple analysis / distance computing, a look at examples/distance.rs and examples/analyse.rs.

Ready to use examples:

Compute the distance between two songs

``` use bliss_audio::{BlissError, Song};

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 blissaudio::{BlissError, Song}; use noisyfloat::prelude::n32;

fn main() -> Result<(), BlissError> { let paths = vec!["/path/to/song1", "/path/to/song2", "/path/to/song3"]; let mut songs: Vec = paths .iter() .map(|path| Song::new(path)) .collect::, BlissError>>()?;

// Assuming there is a first song
let first_song = songs.first().unwrap().to_owned();

songs.sort_by_cached_key(|song| n32(first_song.distance(&song)));
println!(
    "Playlist is: {:?}",
    songs
        .iter()
        .map(|song| &song.path)
        .collect::<Vec<&String>>()
);
Ok(())

} ```

Further use

Instead of reinventing ways to fetch a user library, play songs, etc, and embed that into bliss, it is easier to look at the Library trait.

By implementing a few functions to get songs from a media library, and store the resulting analysis, you get access to functions to analyze an entire library (with multithreading), and to make playlists easily.

See blissify for a reference implementation.

Acknowledgements