qwen3tts support languages

This commit is contained in:
Concedo
2026-07-27 22:45:04 +08:00
parent fee0bf446c
commit 7a69646196
5 changed files with 49 additions and 1 deletions
+3
View File
@@ -505,6 +505,7 @@ class tts_generation_inputs(ctypes.Structure):
("custom_speaker_data", ctypes.c_char_p),
("reference_audio", ctypes.c_char_p),
("speaker_instruction", ctypes.c_char_p),
("language", ctypes.c_char_p),
("use_mp3", ctypes.c_bool)]
class tts_generation_outputs(ctypes.Structure):
@@ -3068,10 +3069,12 @@ def tts_generate(genparams):
inputs = tts_generation_inputs()
inputs.custom_speaker_voice = normalized_voice.encode("UTF-8")
ttsinstruction = genparams.get("instruction", "")
ttslang = genparams.get("language", "en")
# if no instruction provided, extract from text
if not genparams.get("instruction", ""):
prompt, ttsinstruction = tts_extract_instruction(prompt)
inputs.speaker_instruction = ttsinstruction.encode("UTF-8")
inputs.language = ttslang.encode("UTF-8")
response_format_mp3 = True if (genparams.get("response_format")=="mp3") else False
inputs.use_mp3 = genparams.get("use_mp3", response_format_mp3)
inputs.prompt = prompt.encode("UTF-8")