Giter VIP home page Giter VIP logo

fingerprinter's Introduction

last.fm fingerprint
===================

That's the official repository for the last.fm fingerprint library.
The fingerprinting process works in two steps:

1. Get PCM data and pass it to *fplib* which will return byte string to be
   submitted to the last.fm HTTP fingerprint service. This will return a number
   (fingerprintID).

2. Query the last.fm API with the fingerprintID and obtain the metadata in xml
   format.

The lastfm-fpclient directory contains an example of application that uses fplib
and queries both services.

Building
--------

fplib requires the following libraries

   fftw3-dev

lastfm-fpclient requires the following libraries:

   libtag1c2a libtagc0-dev libcurl3 libcurl3-dev libmad0-dev libsamplerate0-dev

(see also doc/readme-unix.txt & doc/readme-osx.txt)

To compile both fplib and lastfm-fpclient just run (you'll need cmake):
   $ cmake .
   $ make

Packaging
---------

To create debian packages just run 'dpkg-buildpackage'

API Documentation
-----------------

To create API documentation just run 'doxygen' (NB. you'll also need dot)

Running
-------

To use lastfm-fpclient just pass any mp3 as argument

   $ lastfm-fpclient mysterious.mp3

Using fplib
===========

You can freely use fplib in your application without any restriciton (see
debian/copyright). Accessing the last.fm API services is restricted to our
terms of services (see http://www.last.fm/api/tos). Basically you can do pretty
much whatever you want as long as it's not for profit.

If you plan to use fplib in your application, there are a few VERY important
things to keep in mind:

important things to keep in mind
--------------------------------

a. fplib accepts standard PCM data, which means that if your track is encoded
   with some format (mp3, ogg, wma, etc..) you need to decode it first.

b. IMPORTANT: The library *REQUIRES* the data to be from the beginning of the
              file.

c. You don't have to decode the whole thing as the library can get as many
   bytes as you want to pass it. If it needs more it will return false.
   Basically the whole processing steps can be summarized by this loop:

      for (;;)
      {
         // read some data from the file
         size_t sz = read_some_source( pPCMBuffer );
         if ( sz == 0 )
         {
            cerr << "ERROR: Insufficient input data!" << endl;
            exit(1); // goodbye!
         }

         // Process to create the fingerprint. If process returns true
         // it means he's happy with what he has.
         if ( fextr.process( pPCMBuffer, sz
                 /*, bool: set it to true if it's EOF */ ) )
            break;
      }

      // get the fingerprint data
      pair<const char*, size_t> fpData = fextr.getFingerprint();

d. fpData is what you'll need to send to the HTTP fingerprint service along
   with (also VERY important) the length of the track in seconds.

e. Other stuff to send is nice to have (artist and track names, genre,
   username, etc..) but not mandatory (but if you abuse us, we'll get you)

The protocol used to talk to the HTTP fingerprint service is just a POST with
the fingerprint binary as object, and the other things (length, metadata,
etc..) as parameters. See lastfm-fpclient for an example.

Using the metadata API
======================

Once you have obtained the fingerprintID from the HTTP fingerprint service (see
above) you have to talk to the metadata API to get the XML with the description
of the track.

To do so, you have to obtain an API key (http://www.last.fm/api/account) then
just query the service with the following parameters:

http://ws.audioscrobbler.com/2.0/?method=track.getfingerprintmetadata&fingerprintid=THE_FINGERPRINT_ID&api_key=YOUR_API_KEY

fingerprinter's People

Contributors

evilrix avatar jonty avatar mxcl avatar nova77 avatar rj 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fingerprinter's Issues

Lastfm Server No Longer Exists

This tool no longer appears to work:

$ ./lastfm-fpclient ~/Music/Bit\ Shifter/Information\ Chase/01\ -\ Bit\ Shifter\ -\ Chase\ Init.mp3 
ERROR: Empty reply from server$

Presumably Last.fm has either discontinued their fingerprinting API, or changed the way it works without updating the client.

This is potentially a duplicate of #9, but if it;s been broken since that was posted, presumably it's supposed to be broken.

Can't build on OSX

Hello,
I'm trying to make this build but not getting any success.

I don't really know how to use cmake and make stuff. I just need the bin so that I can use it with another language.

This is what I get when I do 'cmake .'

[18/04/15 22:55:58][Raghav's:lastfmfpclient]$ cmake .
-- The C compiler identification is AppleClang 6.0.0.6000057
-- The CXX compiler identification is AppleClang 6.0.0.6000057
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
CMake Warning (dev):
  Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run "cmake
  --help-policy CMP0042" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  MACOSX_RPATH is not specified for the following targets:

   fplib_shared

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /usr/local/Cellar/lastfmfpclient

and this is what I get when I do 'make install'

[18/04/15 22:56:25][Raghav's:lastfmfpclient]$ make install
Scanning dependencies of target fplib_shared
[  9%] Building CXX object CMakeFiles/fplib_shared.dir/src/fplib/Filter.cpp.o
[ 18%] Building CXX object CMakeFiles/fplib_shared.dir/src/fplib/FingerprintExtractor.cpp.o
[ 27%] Building CXX object CMakeFiles/fplib_shared.dir/src/fplib/OptFFT.cpp.o
Linking CXX shared library lib/libfplib.dylib
Undefined symbols for architecture x86_64:
  "_fftwf_destroy_plan", referenced from:
      fingerprint::OptFFT::~OptFFT() in OptFFT.cpp.o
  "_fftwf_execute", referenced from:
      fingerprint::OptFFT::process(float*, unsigned long) in OptFFT.cpp.o
  "_fftwf_free", referenced from:
      fingerprint::OptFFT::~OptFFT() in OptFFT.cpp.o
  "_fftwf_malloc", referenced from:
      fingerprint::OptFFT::OptFFT(unsigned long) in OptFFT.cpp.o
  "_fftwf_plan_many_dft_r2c", referenced from:
      fingerprint::OptFFT::OptFFT(unsigned long) in OptFFT.cpp.o
  "_src_delete", referenced from:
      fingerprint::initCustom(fingerprint::PimplData&, int, int, unsigned int, unsigned int, int, unsigned int, int) in FingerprintExtractor.cpp.o
      fingerprint::PimplData::~PimplData() in FingerprintExtractor.cpp.o
  "_src_new", referenced from:
      fingerprint::initCustom(fingerprint::PimplData&, int, int, unsigned int, unsigned int, int, unsigned int, int) in FingerprintExtractor.cpp.o
  "_src_process", referenced from:
      fingerprint::FingerprintExtractor::process(short const*, unsigned long, bool) in FingerprintExtractor.cpp.o
  "_src_short_to_float_array", referenced from:
      fingerprint::src_short_to_float_and_mono_array(short const*, float*, int, int) in FingerprintExtractor.cpp.o
  "_src_strerror", referenced from:
      fingerprint::FingerprintExtractor::process(short const*, unsigned long, bool) in FingerprintExtractor.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/libfplib.dylib] Error 1
make[1]: *** [CMakeFiles/fplib_shared.dir/all] Error 2
make: *** [all] Error 2

Also, in main.cpp

// DO NOT CHANGE THOSE!
const char FP_SERVER_NAME[]       = "ws.audioscrobbler.com/fingerprint/query/";
const char METADATA_SERVER_NAME[] = "http://ws.audioscrobbler.com/2.0/";
const char PUBLIC_CLIENT_NAME[]   = "fp client 1.6";
const char HTTP_POST_DATA_NAME[]  = "fpdata";

// if you want to use the last.fm fingerprint library in your app you'll need
// your own key
const char LASTFM_API_KEY[] = "2bfed60da64b96c16ea77adbf5fe1a82";

Do I have to change anything else other than API key?

Malformed generated XML file

Hello !

Thanks for the great tool you provided to the community.

I wanted to bring to your attention that the lastfm-fpclient often generates malformed xml documents

The opening MBID tag is often missing like in the examples I am providing below
`

This Woman In My Life 221 http://www.last.fm/music/Phil+Vassar/_/This+Woman+In+My+Life 0 `

let me know if you need more example and I will send it your way

Thanks in advance for your help

Building on Ubuntu 12.04 fails.

Everything seemed fine untill.

Linking CXX executable bin/lastfm-fpclient
/usr/bin/ld: cannot find -lfplib
collect2: выполнение ld завершилось с кодом возврата 1
make[2]: *** [bin/lastfm-fpclient] Ошибка 1
make[1]: *** [CMakeFiles/lastfm-fpclient.dir/all] Ошибка 2
make: *** [all] Ошибка 2

Is it an error with build script?

FpLib license

While trying the library I noticed it is based on libsamplerate and fftw3. Those are both GPLed. How come FpLib is distributed under the LGPL? By being linked to GPL libraries it has to be GPL too. Please make it clear in the README.

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.