Coder Social home page Coder Social logo

cherokeelanguage / waveglow_vocoder Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hudsonhuang/waveglow_vocoder

1.0 2.0 0.0 2.89 MB

A vocoder that can convert audio to Mel-Spectrogram and reverse with WaveGlow, all on GPU.

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%

waveglow_vocoder's Introduction

WaveGlow Vocoder

A vocoder that can convert audio to Mel-Spectrogram and reverse with WaveGlow, all with GPU.
Most code is from Tacotron2 and WaveGlow.

Install

pip install waveglow-vocoder

Example

Original Vocoded
img img
original music vocoded music
img img
original speech vocoded speech

Usage

Load wav file as torch tensor on GPU.

import librosa

y,sr = librosa.load(librosa.util.example_audio_file(), sr=22050, mono=True, duration=10, offset=30)
y_tensor = torch.from_numpy(y).to(device='cuda', dtype=torch.float32)

Apply mel transform, this would be done with GPU(if avaliable).

from waveglow_vocoder import WaveGlowVocoder

WV = WaveGlowVocoder()
mel = WV.wav2mel(y_tensor)

Decoder it with Waveglow.

NOTE:
As the hyperparameter of pre-trained model is alignment with Tacotron2, one might get totally noise if the Mel spectrogram comes from other function than wav2mel(an alias for TacotronSTFT.mel_spectrogram).
Support for the melspectrogram from librosa and torchaudio is under development.

wav = WV.mel2wav(mel)

Other pretrained model / Train with your own data

This vocoder will download pre-trained model from pytorch hub on the first time of initialize.
You can also download the latest model from WaveGlow, or with your own data and pass the path to the waveglow vocoder.

config_path = "your_config_of_model_training.json"
waveglow_path="your_model_path.pt"
WV = WaveGlowVocoder(waveglow_path=waveglow_path, config_path=config_path)

Then use it as usual.

TODO

  • WaveRNN Vocoder
  • MelGAN Vocoder
  • Performance
  • Support librosa Mel input

Reference

waveglow_vocoder's People

Contributors

hudsonhuang avatar

Stargazers

Dr. Renard Sc.D avatar

Watchers

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