Created
October 21, 2016 08:57
-
-
Save ajahongir/05045f15431d39f194a3473d3de8e347 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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