Skip to content

Instantly share code, notes, and snippets.

@ajahongir
Created October 21, 2016 08:57
Show Gist options
  • Save ajahongir/05045f15431d39f194a3473d3de8e347 to your computer and use it in GitHub Desktop.
Save ajahongir/05045f15431d39f194a3473d3de8e347 to your computer and use it in GitHub Desktop.
import warnings
import json
warnings.filterwarnings("ignore")
from dejavu import Dejavu
from dejavu.recognize import FileRecognizer, MicrophoneRecognizer
# load config from a JSON file (or anything outputting a python dictionary)
with open("dejavu.cnf.SAMPLE") as f:
config = json.load(f)
if __name__ == '__main__':
# create a Dejavu instance
djv = Dejavu(config)
# Fingerprint all the mp3's in the directory we give it
djv.fingerprint_directory("mp3", [".mp3"])
# Recognize audio from a file
song = djv.recognize(FileRecognizer, "mp3/Sean-Fournier--Falling-For-You.mp3")
print "From file we recognized: %s\n" % song
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment