Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

google-translate-tts

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google-translate-tts

Text-to-speech using Google Translate

  • 0.4.0-dev
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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 to the Translate API introduced by Google in November 2020.

A spiritual successor to google-tts-api 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:

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:

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();

Keywords

FAQs

Package last updated on 16 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc