I am making an application that requires sound, and when I am trying to play the sound, I keep getting this error:
Error 263 for command: open audio1750892060.mp3 The specified device is not open or is not recognized by MCI.
And these are the lines of code causing the error:
def speak(audio_string):
tts = gTTS(text=audio_string, lang='en')
r = random.randint(1, 5000000000)
audio_file = 'audio' + str(r) + '.mp3'
tts.save(audio_file)
playsound.playsound(audio_file)
print(audio_string)
os.remove(audio_file)