main application with tuning, playing, and GUI
This commit is contained in:
19
_detectsong.py
Normal file
19
_detectsong.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import sounddevice as sd
|
||||
import numpy as np
|
||||
import time
|
||||
import asyncio
|
||||
from shazamio import Shazam
|
||||
|
||||
def rec():
|
||||
recording = sd.rec((44100 * 5), samplerate=44100, channels=1, detype=np.int16)
|
||||
sd.wait()
|
||||
return recording
|
||||
|
||||
async def detect():
|
||||
recording = rec()
|
||||
shazam = Shazam()
|
||||
out = await shazam.recognize_song(recording)
|
||||
print(out)
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.run_until_complete(detect())
|
||||
Reference in New Issue
Block a user