https://github.com/codef53/edge-tts
https://github.com/codef53/edge-tts
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/codef53/edge-tts
- Owner: CodeF53
- License: other
- Created: 2024-04-13T03:20:17.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-15T02:04:57.000Z (about 1 year ago)
- Last Synced: 2025-03-14T20:48:07.904Z (3 months ago)
- Language: TypeScript
- Size: 54.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://github.com/rany2/edge-tts/) for python.
## Usage
```js
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`
```js
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 })
```