simple-gtts

1.1.1 • Public • Published

simple-gtts

Simple Google text to speech

await gTTS("hello there", {
  lang: "en-us",
  path: "./hello.mp3"
})

Install

$ npm i simple-gtts

Usage

import { gTTS } from "simple-gtts"

gTTS(text, data)

gTTS turns text into speech, and can output either a file or a buffer

file

// Include a path to save to a file
await gTTS("hello there", {
  path: "./hello.mp3"
})

buffer

// Not including a path will return a buffer
const buff = await gTTS("hello there")

languages

You can change the language the text is read in by providing a language code

// Languages work with both files and buffers
await gTTS("hello there", {
  lang: "fr",
  path: "./hello.mp3"
})

To view the available languages, you can import and console.log them

import {languages} from "simple-gtts"

console.log(languages)

Package Sidebar

Install

npm i simple-gtts

Weekly Downloads

2

Version

1.1.1

License

MIT

Unpacked Size

4.61 kB

Total Files

4

Last publish

Collaborators

  • ewanhowell5195