finished adding beep and loading one model parameter for capture_activations

This commit is contained in:
Bartmoss 2023-02-04 15:34:24 +01:00
parent 1e93daa4aa
commit a5fb83143f
2 changed files with 38 additions and 16 deletions

View file

@ -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()