Code Monkey home page Code Monkey logo

wavenet's Introduction

WaveNet

Simple scripts to generate audio from text using Google Cloud and WaveNets

This code uses the Python API to access the Text-to-speech service from Google Cloud. There is a 1 million character limit in the free requests for wavenets, so use them wisely.

Step 0: Setting up:

Download and install dependencies:

$ sudo apt install python3-dev python3-pip vlc
$ sudo pip3 install --upgrade pip
$ sudo pip3 install --upgrade google-cloud-texttospeech python-vlc

Step 1: Credentials

Follow this link to:

  • Generate a Google Cloud Platform profile,
  • Enable billing (won't be charged unless it's over a million requests a month)
  • Enable the speech API
  • Set up authentication
  • Download the credentials

This will result in a JSON file with your API private key, which you need to store in the "credentials" directory. Do NOT share this file with anybody, as it contains a private key. Anybody with this file can impersonate you in google cloud platform. For security, I added all JSON files to .gitignore.

Step 2: Test the system

Running the script "text-to-speech.py", will generate a single ".mp3" file that contains an example audio. If this works, your JSON file is correctly downloaded and placed in the repo.

Step 3: Generate YOUR text

By replacing the text inside the "text.txt" file, and rerunning the "text-to-speech.py" script, your text will be converted to speech through Google WaveNet magic.

The "text.txt" file will be parsed line to line, and separate ".mp3" files will be generated for each line. This allows us to move them around more easily within video editors.

The only parameter I felt necessary to change was the speed of the voice, which is modulated by the "speak_rate" parameter at the beginning of the script.

Alternative Usage:

If you instead want the computer to SAY something, instead of saving it, you can do it using the "say.py" script like this:

$ ./say.py -t "Hello, I'm a cool PhD student"

wavenet's People

Contributors

tano297 avatar

Stargazers

 avatar

Watchers

 avatar

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.