You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The first version of this code was based on pvrecoder but then errors began to occur and connected sounddevice and the code stopped responding. Doesn't throw any errors. Help me please!
My code:
import pvporcupine
import queue
import sounddevice as sd
import yaml
import sys
with open('tokens.yaml', encoding="utf-8") as f:
data = yaml.safe_load(f)
PICOVOICE_TOKEN = data[0].get("Picovoice")
porcupine = pvporcupine.create(
access_key=PICOVOICE_TOKEN,
keyword_paths=[r'C:\Users\lsiba\OneDrive\Desktop\CODS\jarvis\jarvis_windows.ppn'],
sensitivities=[1]
)
#print(sd.query_devices())
device_info = sd.query_devices(sd.default.device[0], 'input')
samplerate = int(device_info['default_samplerate'])
q = queue.Queue()
def recordCallback(indata, frames, time, status):
if status:
print(status, file=sys.stderr)
q.put(bytes(indata))
def wake_word():
with sd.RawInputStream(dtype='int16',
blocksize = 256,
channels=1,
callback=recordCallback):
global cont
cont = True
while cont==True:
data = q.get()
keyword_index = porcupine.process(data)
if keyword_index >= 0:
cont = False
print("WAKE")
return "WAKE"
wake_word()
The text was updated successfully, but these errors were encountered:
The first version of this code was based on pvrecoder but then errors began to occur and connected sounddevice and the code stopped responding. Doesn't throw any errors. Help me please!
My code:
The text was updated successfully, but these errors were encountered: