GithubHelp home page GithubHelp logo

dominikschnitzer / musly Goto Github PK

View Code? Open in Web Editor NEW
136.0 10.0 27.0 1.09 MB

Musly - Music Similarity Library

Home Page: http://www.musly.org

License: Mozilla Public License 2.0

C++ 67.78% C 26.67% CMake 5.55%

musly's Introduction

Musly

(c) 2013-2014, Dominik Schnitzer [email protected] and 2014-2016, Jan Schlüter [email protected]

Musly is a program and library for high performance audio music similarity computation. Musly only uses the audio signal when computing similarities! No meta data is used in the similarity computation process.

The source code is released under the MPL 2.0 see the file <musly/COPYING>

Version History

VERSION 0.2 (under development)

Not released yet.

The second public Musly release. It includes the following changes and additions:

  • musly_jukebox_addtracks() requires a fifth argument generate_ids: If nonzero, sequential track IDs are generated by Musly (as before), and if zero, track IDs are given by the user.
  • musly_jukebox_removetracks(), musly_jukebox_trackcount(), musly_jukebox_maxtrackid(), and `musly_jukebox_gettrackids() are added to the API.
  • musly_jukebox_guessneighbors_filtered() is added to the API, allowing the filter step to be constrained to a subset of registered tracks.
  • musly_track_analyze_audiofile() accepts two parameters excerpt_length and excerpt_start controlling the length and position of the audio excerpt to be decoded and analyzed instead of the previous max_seconds, and the libav-based decoder's performance has been improved significantly.
  • The musly command line client can compute sparse distance matrices (-s).
  • When configured with -DUSE_OPENMP=On in cmake (or enabling the option in ccmake), the musly command line client and library are built with OpenMP support. The command line client parallelizes several computations.
  • musly_jukebox_binsize(), musly_jukebox_tobin(), musly_jukebox_frombin(), musly_jukebox_tostream(), musly_jukebox_fromstream(), musly_jukebox_tofile() and musly_jukebox_fromfile() are added to the API, allowing to serialize and restore the internal state of a jukebox influenced by calls to musly_jukebox_setmusicstyle(), musly_jukebox_addtracks() and musly_jukebox_removetracks(). The command line client makes use of this when given the option -j or -J.
  • musly_findmin() is added to the API.

VERSION 0.1

Released on 30 Jan 2014.

The first public Musly release. It includes two basic audio music similarity measures:

  • mandelellis (as published in "M. Mandel and D. Ellis: Song-level features and support vector machines for music classification. In the proceedings of the 6th International Conference on Music Information Retrieval, ISMIR, 2005)

  • timbre the mandelellis similarity measure tweaked for best results. We use a 25 MFCCs representation, the Jensen-Shannon divergence and normalize the similarities with Mutual Proximity (D. Schnitzer et al.: Using mutual proximity to improve content-based audio similarity. In the proceedings of the 12th International Society for Music Information Retrieval Conference, ISMIR, 2011).

For benchmarks and qualitative comparisons between other audio music similarity measures visit http://www.musly.org.

Installation

Musly uses the CMake build system, and depends on Eigen 3 and ffmpeg or libav 0.8 or above.

Ubuntu prerequisites

On Ubuntu, all requirements can be installed with: sudo apt-get install cmake libeigen3-dev libavcodec-dev libavformat-dev libavutil-dev

Windows prerequisites

For Windows, the easiest way seems to be to use MSYS2. Install it and launch the "MinGW-w64 Win64 Shell" from the start menu (not the "MSYS2 Shell"), then run:

# Update repository information
pacman -Sy
# Install prerequisites
pacman -S mingw-w64-x86_64-{gcc,cmake-git,pkgconf,eigen3} make wget p7zip
# Download and install precompiled ffmpeg libraries
wget https://ffmpeg.zeranoe.com/builds/win64/dev/ffmpeg-latest-win64-dev.7z
wget https://ffmpeg.zeranoe.com/builds/win64/shared/ffmpeg-latest-win64-shared.7z
7z x ffmpeg-latest-win64-dev.7z
7z x ffmpeg-latest-win64-shared.7z
mv ffmpeg-latest-win64-dev/include/* /usr/include
mv ffmpeg-latest-win64-dev/lib/* /usr/lib
mv ffmpeg-latest-win64-shared/bin/* /usr/bin
rm -rf ffmpeg-latest-win64-*
# Download and extract latest musly snapshot from git
wget https://github.com/dominikschnitzer/musly/archive/master.zip
7z x master.zip
cd musly-master

Compilation

To compile Musly, it is good practice to create an empty directory to build in. This can be placed inside your Musly source tree. Assuming you are in the source tree, run the following commands to build and install Musly (Note: For Windows, add -G"MSYS Makefiles" to both of the cmake lines below):

mkdir -p build && cd build  # create and switch into build directory
cmake ..                    # configure Musly
make                        # compile Musly
sudo make install           # install Musly

To perform a self-test of the library, optionally run (still inside build):

cmake -DBUILD_TEST=ON ..
make
# cp -a libmusly/*.dll libmusly/*/*.dll test/  # required for Windows only
ctest -V

It should end with 100% tests passed, 0 tests failed.

Command Line Tool

The command line interface is able to:

  • Generate M3U playlists for music collections.
  • Output full or sparse similarity matrices for more in-depth research of the audio music similarity functions. It uses the music-ir.org MIREX format (see <musly/doc/MIREX-DistanceMatrix.md>)
  • Additionally the music similarity features can be ouput in text format to ease reuse of the features.

The command line tool is called "musly". Use "musly -h" to read about all available options. See http://www.musly.org for more information.

Library

Please see the library documentation in <doc/html> directory or on-line.

Development

To help Musly development and fix bugs the most convenient way is to use Eclipse. To generate an Eclipse project run:

cmake -G"Eclipse CDT4 - Unix Makefiles"\
      -DCMAKE_ECLIPSE_EXECUTABLE=/path/to/eclipse/eclipse \
      /path/to/musly-src

from an empty directory. The directory is filled with Eclipse project information which can be imported as an Eclipse project.

musly's People

Contributors

dominikschnitzer avatar f0k avatar grray avatar kaixhin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

musly's Issues

Getting an error message when running the sample commands

I have downloaded, built and installed the latest version as instructed on a ubuntu.

I've tried to run the example :

musly -N
musly -x mp3 -a /path/to/my/music
musly -p input.mp3

Creating a new collection and analyzing a directory worked fine (first and second command).
But the last command did not work.
I get the following output:

Installed audio decoder: libav
Reading collection file: collection.musly
Loaded 29 musly tracks to memory.
Initializing jukebox...
File not found in collection! Aborting.

Comparing two mp3 files

Hello,
Is it possible to calculate whether two MP3 files are similar or not?
Thanks!
Markus

Build errors

I'm trying to build musly on Ubuntu 16.10. Got following error after cmake ..:

CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
  Could NOT find LibAV (missing: LIBAV_ROOT_DIR) (Required is at least
  version "0.8")
Call Stack (most recent call first):
  /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindLibAV.cmake:218 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:34 (find_package)

If i run it like this cmake .. -DLIBAV_ROOT_DIR=/usr then I get compile error

/usr/src/musly/libmusly/decoders/libav.cpp: In member function ‘virtual std::vector<float> musly::decoders::libav::decodeto_22050hz_mono_float(const string&, float, float)’:
/usr/src/musly/libmusly/decoders/libav.cpp:182:5: error: ‘AVCodecParameters’ was not declared in this scope
     AVCodecParameters *decp = st->codecpar;
     ^~~~~~~~~~~~~~~~~
/usr/src/musly/libmusly/decoders/libav.cpp:182:24: error: ‘decp’ was not declared in this scope
     AVCodecParameters *decp = st->codecpar;
                        ^~~~
/usr/src/musly/libmusly/decoders/libav.cpp:182:35: error: ‘AVStream {aka struct AVStream}’ has no member named ‘codecpar’; did you mean ‘codec’?
     AVCodecParameters *decp = st->codecpar;
                                   ^~~~~~~~
/usr/src/musly/libmusly/decoders/libav.cpp:190:53: error: ‘avcodec_parameters_to_context’ was not declared in this scope
     avret = avcodec_parameters_to_context(decx, decp);                                                     ^

If i force this branch in code https://github.com/dominikschnitzer/musly/blob/master/libmusly/decoders/libav.cpp#L176, than it compiles successfully, but I don't know how to fix this properly for PR.

compile failed.

I try to build musly on centOS. I installed eigen 3 and libav 0.8 successfully. But I met some problems when compiling musly:
/root/musly/musly-master/libmusly/decoders/libav.cpp: In member function âvirtual std::vector<float, std::allocator > musly::decoders::libav::decodeto_22050hz_mono_float(const std::string&, float, float)â:
/root/musly/musly-master/libmusly/decoders/libav.cpp:369: error: avcodec_free_frame was not declared in this scope
/root/musly/musly-master/libmusly/decoders/libav.cpp:403: error: avcodec_free_frame was not declared in this scope
/root/musly/musly-master/libmusly/decoders/libav.cpp:483: error: avcodec_free_frame was not declared in this scope

could you please give me some advise? thanks a lot!

Building errors and solutions on Windows

Environment:

Problems:

  • Could not find libAV resource in CMake
    ==> Force comment out the last 4 lines of <musly_git_root_path>/musly/cmake/FindLibAV.cmake and comment out version requirement of root CMakeList.txt

  • Lack of M_PI_2 Definitions
    ==> Manually define _USE_MATH_DEFINES in VS

  • Conflicts of win32's min/max macro
    ==> Manually define NOMINMAX in VS

  • <musly_git_root_path>/libmusly/method.cpp line 66, VS mark as "Non-const array length buffer_size"
    ==> Add const qualifier to buffer_size's declaration

  • After define NOMINMAX, all std::min/std::max in <musly_git_root_path>/libmusly/resampler.cpp are invalid then.
    ==> Add nessesary header, i.e. #include <algorithm> at begin of this file

  • <musly_git_root_path>/libmusly/decoders/libav.cpp line 290, VS mark as "unrecognized identifer and"
    ==> Use && instead

  • Redefinition of uint8_t in <musly_git_root_path>/libmusly/lib.cpp line 15 and VS's stdint.h header.
    ==> Comment out the former

  • When CMake option BUILD_STATIC is selected, the output libmusly.lib cannot be recognize in my project, VS hint unresolved symbol ....jukebox_poweron.., am I wrong?
    When this option is unselected, the output contains only 'libmusly.dll' and generate an error that musly_resample.lib not found.
    ==> No solution

installation error

Hi,Dr.schnitzer,

   I install musly step by step. But two errors orrured at the step "Execute make && make install to compile and install Musly", and these two errors occur everytime when i try to install musly in any PC :(.  
    The errors printed on my screen is showing below.

     Linking CXX executable musly
    ../libmusly/libmusly.so: undefined reference to `pthread_create'
    ../libmusly/libmusly.so: undefined reference to `pthread_join'
    collect2: ld returned 1 exit status
    make[2]: *** [musly/musly] 错误 1
     make[1]: *** [musly/CMakeFiles/musly.dir/all] 错误 2

    Didi i miss something?Please help~.

Add a switch (-p) to musly to evaluate the performance

initialize all available methods and perform systematic performance timing tests of:

  • the feature extraction
  • similarity computation

output is preferably a computer readable format. Results could be put on the website.

All songs get the same "score".

I noticed that I would get the same recommendations no matter what seed song I used, which also happened to be the first k song in the database. I then used the -s flag to export a similarity matrix and realized that all "similarity coefficients" are the same, 0.724762.

Self test says: "100% tests passed, 0 tests failed out of 1".

I'm running Debian 9 and followed the build instructions, compilation was without problems except for 2 compiler warnings regarding avcodec deprecations. I'm using the last version available in the repo since v0.1 gave me a lot of errors that apparently had already been fixed.

Musly executable has no flag to remove a track

The command line program doesn't have a flag to remove an entry from the database, even though the library seemingly has a function for it. This feels like an unnecessary limitation.

Can musly run by IDE on windows?

dr.dominik,
can musly run on windows, i want to simulate it in Visual Studio. because it will be more convenient to debug for me.
a little guide will be helpful, thanks.

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.