Browse Source

fix: use english filename

master
lanvent 1 year ago
parent
commit
49ba278316
4 changed files with 4 additions and 4 deletions
  1. +1
    -1
      voice/azure/azure_voice.py
  2. +1
    -1
      voice/baidu/baidu_voice.py
  3. +1
    -1
      voice/google/google_voice.py
  4. +1
    -1
      voice/pytts/pytts_voice.py

+ 1
- 1
voice/azure/azure_voice.py View File

@@ -54,7 +54,7 @@ class AzureVoice(Voice):
return reply return reply


def textToVoice(self, text): def textToVoice(self, text):
fileName = TmpDir().path() + '语音回复_' + str(int(time.time())) + '.wav'
fileName = TmpDir().path() + 'reply-' + str(int(time.time())) + '.wav'
audio_config = speechsdk.AudioConfig(filename=fileName) audio_config = speechsdk.AudioConfig(filename=fileName)
speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=self.speech_config, audio_config=audio_config) speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=self.speech_config, audio_config=audio_config)
result = speech_synthesizer.speak_text(text) result = speech_synthesizer.speak_text(text)


+ 1
- 1
voice/baidu/baidu_voice.py View File

@@ -80,7 +80,7 @@ class BaiduVoice(Voice):
result = self.client.synthesis(text, self.lang, self.ctp, { result = self.client.synthesis(text, self.lang, self.ctp, {
'spd': self.spd, 'pit': self.pit, 'vol': self.vol, 'per': self.per}) 'spd': self.spd, 'pit': self.pit, 'vol': self.vol, 'per': self.per})
if not isinstance(result, dict): if not isinstance(result, dict):
fileName = TmpDir().path() + '语音回复_' + str(int(time.time())) + '.mp3'
fileName = TmpDir().path() + 'reply-' + str(int(time.time())) + '.mp3'
with open(fileName, 'wb') as f: with open(fileName, 'wb') as f:
f.write(result) f.write(result)
logger.info( logger.info(


+ 1
- 1
voice/google/google_voice.py View File

@@ -34,7 +34,7 @@ class GoogleVoice(Voice):
return reply return reply
def textToVoice(self, text): def textToVoice(self, text):
try: try:
mp3File = TmpDir().path() + '语音回复_' + str(int(time.time())) + '.mp3'
mp3File = TmpDir().path() + 'reply-' + str(int(time.time())) + '.mp3'
tts = gTTS(text=text, lang='zh') tts = gTTS(text=text, lang='zh')
tts.save(mp3File) tts.save(mp3File)
logger.info( logger.info(


+ 1
- 1
voice/pytts/pytts_voice.py View File

@@ -25,7 +25,7 @@ class PyttsVoice(Voice):


def textToVoice(self, text): def textToVoice(self, text):
try: try:
wavFile = TmpDir().path() + '语音回复_' + str(int(time.time())) + '.wav'
wavFile = TmpDir().path() + 'reply-' + str(int(time.time())) + '.wav'
self.engine.save_to_file(text, wavFile) self.engine.save_to_file(text, wavFile)
self.engine.runAndWait() self.engine.runAndWait()
logger.info( logger.info(


Loading…
Cancel
Save