Skip to content
Tim Case edited this page Aug 3, 2013 · 22 revisions

Echonest#song_identify

Identifies a song given an Echoprint or Echo Nest Musical Fingerprint hash codes. Note: You can call song/identify with GET or POST see Echonest API documentation for details on the differences.

Echonest API documentation

source

fingerprint = "eJxVlIuNwzAMQ1fxCDL133-xo1rnGqNAEcWy_
               ERa2aKeZmW9ustWVYrXrl5bthn_laFkzguNWpk
               lEmoTB74JKYZSPlbJ0sy9fQrsrbEaO9W3bsbaW
               OoK7IhkHFaf_ag2d75oOQSZczbz5CKA7XgTIBI
               XASvFi0A3W8pMUZ7FZTWTVbujCcADlQ_f_WbdR
               NJ2vDUwSF0EZmFvAku_CVy440fgiIvArWZZWoJ
               7GWd-CVTYC5FCFI8GQdECdROE20UQfLoIUmhLC
               7IiByF1gzbAs3tsSKctyC76MPJlHRsZ5qhSQhu
               _CJFcKtW4EMrHSIrpTGLFqsdItj1H9JYHQYN7W
               2nkC6GDPjZTAzL9dx0fS4M1FoROHh9YhLHWdRc
               hQSd_CLTpOHkQQP3xQsA2-sLOUD7CzxU0GmHVd
               Ixh46Oide0NrNEmjghG44Ax_k2AoDHsiV6WsiD
               6OFm8y-0Lyt8haDBBzeMlAnTuuGYIB4WA2lEPA
               WbdeOabgFN6TQMs6ctLA5fHyKMBB0veGrjPfP0
               0IAlWNm9n7hEh5PiYYBGKQDP-x4F0CL8HkhoQn
               RWN997JyEpnHFR7EhLPQMZmgXS68hsHktEVErr
               anvSSR2VwfJhQCnkuwhBUcINNY-xu1pmw3PmBq
               U9-8xu0kiF1ngOa8vwBSSzzNw==".gsub("\n", ' ')

Echonest.song_identify(:code => fingerprint) =>
#<Echonest::Song:0x007ff1b304b508 @attrs={:score=>54, :title=>"Billie Jean", 
#:message=>"OK (match type 5)", :artist_id=>"ARXPPEY1187FB51DF4", 
#:artist_name=>"Michael Jackson", :id=>"SODJXOA1313438FB61"}>

query = '{
  "metadata": {
    "artist": "Michael jackson",
    "release": "800 chansons des annes 80",
    "title": "Billie jean",
    "genre": "",
    "bitrate": 192,
    "sample_rate": 44100,
    "duration": 294,
    "filename": "../billie_jean.mp3",
    "samples_decoded": 220598,
    "given_duration": 20,
    "version": 3.13
  },
  "code": "' + fingerprint + '"}'


Echonest.song_identify(:query => query) =>
#<Echonest::Song:0x007f859b99a818 @attrs={:score=>54, :title=>"Billie Jean", 
#:message=>"OK (match type 5)", :artist_id=>"ARXPPEY1187FB51DF4", 
#:artist_name=>"Michael Jackson", :id=>"SODJXOA1313438FB61"}>

Methods on Echonest::Song

Echonest#song_profile

Get info about songs given a list of ids

Echonest.song_profile(:id=> 'SOCZMFK12AC468668F') => 
#<Echonest::Song:0x007fa8abbaa490 @attrs={:artist_id=>"ARZHQSP12FE086C216", 
:id=>"SOCZMFK12AC468668F", :artist_name=>"Wil-Lean", :title=>"Stay Fly"}>

Methods on Echonest::Song

Echonest#song_search

Search for songs given different query types

Echonest.song_search(:artist => 'Macklemore', :results => 3) =>
[#<Echonest::Song:0x007fc8e0a3f560 @attrs={:artist_id=>"AR2XDHU1187B9B484F", 
:id=>"SOAFRBZ1312A8A5536", :artist_name=>"Macklemore", :title=>"And We Danced (feat. Ziggy Stardust)"}>,
#<Echonest::Song:0x007fc8e0a3f538 @attrs={:artist_id=>"AR2XDHU1187B9B484F", 
:id=>"SOEPGXT1338A5D83A5", :artist_name=>"Macklemore", :title=>"Can't Hold Us (Feat. Ray Dalton)"}>, 
#<Echonest::Song:0x007fc8e0a3f510 @attrs={:artist_id=>"AR2XDHU1187B9B484F", :id=>"SOCRYSC1313438D0DF",
 :artist_name=>"Macklemore", :title=>"The Town"}>]

Methods on Echonest::Song

Clone this wiki locally