Registry / communication / node-edge-tts

node-edge-tts

JSON →
library1.2.10jsnpmunverified

node-edge-tts is a Node.js module providing an interface to Microsoft Edge's free online Text-to-Speech (TTS) service. Currently at version 1.2.10, this library allows developers to convert text into speech without needing an API key, relying on the public Edge TTS endpoint. It offers both a programmatic API for integrating TTS into Node.js applications and a command-line interface for quick conversions. Key features include configurable voices, languages, output formats, and the ability to save detailed subtitles alongside the audio. Unlike cloud-based TTS solutions that often require authentication and consumption-based billing, node-edge-tts leverages a readily available service, making it suitable for projects requiring an accessible and free text-to-speech option, though with potential limitations inherited from the underlying Edge service regarding supported speech configurations. The project appears to be actively maintained, with regular updates indicated by its current version number.

npm install node-edge-tts
INSTALL
IMPORT
SIG · NODE-EDGE-TTS
N
node-edge-tts
communicationjavascriptv1.2.10
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

EdgeTTS
import { EdgeTTS } from 'node-edge-tts'
const EdgeTTS = require('node-edge-tts')
Use named import for ESM. For CommonJS, use `const { EdgeTTS } = require('node-edge-tts')`.
EdgeTTS
const { EdgeTTS } = require('node-edge-tts')
import EdgeTTS from 'node-edge-tts'
This is the correct CommonJS `require` syntax. The package does not provide a default export.
EdgeTTSOptions
import type { EdgeTTSOptions } from 'node-edge-tts'
Import the type definition for configuration options when using TypeScript.

Demonstrates how to instantiate EdgeTTS, configure it with a voice and output format, and generate an audio file with corresponding subtitles.

import { EdgeTTS } from 'node-edge-tts'; import * as path from 'path'; import * as fs from 'fs'; async function generateSpeech() { const outputDir = './audio_output'; if (!fs.existsSync(outputDir)) { fs.mkdirSync(outputDir, { recursive: true }); } const audioFilePath = path.join(outputDir, 'hello_world.mp3'); const tts = new EdgeTTS({ voice: 'en-US-AriaNeural', lang: 'en-US', outputFormat: 'audio-24khz-96kbitrate-mono-mp3', saveSubtitles: true, // proxy: 'http://localhost:7890', // Uncomment and configure if behind a proxy // timeout: 15000 // Increase timeout if network is slow }); try { console.log(`Generating speech to ${audioFilePath}...`); await tts.ttsPromise('Hello world, this is a test from node-edge-tts!', audioFilePath); console.log('Speech generated successfully!'); console.log(`Subtitles saved to ${audioFilePath.replace('.mp3', '.json')}`); } catch (error) { console.error('Failed to generate speech:', error); } } generateSpeech();
edge-tts --version
Debug
Known issues
gotchaSome advanced speech configuration options (pitch, rate, volume) listed in Microsoft's official documentation might not be fully supported by the underlying Edge online TTS service this library uses, leading to unexpected behavior or ignored settings.
fix
Test specific pitch/rate/volume settings thoroughly. For critical applications requiring precise control, consider official Azure Cognitive Services Speech SDKs.
affects: >=1.0.0
gotchaThe library relies on an unofficial interface to Microsoft Edge's online TTS service. This means its functionality can be broken by undocumented changes to Edge's service or internal APIs, which are outside the control of the library maintainers.
fix
Regularly test the library's functionality, especially after major Edge browser updates or if speech generation starts failing unexpectedly. Consider contributing to the project or having a fallback TTS solution for mission-critical use cases.
affects: >=1.0.0
gotchaSaving subtitles generates a JSON file with the same base name as the audio file in the specified output directory. Ensure your application handles both files appropriately, especially for cleanup or relocation.
fix
Always expect both an audio and a `.json` subtitle file if `saveSubtitles` is enabled. Implement logic to manage or delete both files together.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Network request failed
The module could not connect to the Microsoft Edge TTS service endpoint due to network issues, firewall restrictions, an incorrect proxy configuration, or a timeout.
fix
Verify your internet connection, check firewall settings, ensure any specified `proxy` option is correct and reachable, and consider increasing the `timeout` option for slower networks.
Error: Invalid voice or language parameter
The `voice` or `lang` specified in the configuration is not recognized or supported by the Microsoft Edge TTS service, or it uses an incorrect format.
fix
Refer to Microsoft's documentation for supported voices and languages (linked in the README) and ensure the exact string is used. Test with common, well-known voices first (e.g., 'en-US-AriaNeural').
ENOENT: no such file or directory, open './output.mp3'
The directory specified in the `filepath` for the output audio does not exist, and the library does not automatically create it.
fix
Before calling `ttsPromise`, ensure the directory for the output file exists. Use `fs.mkdirSync(path.dirname(audioFilePath), { recursive: true });` if the directory might not exist.
Upgrade
Version history
1.2.10latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
33 hits · last 30 days
node
28
OpenAI (training)
1
Resources
node-edge-tts — npm install node-edge-tts · libregistry