Found better way to play sound

This commit is contained in:
2021-06-18 10:09:26 -04:00
parent 270143e048
commit 38dd1d576d
2 changed files with 4 additions and 10 deletions

View File

@ -8,14 +8,8 @@ Created on Fri Jan 8 10:26:56 2021
from os import system
from sys import platform
sound_args = ""
import simpleaudio as sa
def play_sound(file):
if platform == "win32" or platform == "win64" or platform == "cygwin":
cmd = "wmplayer " + '"' + file + '"'
else:
cmd = "aplay -N " + sound_args + " " + file + " &"
# print(cmd)
system(cmd)
wave_obj = sa.WaveObject.from_wave_file(file)
play_obj = wave_obj.play()