Coder Social home page Coder Social logo

realharshbhatt / presto-chango Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yashrajkakkad/presto-chango

1.0 1.0 0.0 281.24 MB

Identify a song from a small recorded sample using audio fingerprinting over frequency domain.

License: MIT License

Python 100.00%

presto-chango's Introduction

Music Identification Through Audio Fingerprinting

PyPI PyPI - Python Version PyPI - License
Identifies a song from a small recording (say 30 seconds). The song has to be a part of your created database, of course.

This project is essentially a simplified version of what Shazam does.

The Idea

The flowchart on the right describes the series of steps.

Below is a brief summary. For detailed explanation with analysis, check out our Report.

We decimate the audio signal by a factor of 4 after passing it through a low pass filter (to smartly avoid aliasing). Thereafter, the signal is converted to frequency domain using the famous Fast Fourier Transform.

We take small chunks of the sample (roughly 0.3 seconds) and take the peak frequencies along a logarithmic scale. Those values are then associated with a hash value. We do so for all the songs and hence create a database.

We perform similar steps for the recorded sample. The answer is the song with the highest number of matches for a particular offset value.

Requirements

  • Python 3+.
  • pip (package installer for Python). See here for installation.
  • ffmpeg. See here for installation.
  • PortAudio. Only for Linux/OSX users. Check your distribution's repos for latest builds. Instead you can also build it from source, see here.

Installation

  • Install using pip (preferred in a virtual environment).
pip install Presto-Chango

Usage

  • On the first run, create your database by specifying the location of your songs directory.
presto-chango create-db <songs-directory>
  • Identify a song by either recording in real time or using a pre-recorded sample.
# Record in real time
presto-chango identify

# Use a pre-recorded sample
presto-chango identify --file=samples/sample1.wav
  • The algorithm returns the top five matches and the number of offsets that matched for each of them. Example
$ presto-chango identify --file="samples/sample_GAY.wav"
  Loading database
  .
  .
  .
  Database loaded

  Processing...

  Results:
  Kane Brown - Good as You (Official Music Video)_mS3TeZEp_PE.wav 41
  Katy Perry - Never Really Over (Official)_aEb5gNsmGJ8.wav 39
  Ed Sheeran - Perfect (Official Music Video)_2Vv-BfVoq4g.wav 37
  Cody Johnson - On My Way To You (Official Music Video)_RKUENGsDXBA.wav 24
  Jason Aldean - Rearview Town_WEUUvntknTI.wav 23

Building the source code

  • Clone the repository
git clone https://github.com/yashrajkakkad/presto-chango.git
cd presto-chango
  • Create a virtual environment
python -m venv venv
source venv/bin/activate
  • Install the package. The --editable flag makes it so that we don't have to reinstall everytime we make some change.
pip install --editable .

Testing

You can run the tester code if you're too lazy to record songs. It will cut random 30 second samples from songs and run the algorithm.

python tester.py

References

presto-chango's People

Contributors

prayags avatar yashrajkakkad avatar

Stargazers

 avatar

Watchers

 avatar

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.