2013-11-19 02:51:27 +00:00
|
|
|
from dejavu.control import Dejavu
|
|
|
|
from ConfigParser import ConfigParser
|
|
|
|
import warnings
|
|
|
|
warnings.filterwarnings("ignore")
|
|
|
|
|
|
|
|
# load config
|
|
|
|
config = ConfigParser()
|
|
|
|
config.read("dejavu.cnf")
|
|
|
|
|
|
|
|
# create Dejavu object
|
|
|
|
dejavu = Dejavu(config)
|
|
|
|
dejavu.fingerprint("va_us_top_40/mp3", "va_us_top_40/wav", [".mp3"], 5)
|
|
|
|
|
|
|
|
# recognize microphone audio
|
|
|
|
from dejavu.recognize import Recognizer
|
|
|
|
recognizer = Recognizer(dejavu.fingerprinter, config)
|
|
|
|
|
|
|
|
# recognize song playing over microphone for 10 seconds
|
2013-12-18 06:31:00 +00:00
|
|
|
song = recognizer.listen(seconds=5, verbose=True)
|
|
|
|
print song
|