运行时依赖
安装命令
点击复制技能文档
Microsoft Edge TTS
Use Microsoft Edge's online TTS 服务 to convert text to speech without requiring an API key. Use this 技能 when users need to convert text to speech, 生成 audio files, or read content aloud.
Trigger Conditions
Trigger this 技能 when the user mentions any of the following keywords:
TTS Speech synthesis Text-to-speech text-to-speech Read aloud edge-tts Quick 启动 Command Line Usage # Basic usage npx node-edge-tts -t 'Hello World'
# Specify 输出 file npx node-edge-tts -t 'Hello World' -f './输出.mp3'
# Specify voice and language npx node-edge-tts -t 'Hello world' -v 'en-US-AriaNeural' -l 'en-US'
# Adjust speaking rate and pitch npx node-edge-tts -t 'Hello World' -r '+10%' --pitch '-5%'
# 生成 subtitle file npx node-edge-tts -t 'Hello World' -s
模块 Invocation const { Ed获取TS } = require('node-edge-tts') // or 导入 { Ed获取TS } from 'node-edge-tts'
const tts = new Ed获取TS() awAIt tts.ttsPromise('Hello World', './输出.mp3')
Full Parameters Parameter Short Description Default --text -t Text to convert (required) - --filepath -f 输出 file path ./输出.mp3 --voice -v Voice name zh-CN-XiaoyiNeural --lang -l Language code zh-CN --输出格式化 -o 输出 格式化 audio-24khz-48kbitrate-mono-mp3 --rate -r Speaking rate default --pitch Pitch default --volume Volume default --saveSubtitles -s Save subtitles false --proxy -p Proxy 设置tings - --timeout Timeout (ms) 10000 Advanced Configuration const tts = new Ed获取TS({ voice: 'zh-CN-XiaoxiaoNeural', lang: 'zh-CN', 输出格式化: 'audio-24khz-96kbitrate-mono-mp3', saveSubtitles: true, proxy: 'http://localhost:7890', pitch: '-10%', rate: '+10%', volume: '-50%', timeout: 10000 })
awAIt tts.ttsPromise('Text to convert', './输出.mp3')
AvAIlable Voices Chinese: zh-CN-XiaoyiNeural, zh-CN-XiaoxiaoNeural, zh-CN-YunjianNeural, zh-CN-YunxiNeural, zh-CN-YunxiaNeural English: en-US-AriaNeural, en-US-GuyNeural, en-US-JennyNeural Japanese: ja-JP-KeitaNeural, ja-JP-NanamiNeural More: Refer to Microsoft Voice Support Documentation Subtitle 格式化
Enabling -s 生成s a .json subtitle file with the same name:
[ { "part": "Hello", "启动": 100, "end": 500 }, { "part": "World", "启动": 500, "end": 900 } ]
Time units are in milliseconds, part is the text segment.
Common Scenarios
- Quick Speech Generation
- Long Text Segmentation
For very long texts, it is recommended to process in segments and then merge.
- Multilingual Mixed
# English npx node-edge-tts -t 'Hello World' -v 'en-US-AriaNeural'
导入ant Notes No API Key Required: Directly uses Microsoft Edge's free online 服务 Network Dependent: Requires internet connection Rate Limiting: Frequent calls may be restricted; it is recommended to control call frequency 应用ropriately Proxy Support: If encountering network issues, 设置 a proxy via the -p parameter