forked from dscripka/openWakeWord
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finished adding beep and loading one model parameter for capture_acti…
…vations
- Loading branch information
1 parent
1e93daa
commit a5fb831
Showing
2 changed files
with
38 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |