Giter Site home page Giter Site logo

tensorflow-wavenet's Introduction

A TensorFlow implementation of DeepMind's WaveNet paper

Build Status

This is a TensorFlow implementation of the WaveNet generative neural network architecture for audio generation.

The WaveNet neural network architecture directly generates a raw audio waveform, showing excellent results in text-to-speech and general audio generation (see the DeepMind blog post and paper for details).

The network models the conditional probability to generate the next sample in the audio waveform, given all previous samples and possibly additional parameters.

After an audio preprocessing step, the input waveform is quantized to a fixed integer range. The integer amplitudes are then one-hot encoded to produce a tensor of shape (num_samples, num_channels).

A convolutional layer that only accesses the current and previous inputs then reduces the channel dimension.

The core of the network is constructed as a stack of causal dilated layers, each of which is a dilated convolution (convolution with holes), which only accesses the current and past audio samples.

The outputs of all layers are combined and extended back to the original number of channels by a series of dense postprocessing layers, followed by a softmax function to transform the outputs into a categorical distribution.

The loss function is the cross-entropy between the output for each timestep and the input at the next timestep.

In this repository, the network implementation can be found in wavenet.py.

Requirements

TensorFlow needs to be installed before running the training script. TensorFlow 0.10 and the current master version are supported.

In addition, librosa must be installed for reading and writing audio.

To install required python packages:

sudo pip install -r requirements.txt

Training the network

The VCTK corpus(around 10.4GB, Alternative host) is currently used. In order to train the network, you need to download the corpus and unpack it in the same directory as the train.py script.

Then, execute

python train.py

to train the network.

You can see documentation on the settings by by running

python train.py --help

You can find the hyperparameters of the network in wavenet_params.json.

Generating audio

You can use the generate.py script to generate audio using a previously trained model.

Run

python generate.py --samples 16000 model.ckpt-1000

where model.ckpt-1000 needs to be a previously saved model. You can find these in the logdir.

The generated waveform can be played back using TensorBoard.

Passing --wav_out_path yields the output as a wav file.

python generate.py --wav_out_path=generated.wav --samples 16000 model.ckpt-1000

Passing --save_every in addition to --wav_out_path will save the in-progress wav file every n samples.

python generate.py --wav_out_path=generated.wav --save_every 2000 --samples 16000 model.ckpt-1000

For fast generation:

python generate.py --samples 16000 model.ckpt-1000 --fast_generation=True

For an explanation of fast generation, see Fast Wavenet.

Missing features

Currently, there is no conditioning on extra information like the speaker ID.

tensorflow-wavenet's People

Contributors

ibab avatar mecab avatar lemonzi avatar jyegerlehner avatar genekogan avatar pkhorrami4 avatar mortont avatar chanil1218 avatar macsj200 avatar zectbynmo avatar prajitr avatar pineking avatar tomlepaine avatar code-terminator avatar

Watchers

James Cloos avatar Vatary 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.