Code Monkey home page Code Monkey logo

Comments (4)

florabtw avatar florabtw commented on August 22, 2024 4

I was going to contribute to this repo but I decided to just do a rewrite since so much code would have to change:
https://github.com/ncpierson/google-translate-tts

Can use with:

yarn add google-translate-tts

then

const tts = require('google-translate-tts');
const buffer = await tts.synthesize({ text: 'Hello, world!', voice: 'en-US' });
fs.writeFileSync('hello-world.mp3', buffer);

It's not perfect, but it's all I needed for soundoftext.com, and I'll keep working on it.

from google-tts.

freddiefujiwara avatar freddiefujiwara commented on August 22, 2024 2

@ncpierson
If you are in a hurry please use the following package instead of this one
https://github.com/freddiefujiwara/google-tts/tree/feature/fix-dec-1

in your package.json

"dependencies": {
        ...
        "google-tts-api": "https://github.com/freddiefujiwara/google-tts#feature/fix-dec-1",
       ...
    },

from google-tts.

zlargon avatar zlargon commented on August 22, 2024 2

New Google TTS API has been implemented in version 2.0.0, and there are some breaking changes.

Please see more details in README and CHANGELOG
Thanks.

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

// get base64 text
googleTTS
  .getAudioBase64('Hello World', { lang: 'en-US', slow: false })
  .then((base64) => {
    console.log({ base64 });

    // save the audio file
    const buffer = Buffer.from(base64, 'base64');
    fs.writeFileSync('hello-world-english.mp3', buffer, { encoding: 'base64' });
  })
  .catch(console.error);

from google-tts.

florabtw avatar florabtw commented on August 22, 2024

It looks like this change went 100% today. All requests are failing for me. Solving this will solve #33 though I don't know how difficult it will be.

from google-tts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.