use aplay for linux for wav play
This commit is contained in:
@@ -42,11 +42,13 @@ class Speech():
|
|||||||
audio_file = 'sample.wav'
|
audio_file = 'sample.wav'
|
||||||
display(Audio(data=audio, rate=24000, autoplay=i==0), display_id=False)
|
display(Audio(data=audio, rate=24000, autoplay=i==0), display_id=False)
|
||||||
sf.write(audio_file, audio, 24000) # save each audio file
|
sf.write(audio_file, audio, 24000) # save each audio file
|
||||||
if platform.system().lower() != "windows":
|
if platform.system().lower() == "windows":
|
||||||
subprocess.call(["afplay", audio_file])
|
|
||||||
else:
|
|
||||||
import winsound
|
import winsound
|
||||||
winsound.PlaySound(audio_file, winsound.SND_FILENAME)
|
winsound.PlaySound(audio_file, winsound.SND_FILENAME)
|
||||||
|
elif platform.system().lower() == "linux":
|
||||||
|
subprocess.call(["aplay", audio_file])
|
||||||
|
else:
|
||||||
|
subprocess.call(["afplay", audio_file])
|
||||||
|
|
||||||
def replace_url(self, url: re.Match) -> str:
|
def replace_url(self, url: re.Match) -> str:
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user