Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jastinxyz/google-tts.js
A wrapper for the Google Text To Speech API with various features.
https://github.com/jastinxyz/google-tts.js
google google-api google-text-to-speech google-text-to-speech-api google-texttospeech-engine google-translate google-tts google-tts-api googletts
Last synced: 2 months ago
JSON representation
A wrapper for the Google Text To Speech API with various features.
- Host: GitHub
- URL: https://github.com/jastinxyz/google-tts.js
- Owner: JastinXyz
- License: wtfpl
- Created: 2021-06-16T04:29:58.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-26T01:15:12.000Z (almost 3 years ago)
- Last Synced: 2024-10-14T00:06:01.191Z (3 months ago)
- Topics: google, google-api, google-text-to-speech, google-text-to-speech-api, google-texttospeech-engine, google-translate, google-tts, google-tts-api, googletts
- Language: JavaScript
- Homepage: https://npmjs.com/package/google-tts.js
- Size: 42 KB
- Stars: 8
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# google-tts.js
A wrapper for the Google Text To Speech API with various features.
[![NPM](https://img.shields.io/npm/dt/google-tts.js)](https://npmjs.com/package/google-tts.js)
#
# Installation
You can download this package from npmjs. With command:```cli
npm i google-tts.js
```# Example
## getUrl
```js
const GoogleTts = require("google-tts.js")/*
GoogleTts.getUrl("text", "language codes")
*/
GoogleTts.getUrl("abc", "id").then(console.log)
```## Response
```
{
success: true,
url: 'https://translate.google.com/translate_tts?ie=UTF-8&q=abc&tl=id&total=1&idx=0&textlen=24&client=tw-ob&prev=input&ttsspeed=1'
}
```## saveFile
```js
const GoogleTts = require("google-tts.js")/*
GoogleTts.saveFile("text", "language codes", "the location that will be filled by the result mp3. (optional)")
*/
GoogleTts.saveFile("abc", "id", "./src/audio.mp3").then(console.log)/* console log:
{ success: true, message: 'Saved audio in ./src/audio.mp3' }
*//* and
add the resulting file to the location you wrote earlier.
*/
```## Response
```
console log:
{ success: true, message: 'Saved audio in ./src/audio.mp3' }and add the resulting file to the location you wrote earlier.
```# Events
## Saved with .mp3 Result
```js
GoogleTts.saveFile("text", "language codes", "the location that will be filled by the result mp3. (optional)")
```## Get the result url
```js
GoogleTts.getUrl("text", "language codes")
```