From 3eb39ebef250d415c24bb3e67c3e4aafa02a4b38 Mon Sep 17 00:00:00 2001 From: Sakura-RanChen <1908198662@qq.com> Date: Mon, 11 Aug 2025 17:38:17 +0800 Subject: [PATCH] update: huoshanTTS add config --- .../main/resources/db/changelog/202508111733.sql | 4 ++++ .../resources/db/changelog/db.changelog-master.yaml | 7 +++++++ main/xiaozhi-server/config.yaml | 3 +++ .../core/providers/tts/huoshan_double_stream.py | 13 +++++++++++++ 4 files changed, 27 insertions(+) create mode 100644 main/manager-api/src/main/resources/db/changelog/202508111733.sql diff --git a/main/manager-api/src/main/resources/db/changelog/202508111733.sql b/main/manager-api/src/main/resources/db/changelog/202508111733.sql new file mode 100644 index 00000000..c4c52b02 --- /dev/null +++ b/main/manager-api/src/main/resources/db/changelog/202508111733.sql @@ -0,0 +1,4 @@ +-- 更新HuoshanDoubleStreamTTS供应器增加语速,音调等配置 +UPDATE `ai_model_provider` +SET fields = '[{"key": "ws_url", "type": "string", "label": "WebSocket地址"}, {"key": "appid", "type": "string", "label": "应用ID"}, {"key": "access_token", "type": "string", "label": "访问令牌"}, {"key": "resource_id", "type": "string", "label": "资源ID"}, {"key": "speaker", "type": "string", "label": "默认音色"}, {"key": "speech_rate", "type": "number", "label": "语速(-50~100)"}, {"key": "loudness_rate", "type": "number", "label": "音量(-50~100)"}, {"key": "pitch", "type": "number", "label": "音高(-12~12)"}]' +WHERE id = 'SYSTEM_TTS_HSDSTTS'; \ No newline at end of file diff --git a/main/manager-api/src/main/resources/db/changelog/db.changelog-master.yaml b/main/manager-api/src/main/resources/db/changelog/db.changelog-master.yaml index c36272eb..b477e02f 100755 --- a/main/manager-api/src/main/resources/db/changelog/db.changelog-master.yaml +++ b/main/manager-api/src/main/resources/db/changelog/db.changelog-master.yaml @@ -289,3 +289,10 @@ databaseChangeLog: - sqlFile: encoding: utf8 path: classpath:db/changelog/202508081701.sql + - changeSet: + id: 202508111733 + author: RanChen + changes: + - sqlFile: + encoding: utf8 + path: classpath:db/changelog/202508111733.sql diff --git a/main/xiaozhi-server/config.yaml b/main/xiaozhi-server/config.yaml index 8e9e77cd..ab662798 100644 --- a/main/xiaozhi-server/config.yaml +++ b/main/xiaozhi-server/config.yaml @@ -586,6 +586,9 @@ TTS: access_token: 你的火山引擎语音合成服务access_token resource_id: volc.service_type.10029 speaker: zh_female_wanwanxiaohe_moon_bigtts + speech_rate: 0 + loudness_rate: 0 + pitch: 0 CosyVoiceSiliconflow: type: siliconflow # 硅基流动TTS diff --git a/main/xiaozhi-server/core/providers/tts/huoshan_double_stream.py b/main/xiaozhi-server/core/providers/tts/huoshan_double_stream.py index ea7f18fd..33e2750d 100644 --- a/main/xiaozhi-server/core/providers/tts/huoshan_double_stream.py +++ b/main/xiaozhi-server/core/providers/tts/huoshan_double_stream.py @@ -152,6 +152,12 @@ class TTSProvider(TTSProviderBase): self.voice = config.get("private_voice") else: self.voice = config.get("speaker") + speech_rate = config.get("speech_rate", "0") + loudness_rate = config.get("loudness_rate", "0") + pitch = config.get("pitch", "0") + self.speech_rate = int(speech_rate) if speech_rate else 0 + self.loudness_rate = int(loudness_rate) if loudness_rate else 0 + self.pitch = int(pitch) if pitch else 0 self.ws_url = config.get("ws_url") self.authorization = config.get("authorization") self.header = {"Authorization": f"{self.authorization}{self.access_token}"} @@ -636,8 +642,15 @@ class TTSProvider(TTSProviderBase): "audio_params": { "format": audio_format, "sample_rate": audio_sample_rate, + "speech_rate": self.speech_rate, + "loudness_rate": self.loudness_rate }, }, + "additions": { + "post_process": { + "pitch": self.pitch + } + } } ) )