From 49ba278316f9a46ec5dda3bdb5ce4c9a2a285f72 Mon Sep 17 00:00:00 2001 From: lanvent Date: Sun, 2 Apr 2023 16:50:11 +0800 Subject: [PATCH] fix: use english filename --- voice/azure/azure_voice.py | 2 +- voice/baidu/baidu_voice.py | 2 +- voice/google/google_voice.py | 2 +- voice/pytts/pytts_voice.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/voice/azure/azure_voice.py b/voice/azure/azure_voice.py index 3d9b860..57ea30c 100644 --- a/voice/azure/azure_voice.py +++ b/voice/azure/azure_voice.py @@ -54,7 +54,7 @@ class AzureVoice(Voice): return reply 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) speech_synthesizer = speechsdk.SpeechSynthesizer(speech_config=self.speech_config, audio_config=audio_config) result = speech_synthesizer.speak_text(text) diff --git a/voice/baidu/baidu_voice.py b/voice/baidu/baidu_voice.py index bc0c448..8a17728 100644 --- a/voice/baidu/baidu_voice.py +++ b/voice/baidu/baidu_voice.py @@ -80,7 +80,7 @@ class BaiduVoice(Voice): result = self.client.synthesis(text, self.lang, self.ctp, { 'spd': self.spd, 'pit': self.pit, 'vol': self.vol, 'per': self.per}) 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: f.write(result) logger.info( diff --git a/voice/google/google_voice.py b/voice/google/google_voice.py index 901cc99..3a0537f 100644 --- a/voice/google/google_voice.py +++ b/voice/google/google_voice.py @@ -34,7 +34,7 @@ class GoogleVoice(Voice): return reply def textToVoice(self, text): 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.save(mp3File) logger.info( diff --git a/voice/pytts/pytts_voice.py b/voice/pytts/pytts_voice.py index 3b136e0..2e9cdc0 100644 --- a/voice/pytts/pytts_voice.py +++ b/voice/pytts/pytts_voice.py @@ -25,7 +25,7 @@ class PyttsVoice(Voice): def textToVoice(self, text): 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.runAndWait() logger.info(