Coder Social home page Coder Social logo

essentia-analyzer's Introduction

DEPRECATED Please use Music Similarity instead.


Essentia Analyzer

Simple python3 script to analyze music files with Essentia and store details in an SQLite database. This DB can then be used by Essentia API Server to provide a HTTP API to retrieve similar tracks. This API is in turn used by the LMS Similarity Plugin to provide a 'Dont Stop The Music' mixer.

Analysing Tracks

./essentia-analyzer.py -c config.json -l DEBUG

CUE files

If the analysis locates a music file with a similarly named CUE file (e.g. artist/album/album name.flac and artist/album/album name.cue) then it will read the track listing from the LMS db file and use ffmpeg to split the music file into temporary 128kbps MP3 files for analysis. The files are removed once analysis is complete.

Configuration

The script reads its configuration from a JSON file (default name is config.json). This has the following format:

{
 "extractor":"bin/x86-64/essentia_streaming_extractor_music",
 "essentia":"/home/Music/",
 "lms":"/media/Music/",
 "tmp":"/tmp/",
 "db":"/home/user/.local/share/essentia.db",
 "lmsdb":"/path/to/lms/Cache/library.db",
 "json_cache":"/path/to/store/essentia/json/files/",
 "stop":"stop",
 "threads":7
}
  • extractor contains the location of the Essentia extractor binary.
  • essentia is the path to your music files on the current machine. This script will store music paths relative to the path configured here. e.g. if this is set to /home/user/Music/ then /home/user/Music/ABBA/Greatest Hits/Waterloo.mp3 will be stored as ABBA/Greatest Hits/Waterloo.mp3
  • lms is the path of your music as LMS sees it. This is needed when analyzing CUE files. The script will look for track details in LMS's db and use this config item to ammend the paths as required. e.g. if lms is set to /disk2/Music and essentia set to /home/user/Music/ the script will convert /disk2/Music/Artist/Album.cue to /home/user/Music/Artist/Album.cue This is to cater for cases where LMS is on another machine (e.g. a raspberry pi) but you want to analyze on a faster machine.
  • tmp when handling CUE files, the script will use this directory to store the temporary MP3 files.
  • db is the name of the database file that will be created.
  • lmsdb should contain the location of LMS's library DB. This is only required if handling CUE files.
  • json_cache The Essentia music extractor outputs JSON files containing the analyzed information. By default these JSON files are written to the tmp directory and removed when done. To keep these files, for later usage, you can specify an alternative folder via json_cache - and these files will not be removed.
  • stop when runnning the script will check for the presence of the filename set here, and if found the script will gracefully terminate. This allows you to start analyzing a large music collection but stop half way through. (When re-started the anlyzer will resume from where it stopped).
  • threads Number of threads to use during analysis phase. This controls how many calls to ffmpeg are made concurrently, and how many concurrent tracks essentia is asked to analyse. Defaults to CPU count, if not set.

Ignoring artists, albums, etc.

To mark certains items as 'ignored' (i.e. so that they are not added to mixes), create a text file where each line contains the unique path, e.g.:

AC-DC/Power Up/
The Police/

Then call:

./update-db.py --db essentia.db --ignore ignore.txt

This sets the ignore column to 1 for all items whose file starts with one of the listed lines.

Setting a track's ignore to 1 will exclude tracks from being added to mixes - but if they are already in the queue, then they can sill be used as seed tracks.

Credits

The Essentia binary is taken from Roland0's LMS Essentia Integration

essentia-analyzer's People

Contributors

cdrummond avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.