Voice
2026-04-01
新闻来源:网淘吧
围观:13
电脑广告
手机广告
语音技能
语音技能通过使用edge-tts提供增强的文本转语音功能,允许您将文本转换为语音音频,并提供多种播放选项。
功能
- 使用微软Edge的TTS引擎进行文本转语音
- 支持多种语音选项和音频设置
- 直接播放生成的音频
- 自动清理临时音频文件
- 与MEDIA系统集成以实现音频播放
安装
在使用此技能之前,您需要安装所需的依赖项:

pip3 install edge-tts
或使用技能的安装操作:
await skill.execute({ action: 'install' });
使用
直接说话(推荐)
直接说出文本,无需存储到文件:
const result = await skill.execute({
action: 'speak', // New improved action
text: 'Hello, how are you today?'
});
// Audio is played directly and temporary file is cleaned up automatically
生成文件的文本转语音
使用默认设置将文本转换为语音:
const result = await skill.execute({
action: 'tts',
text: 'Hello, how are you today?'
});
// Returns a MEDIA link to the audio file
直接播放:
const result = await skill.execute({
action: 'tts',
text: 'Hello, how are you today?',
playImmediately: true // Plays the audio immediately after generation
});
使用自定义选项:
const result = await skill.execute({
action: 'tts',
text: 'This is a sample of voice customization.',
options: {
voice: 'zh-CN-XiaoxiaoNeural',
rate: '+10%',
volume: '-5%',
pitch: '+10Hz'
}
});
播放现有音频文件
播放现有音频文件:
const result = await skill.execute({
action: 'play',
filePath: '/path/to/audio/file.mp3'
});
列出可用语音
获取可用语音列表:
const result = await skill.execute({
action: 'voices'
});
清理临时文件
清理超过1小时(默认)的临时音频文件:
const result = await skill.execute({
action: 'cleanup'
});
或指定自定义时间阈值:
const result = await skill.execute({
action: 'cleanup',
options: {
hoursOld: 2 // Clean files older than 2 hours
}
});
选项
文本转语音提供以下选项:
语音:要使用的语音(默认:'zh-CN-XiaoxiaoNeural')语速:语速调整(默认:'+0%')音量:音量调整(默认:'+0%')音调:音调调整(默认:'+0Hz')
支持的语音
Edge-TTS支持多种语言的语音:
- 中文:zh-CN-XiaoxiaoNeural、zh-CN-YunxiNeural、zh-CN-YunyangNeural
- 英语(美国):en-US-Standard-C、en-US-Standard-D、en-US-Wavenet-F
- 英语(英国):en-GB-Standard-A, en-GB-Wavenet-A
- 日语:ja-JP-NanamiNeural
- 韩语:ko-KR-SunHiNeural
- 以及更多...
文件管理
- 音频文件暂时存储在
temp目录 - 文件在1小时后(默认)自动清理
- 直接说话选项在5秒后清理文件
要求
- Python 3.x
- pip 包管理器
- edge-tts 库(通过
pip3 install edge-tts安装)
文章底部电脑广告
手机广告位-内容正文底部
上一篇:Nanobanana Pro
下一篇:Mia Twitter Stealth


微信扫一扫,打赏作者吧~