0
I created a program that synthesizes a Python speech with the gTTS library, but at the end when I play the saved audio this error appears:
Traceback (most recent call last):
File "C:/Users/vinic/Desktop/Programação/Projetos/Lia/Lia/Lia.py", line 4, in <module>
Falar("Bom dia")
File "C:\Users\vinic\Desktop\Programação\Projetos\Lia\Lia\Habilidades\Falar.py", line 15, in Falar
playsound.playsound("C:\\Users\\vinic\\Desktop\\Programação\\Projetos\\Lia\\Lia\\Sons\\Fala.mp3")
File "C:\Users\vinic\AppData\Local\Programs\Python\Python37\lib\site-packages\playsound.py", line 35, in _playsoundWin
winCommand('open "' + sound + '" alias', alias)
File "C:\Users\vinic\AppData\Local\Programs\Python\Python37\lib\site-packages\playsound.py", line 30, in winCommand
'\n ' + errorBuffer.value.decode())
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe3 in position 24: invalid continuation byte
Program
from Subprogramas.BarraDiretorio import BarraDiretorio
from gtts import gTTS
import playsound
import os
def Falar(Texto):
Barra = BarraDiretorio()
Diretorio = os.getcwd().replace('Habilidades', 'Sons')
Sintese = gTTS(Texto, lang='pt', slow=False)
Sintese.save(Diretorio + '{}Fala.mp3'.format(Barra))
playsound.playsound("C:\\Users\\vinic\\Desktop\\Programação\\Projetos\\Lia\\Lia\\Sons\\Fala.mp3")
If anyone knows anything please tell me :)
from Subprogramas.BarraDiretorio import BarraDiretorio
- What is this?– Victor Stafusa
What text did you ask him to speak?
– Victor Stafusa
from Subprograms.Barradiretorio import Barradiretorio It’s a function I created to take the user’s operating system and return a bar ( or / )
– Nícolas Carvalho
And the text is passed as function input Talk about( )
– Nícolas Carvalho