# google-translate-tts

> Text-to-speech using Google Translate

Latest version **0.4.0-dev** (published 2021-01-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install google-translate-tts
pnpm add google-translate-tts
yarn add google-translate-tts
bun add google-translate-tts
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.4.0-dev |
| Published | 2021-01-16 |
| First published | 2020-12-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 14.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Nick Pierson |
| Maintainers | ncpierson |
| Keywords | tts, text-to-speech, google, translate, node-red |

## Links

- npm: https://www.npmjs.com/package/google-translate-tts
- Repository: https://github.com/ncpierson/google-translate-tts
- Homepage: https://github.com/ncpierson/google-translate-tts#readme
- Issues: https://github.com/ncpierson/google-translate-tts/issues
- npm.io page: https://npm.io/package/google-translate-tts

## Alternatives

- [ext-list](https://npm.io/package/ext-list.md) — 6.3M weekly downloads
- [@lexical/selection](https://npm.io/package/@lexical/selection.md) — 3.8M weekly downloads
- [@lexical/text](https://npm.io/package/@lexical/text.md) — 3.6M weekly downloads
- [@lexical/clipboard](https://npm.io/package/@lexical/clipboard.md) — 3.0M weekly downloads
- [@tiptap/extension-mention](https://npm.io/package/@tiptap/extension-mention.md) — 3.0M weekly downloads

## Recent versions

- 0.4.0-dev (latest) — 2021-01-16
- 0.3.0 — 2020-12-05
- 0.2.1 — 2020-12-05
- 0.2.0 — 2020-12-04
- 0.1.0 — 2020-12-02
- 0.0.1 — 2020-12-02

## README

google-translate-tts
---

This package is for using Google Translate to create audio clips in node js.

This library has been updated to work with the [new
changes](https://github.com/Boudewijn26/gTTS-token/blob/master/docs/november-2020-translate-changes.md)
to the Translate API introduced by Google in November 2020.

A spiritual successor to [google-tts-api](https://github.com/zlargon/google-tts)
which worked with the previous Translate API.

## Installation

```
npm install google-translate-tts
```

or

```
yarn add google-translate-tts
```

## Usage

Find a voice to use:

```js
const tts = require('google-translate-tts');

// lookup by name
const voice = tts.voices.findByName('English (United States)');

// lookup by code
const voice = tts.voices.findByCode('en-US');

// an array of all voices
console.log(tts.voices);

/* Voice example:
 * {
 *   code: 'en-US',
 *   name: 'English (United States)'
 * }
 */
```

Download an audio clip:

```js
const fs = require('fs');
const tts = require('google-translate-tts');

// notice that `tts.synthesize` returns a Promise<Buffer>
const saveFile = async () => {
    const buffer = await tts.synthesize({
        text: 'Hello, world!',
        voice: 'en-US',
        slow: false // optional
    });

    fs.writeFileSync('hello-world.mp3', buffer);
};

saveFile();
```

---
_Source: https://npm.io/package/google-translate-tts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
