Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chromaprint

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chromaprint

  • 0.0.2
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

Chromaprint

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 (c) 2013 TMX Credit.

FAQs

Package last updated on 30 Sep 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc