edge-tts
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

edge-tts

edge-tts is a allows you to use Microsoft Edge's online text-to-speech service from within your TypeScript code.

Based on edge-tts for python.

Usage

import { tts, ttsSave } from 'edge-tts'

// buffer of mp3 data
const audioBuffer = await tts('hello world')

// or if you just want a file
await ttsSave('hello world', './tts.mp3')

// customize voice
await tts('hello world', {
  voice: 'es-VE-PaolaNeural', // can be any Voice.Name, Voice.ShortName, or Voice.FriendlyName
  volume: '+50%', // 50% louder
  rate: '-50%', // 50% the speed
  pitch: '-50Hz' // 50Hz lower
})

Find voices to use for the voice param using getVoices

import { getVoices, tts } from 'edge-tts'

// get list of available voices
const voices = await getVoices()

// get voices done by native english speakers
const englishVoices = voices.filter(v => v.Locale === 'en-US')

// select a random english voice
const voice = englishVoices[Math.floor(Math.random() * englishVoices.length)]

// can also use voice.ShortName, or voice.FriendlyName
const audioBuffer = await tts('hello world', { voice: voice.Name })

Readme

Keywords

none

Package Sidebar

Install

npm i edge-tts

Weekly Downloads

8

Version

1.0.1

License

CC BY-NC-SA 4.0

Unpacked Size

36.4 kB

Total Files

7

Last publish

Collaborators

  • f53