mirror of
https://github.com/dscripka/openWakeWord.git
synced 2026-08-27 18:17:20 -04:00
finished adding beep and loading one model parameter for capture_activations
This commit is contained in:
parent
1e93daa4aa
commit
a5fb83143f
2 changed files with 38 additions and 16 deletions
|
|
@ -1,25 +1,22 @@
|
|||
import pyaudio
|
||||
import wave
|
||||
|
||||
def playBeep(file_path):
|
||||
def playBeep(file_path, audio):
|
||||
CHUNK = 1024
|
||||
|
||||
wf = wave.open(file_path, 'rb')
|
||||
|
||||
p = pyaudio.PyAudio()
|
||||
|
||||
stream = p.open(format=p.get_format_from_width(wf.getsampwidth()),
|
||||
stream = audio.open(format=audio.get_format_from_width(wf.getsampwidth()),
|
||||
channels=wf.getnchannels(),
|
||||
rate=wf.getframerate(),
|
||||
output=True)
|
||||
|
||||
data = wf.readframes(CHUNK)
|
||||
|
||||
while data != '':
|
||||
while data != b'':
|
||||
stream.write(data)
|
||||
data = wf.readframes(CHUNK)
|
||||
|
||||
#stream.stop_stream()
|
||||
#stream.close()
|
||||
|
||||
#p.terminate()
|
||||
stream.stop_stream()
|
||||
stream.close()
|
||||
Loading…
Add table
Add a link
Reference in a new issue