mirror of
https://github.com/dscripka/openWakeWord.git
synced 2026-08-27 18:17:20 -04:00
beep on activation WIP
This commit is contained in:
parent
1f0ee10efe
commit
1e93daa4aa
3 changed files with 30 additions and 1 deletions
25
examples/utils/beep.py
Normal file
25
examples/utils/beep.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import pyaudio
|
||||
import wave
|
||||
|
||||
def playBeep(file_path):
|
||||
CHUNK = 1024
|
||||
|
||||
wf = wave.open(file_path, 'rb')
|
||||
|
||||
p = pyaudio.PyAudio()
|
||||
|
||||
stream = p.open(format=p.get_format_from_width(wf.getsampwidth()),
|
||||
channels=wf.getnchannels(),
|
||||
rate=wf.getframerate(),
|
||||
output=True)
|
||||
|
||||
data = wf.readframes(CHUNK)
|
||||
|
||||
while data != '':
|
||||
stream.write(data)
|
||||
data = wf.readframes(CHUNK)
|
||||
|
||||
#stream.stop_stream()
|
||||
#stream.close()
|
||||
|
||||
#p.terminate()
|
||||
Loading…
Add table
Add a link
Reference in a new issue