Qwen-TTS支持三种中文方言,实现人类级语音合成
Qwen-TTS是通义千问最新发布的文本转语音模型,支持中英双语和北京话、上海话、四川话三种方言,在SeedTTS-Eval基准上达到人类水平,可通过API调用。
介绍我们在此介绍通过Qwen API提供的Qwen-TTS最新更新(qwen-tts-latest或qwen-tts-2025-05-22)。Qwen-TTS在涵盖超过数百万小时语音的大规模数据集上进行训练,实现了人类水平的自然性和表现力。
值得注意的是,Qwen-TTS会根据输入文本自动调整韵律、节奏和情感变化。此外,Qwen-TTS支持生成3种中文方言,包括北京话、上海话和四川话。
截至目前,Qwen-TTS支持7种中英双语声音,包括Cherry、Ethan、Chelsie、Serena、Dylan(北京话)、Jada(上海话)和Sunny(四川话)。更多语言和风格选项将在不久的将来发布。
中国方言样本以下是一些示例,展示了Qwen-TTS捕获方言和自然语音模式的能力。附加结果Qwen-TTS已经展示了人类水平的性能,SeedTTS-Eval基准测试的指标如下所示:以下是这四位说话者的一些中英双语样本:如何使用使用Qwen-TTS和Qwen API很简单。
我们在下面演示了一个代码片段供您使用:import osimport requestsimport dashscopedef get_api_key():api_key = os.getenv("DASHSCOPE_API_KEY") if not api_key:
raise EnvironmentError("DASHSCOPE_API_KEY environment variable not set.")
return api_keydef synthesize_speech(text,voice="Dylan",model="qwen-tts-latest"):api_key = get_api_key() try:
response = dashscope.audio.qwen_tts.SpeechSynthesizer.call( model=model,
api_key=api_key,text=text,voice=voice,) # Check if response is None if response is None:
raise RuntimeError("API call returned None response") # Check if response.output is None if response.output is None:
raise RuntimeError("API call failed:response.output is None") # Check if response.output.audio exists if not hasattr(response.output,
'audio') or response.output.audio is None:raise RuntimeError("API call failed:
response.output.audio is None or missing") audio_url = response.output.audio["url"] return audio_url except Exception as e:
raise RuntimeError(f"Speech synthesis failed:{e}")def download_audio(audio_url,save_path):try:resp = requests.get(audio_url,
timeout=10) resp.raise_for_status() with open(save_path,
'wb') as f:f.write(resp.content) print(f"Audio file saved to:{save_path}") except Exception as e:raise RuntimeError(f"Download failed:
{e}")def main():text = ( """哟,您猜怎么着?今儿个我看NBA,库里投篮跟闹着玩似的,张手就来,篮筐都得喊他“亲爹”了""" ) save_path = "downloaded_audio.wav" try:
audio_url = synthesize_speech(text) download_audio(audio_url,
save_path) except Exception as e:print(e)if __name__ == "__main__":main()总结Qwen-TTS是一种文本到语音模型,支持中英双语合成和多种中文方言。
它旨在生成自然且富有表现力的语音,并通过API提供。虽然它展示了有希望的结果,但我们期待未来进一步的改进和更广泛的语言支持。