Orpheus TTS 开源语音合成系统概述
Orpheus TTS 是最新开源的语音合成系统,基于 Llama-3B 主干架构,展现了大型语言模型在语音合成领域的强大能力。其自然情感表达几乎能以假乱真,实时输出延迟低至 25-50 毫秒,非常适合实时对话场景。同时,Orpheus TTS 提供四种参数规模(150M 到 3B),可适配不同硬件和需求。零样本语音克隆与灵活的情感控制功能,让用户能够轻松定制专属音色。
核心能力
- 类人语音:具备自然语调、情感和节奏,效果甚至超越部分闭源的 SOTA 模型。
- 零样本语音克隆:无需预先微调,即可直接克隆任意声音。
- 情感与语调控制:借助简单的标签,即可灵活调控语音的情感特征。
- 低延迟:实时应用中流延迟约 200 毫秒,配合输入流可进一步降低至约 100 毫秒。
接下来,我们看看如何快速上手。首先克隆项目仓库,然后安装必要的依赖包:
git clone https://github.com/canopyai/Orpheus-TTS.git cd Orpheus-TTS && pip install orpheus-speech # 底层使用vllm实现快速推理 pip install vllm==0.7.3
需要注意的是,vLLM 在 3 月 18 日发布了新版本,回退到 0.7.3 版本可以避免一些已知错误。接着安装 orpheus-speech:
pip install orpheus-speech
运行一个流式推理示例:
from orpheus_tts import OrpheusModel
import wa ve
import time
model = OrpheusModel(model_name="canopylabs/orpheus-tts-0.1-finetune-prod")
prompt = '''Man, the way social media has, um, completely changed how we interact is just wild, right? Like, we're all connected 24/7 but somehow people feel more alone than ever. And don't even get me started on how it's messing with kids' self-esteem and mental health and whatnot.'''
start_time = time.monotonic()
syn_tokens = model.generate_speech(
prompt=prompt,
voice="tara",
)
with wa ve.open("output.wa v", "wb") as wf:
wf.setnchannels(1)
wf.setsampwidth(2)
wf.setframerate(24000)
total_frames = 0
chunk_counter = 0
for audio_chunk in syn_tokens: # output streaming
chunk_counter += 1
frame_count = len(audio_chunk) // (wf.getsampwidth() * wf.getnchannels())
total_frames += frame_count
wf.writeframes(audio_chunk)
duration = total_frames / wf.getframerate()
end_time = time.monotonic()
print(f"It took {end_time - start_time} seconds to generate {duration:.2f} seconds of audio")
效果测试与在线体验
您可以直接通过在线 Demo 体验:https://huggingface.co/spaces/MohamedRashad/Orpheus-TTS
无论是搭建实时语音助手、制作有声读物,还是开发配音应用,这个项目都非常值得尝试。快来动手实践吧!
