Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-google-tts-api

Simple node.js library for google text to speech service

Installation

npm i node-google-tts-api 

Usage

const googleTTS = require('node-google-tts-api');
const tts = new googleTTS();

tts.get({
  text: "hello, world",
  lang: "en"
}).then(data => {
  // returns mp3 audio src buffer
  fs.writeFileSync("./audio.mp3", data);
});

Text length limit

Google forbids sending text over 200 characters - which is not very cool. Therefore, a bypass was made:

tts.get({
  text: "a".repeat(200) + "b".repeat(50),
  lang: "en",
  limit_bypass: true // required parameter
}).then(arr => {
  // returns array with mp3 audio src buffers
  let data = tts.concat(arr); // concat audio files
  fs.writeFileSync("./audio.mp3", data);
});

Supported languages

Google text to speech service supports the following language codes:
https://github.com/IldarSham/node-google-tts/blob/master/supported-languages.txt

About

Simple node.js library for google text to speech

Resources

Stars

7 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages