added line to close wave file after playback
This commit is contained in:
parent
f10c7247f5
commit
cc058a907b
1 changed files with 4 additions and 4 deletions
|
|
@ -47,12 +47,12 @@ def blink(times, speed):
|
||||||
time.sleep(speed)
|
time.sleep(speed)
|
||||||
|
|
||||||
def play_waves(file_num):
|
def play_waves(file_num):
|
||||||
wave_file = open(wave_files[file_num], "rb")
|
wave_file = open(wave_files[file_num], "rb") # open a wav file
|
||||||
wave = audioio.WaveFile(wave_file)
|
wave = audioio.WaveFile(wave_file)
|
||||||
audio.play(wave)
|
audio.play(wave) # play the wave file
|
||||||
while audio.playing:
|
while audio.playing: # allow the wav to finish playing
|
||||||
pass
|
pass
|
||||||
|
wave_file.close() # close the wav file
|
||||||
|
|
||||||
wave_files = ["alex_deepgrowl1.wav", "alex-highgrowl1.wav", "alex-squeal1.wav",
|
wave_files = ["alex_deepgrowl1.wav", "alex-highgrowl1.wav", "alex-squeal1.wav",
|
||||||
"toni-deepgrowl.wav", "toni-highgrowl2.wav","toni-pigsqueal.wav",
|
"toni-deepgrowl.wav", "toni-highgrowl2.wav","toni-pigsqueal.wav",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue