Skip to content

TTS 服务

文本转语音合成。

导入

typescript
import { ttsService } from '@/core/services';

synthesize()

typescript
async synthesize(config: TTSConfig): Promise<TTSResult>

参数:

参数类型说明
config.textstring要转换的文本
config.providerstring提供商
config.voicestring语音名称
config.speednumber语速 (0.5-2.0)
config.emotionstring情感类型

示例:

typescript
const result = await ttsService.synthesize({
  text: '欢迎使用 panel-deck',
  provider: 'edge',
  voice: 'zh-CN-XiaoxiaoNeural',
  speed: 1.0,
});

synthesizeBatch()

批量合成。

typescript
async synthesizeBatch(texts: string[], config: TTSConfig): Promise<TTSResult[]>

支持的提供商

提供商质量费用
Edge TTS良好免费
CosyVoice 2.0优秀付费
KAN-TTS良好付费

MIT License © 2026 Agions