Update streaming_speech_client.py to solve Qwen/Qwen3-TTS-12Hz-0.6B-CustomVoice voice problem (#3380)
Signed-off-by: Jie Liu <33612777+keeper-jie@users.noreply.github.com> Signed-off-by: Yueqian Lin <linyueqian@outlook.com> Co-authored-by: Yueqian Lin <linyueqian@outlook.com>
This commit is contained in:
1 parent
bbc00f9f86
commit
90f5b3c3a1
2 files changed
+12
-4
No files matched your search
@@ -7,6 +7,12 @@ Usage:
|
||||
# Send full text at once
|
||||
python streaming_speech_client.py --text "Hello world. How are you? I am fine."
|
||||
|
||||
# Pick a built-in speaker for CustomVoice models
|
||||
python streaming_speech_client.py \
|
||||
--text "打开电子枪,关闭扫描,切换到低倍模式。" \
|
||||
--speaker "Serena" \
|
||||
--language "Chinese"
|
||||
|
||||
# Simulate STT: send text word-by-word with delay
|
||||
python streaming_speech_client.py \
|
||||
--text "Hello world. How are you? I am fine." \
|
||||
@@ -211,7 +217,9 @@ def main():
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
# Build session config (only include non-None values)
|
||||
# Build session config (only include non-None values).
|
||||
# Server canonical field is `voice`; `speaker` is accepted as an alias
|
||||
# (see StreamingSpeechSessionConfig.voice in protocol/audio.py).
|
||||
config = {}
|
||||
for key in [
|
||||
"model",
|
||||
|
||||
@@ -196,7 +196,7 @@ class SpeechBatchItem(BaseModel):
|
||||
all other fields override the batch-level defaults when set."""
|
||||
|
||||
input: str
|
||||
voice: str | None = None
|
||||
voice: str | None = Field(default=None, validation_alias=AliasChoices("voice", "speaker"))
|
||||
instructions: str | None = None
|
||||
response_format: Literal["wav", "pcm", "flac", "mp3", "aac", "opus"] | None = None
|
||||
speed: float | None = Field(default=None, ge=0.25, le=4.0)
|
||||
@@ -215,7 +215,7 @@ class BatchSpeechRequest(BaseModel):
|
||||
|
||||
model: str | None = None
|
||||
items: list[SpeechBatchItem] = Field(..., min_length=1)
|
||||
voice: str | None = None
|
||||
voice: str | None = Field(default=None, validation_alias=AliasChoices("voice", "speaker"))
|
||||
instructions: str | None = None
|
||||
response_format: Literal["wav", "pcm", "flac", "mp3", "aac", "opus"] = "wav"
|
||||
speed: float | None = Field(default=1.0, ge=0.25, le=4.0)
|
||||
@@ -248,7 +248,7 @@ class StreamingSpeechSessionConfig(BaseModel):
|
||||
"""Configuration sent as the first WebSocket message for streaming TTS."""
|
||||
|
||||
model: str | None = None
|
||||
voice: str | None = None
|
||||
voice: str | None = Field(default=None, validation_alias=AliasChoices("voice", "speaker"))
|
||||
task_type: Literal["CustomVoice", "VoiceDesign", "Base"] | None = None
|
||||
language: str | None = None
|
||||
instructions: str | None = None
|
||||
|
||||
Reference in new issue
Block a user