{"id":11417,"library":"node-edge-tts","title":"Edge TTS for Node.js","description":"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.","status":"active","version":"1.2.10","language":"javascript","source_language":"en","source_url":"https://github.com/SchneeHertz/node-edge-tts","tags":["javascript","TTS","Text-to-Speech","Edge","typescript"],"install":[{"cmd":"npm install node-edge-tts","lang":"bash","label":"npm"},{"cmd":"yarn add node-edge-tts","lang":"bash","label":"yarn"},{"cmd":"pnpm add node-edge-tts","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Use named import for ESM. For CommonJS, use `const { EdgeTTS } = require('node-edge-tts')`.","wrong":"const EdgeTTS = require('node-edge-tts')","symbol":"EdgeTTS","correct":"import { EdgeTTS } from 'node-edge-tts'"},{"note":"This is the correct CommonJS `require` syntax. The package does not provide a default export.","wrong":"import EdgeTTS from 'node-edge-tts'","symbol":"EdgeTTS","correct":"const { EdgeTTS } = require('node-edge-tts')"},{"note":"Import the type definition for configuration options when using TypeScript.","symbol":"EdgeTTSOptions","correct":"import type { EdgeTTSOptions } from 'node-edge-tts'"}],"quickstart":{"code":"import { EdgeTTS } from 'node-edge-tts';\nimport * as path from 'path';\nimport * as fs from 'fs';\n\nasync function generateSpeech() {\n  const outputDir = './audio_output';\n  if (!fs.existsSync(outputDir)) {\n    fs.mkdirSync(outputDir, { recursive: true });\n  }\n  const audioFilePath = path.join(outputDir, 'hello_world.mp3');\n\n  const tts = new EdgeTTS({\n    voice: 'en-US-AriaNeural',\n    lang: 'en-US',\n    outputFormat: 'audio-24khz-96kbitrate-mono-mp3',\n    saveSubtitles: true,\n    // proxy: 'http://localhost:7890', // Uncomment and configure if behind a proxy\n    // timeout: 15000 // Increase timeout if network is slow\n  });\n\n  try {\n    console.log(`Generating speech to ${audioFilePath}...`);\n    await tts.ttsPromise('Hello world, this is a test from node-edge-tts!', audioFilePath);\n    console.log('Speech generated successfully!');\n    console.log(`Subtitles saved to ${audioFilePath.replace('.mp3', '.json')}`);\n  } catch (error) {\n    console.error('Failed to generate speech:', error);\n  }\n}\n\ngenerateSpeech();","lang":"typescript","description":"Demonstrates how to instantiate EdgeTTS, configure it with a voice and output format, and generate an audio file with corresponding subtitles."},"warnings":[{"fix":"Test specific pitch/rate/volume settings thoroughly. For critical applications requiring precise control, consider official Azure Cognitive Services Speech SDKs.","message":"Some 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.","severity":"gotcha","affected_versions":">=1.0.0"},{"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.","message":"The 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.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always expect both an audio and a `.json` subtitle file if `saveSubtitles` is enabled. Implement logic to manage or delete both files together.","message":"Saving 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.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"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.","cause":"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.","error":"Error: Network request failed"},{"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').","cause":"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.","error":"Error: Invalid voice or language parameter"},{"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.","cause":"The directory specified in the `filepath` for the output audio does not exist, and the library does not automatically create it.","error":"ENOENT: no such file or directory, open './output.mp3'"}],"ecosystem":"npm"}