Method: Echonest::Song#echoprint_code
- Defined in:
- lib/echonest-ruby-api/song.rb
#echoprint_code(filepath) ⇒ Object
Generates an acoustic fingerprint using the echoprint-codegen binary.
Examples:
echoprint_code('path/to/song.mp3')
#=> Echoprint code as String
Raises an Echoprint::Error if the echoprint-codegen binary is not accessible to Ruby on $PATH
-
filepath- Path (absolute or relative) to an audio file atleast 21 seconds in length
Returns a String
56 57 58 59 60 61 62 63 64 |
# File 'lib/echonest-ruby-api/song.rb', line 56 def echoprint_code(filepath) if which('echoprint-codegen').nil? error = Error.new(6) raise Error.new(6), error.description else response = `echoprint-codegen #{ filepath } 1 20` JSON.parse(response)[0]['code'] end end |