360 Secure SkillHub
360 安全技能中心

Microsoft Edge TTS

通过 npx 调用 node-edge-tts 包,使用微软 Edge 免费在线语音合成服务把文本转为 MP3 音频,无需 API Key。支持命令行与模块两种调用方式,可指定发音人、语言、输出格式、语速、音调、音量、代理和超时,并可用 -s 生成同名 JSON 字幕文件。需联网使用,频繁调用可能被限流。

openlark
openlark
热度 37.83
最近更新 2026-05-11 17:42:01
分类:效率依赖:代码执行 / 第三方 API / 读写文件应用场景:文件转换 / 自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add microsoft-edge-tts
Metadata
name
microsoft-edge-tts
description
Use Microsoft Edge online TTS service to convert text to speech. Supports command line and module invocation, no API key required.

Microsoft Edge TTS

Use Microsoft Edge's online TTS service to convert text to speech without requiring an API key. Use this skill when users need to convert text to speech, generate audio files, or read content aloud.

Trigger Conditions

Trigger this skill when the user mentions any of the following keywords:

  • TTS
  • Speech synthesis
  • Text-to-speech
  • text-to-speech
  • Read aloud
  • edge-tts

Quick Start

Command Line Usage

# Basic usage
npx node-edge-tts -t 'Hello World'

# Specify output file
npx node-edge-tts -t 'Hello World' -f './output.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%'

# Generate subtitle file
npx node-edge-tts -t 'Hello World' -s

Module Invocation

const { EdgeTTS } = require('node-edge-tts')
// or
import { EdgeTTS } from 'node-edge-tts'

const tts = new EdgeTTS()
await tts.ttsPromise('Hello World', './output.mp3')

Full Parameters

Parameter Short Description Default
--text -t Text to convert (required) -
--filepath -f Output file path ./output.mp3
--voice -v Voice name zh-CN-XiaoyiNeural
--lang -l Language code zh-CN
--outputFormat -o Output format audio-24khz-48kbitrate-mono-mp3
--rate -r Speaking rate default
--pitch Pitch default
--volume Volume default
--saveSubtitles -s Save subtitles false
--proxy -p Proxy settings -
--timeout Timeout (ms) 10000

Advanced Configuration

const tts = new EdgeTTS({
  voice: 'zh-CN-XiaoxiaoNeural',
  lang: 'zh-CN',
  outputFormat: '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', './output.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 Format

Enabling -s generates a .json subtitle file with the same name:

[
  { "part": "Hello", "start": 100, "end": 500 },
  { "part": "World", "start": 500, "end": 900 }
]

Time units are in milliseconds, part is the text segment.

Common Scenarios

1. Quick Speech Generation

npx node-edge-tts -t 'Welcome to speech synthesis'

2. Long Text Segmentation

For very long texts, it is recommended to process in segments and then merge.

3. Multilingual Mixed

# Chinese
npx node-edge-tts -t 'Hello World' -v 'zh-CN-XiaoxiaoNeural'

# English
npx node-edge-tts -t 'Hello World' -v 'en-US-AriaNeural'

Important Notes

  1. No API Key Required: Directly uses Microsoft Edge's free online service
  2. Network Dependent: Requires internet connection
  3. Rate Limiting: Frequent calls may be restricted; it is recommended to control call frequency appropriately
  4. Proxy Support: If encountering network issues, set a proxy via the -p parameter