Coder Social home page Coder Social logo

baburdick / chromaprint Goto Github PK

View Code? Open in Web Editor NEW

This project forked from albertosaurus/chromaprint

0.0 2.0 0.0 620 KB

Port of Chromaprint C/C++ library to Ruby to extract fingerprints from audio sources.

License: MIT License

Ruby 100.00%

chromaprint's Introduction

Chromaprint

Build Status

Port of Chromaprint C/C++ library to Ruby.

A client-side library that implements a custom algorithm for extracting fingerprints from any audio source.

Dependencies

  • Chromaprint

Debian / Ubuntu

apt-get install libchromaprint-dev

Mac

# At the time of this writing, chromaprint is unavailable in MacPorts or Fink:
brew install chromaprint

Usage

# Create context for rate=44100 and channel=1.
context1 = Chromaprint::Context.new(44100, 1)

# Get audio data. Data should be in raw audio format with 16-bit signed samples.
# The library doesn't care about decoding formats like mp3 or ogg, you should
# do it yourself.
data1 = File.binread('/1.wav')

# Create context for rate=22050 and channel=2 and get fingerprint
context2     = Chromaprint::Context.new(22050, 1)
fingerprint1 = context1.get_fingerprint(data1)

# Get fingerprint of another audio
context2     = Chromaprint::Context.new(44100, 2)
fingerprint2 = context2.get_fingerprint(File.binread('/2.wav')

# Compressed fingerprint, returned by chromaprint_get_fingerprint() C function.
fingerprint1.compressed  # => "AQAALOkUKdlChE92NNeFn8EjF9..."

# Raw fingerprint, returned by chromaprint_get_raw_fingerprint() C function.
fingerprint1.raw  # => [294890785, 328373552, 315802880, 303481088, ...]

# Compare 2 fingerprints, result is 0..1 range, where 1 is 100% similarity.
fingerprint1.compare(fingerprint2)  # => 0.93231

Run tests

rake spec

Credits

Copyright

Copyright (c) 2013 TMX Credit.

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.