SAVRN
Search Contact SAVRN

Open-weight model · Text to speech

tts-hifigan-libritts-22050Hz

by SpeechBrain speechbrain/tts-hifigan-libritts-22050Hz

This repository provides all the necessary tools for using a HiFIGAN vocoder trained with LibriTTS (with multiple speakers). The sample rate used for the vocoder is 22050 Hz.

Parameters
Context
Weights55.8 MB
Licenseapache-2.0
AccessOpen weights
Monthly Downloads289.8k

Model Card

By SpeechBrain, published under apache-2.0, revision 418850313160.

This repository provides all the necessary tools for using a HiFIGAN vocoder trained with LibriTTS (with multiple speakers). The sample rate used for the vocoder is 22050 Hz. The pre-trained model takes in input a spectrogram and produces a waveform in output. Typically, a vocoder is used after a TTS model that converts an input text into a spectrogram. Alternatives to this models are the following: - tts-hifigan-libritts-16kHz (same model trained on the same dataset, but for a sample rate of 16000 Hz) - tts-hifigan-ljspeech (same model trained on LJSpeech for a sample rate of 22050 Hz). Please notice that we encourage you to read our tutorials and learn more about To perform inference on…

Read SpeechBrain's full model card

Vocoder with HiFIGAN trained on LibriTTS

This repository provides all the necessary tools for using a HiFIGAN vocoder trained with LibriTTS (with multiple speakers). The sample rate used for the vocoder is 22050 Hz.

The pre-trained model takes in input a spectrogram and produces a waveform in output. Typically, a vocoder is used after a TTS model that converts an input text into a spectrogram.

Alternatives to this models are the following: - tts-hifigan-libritts-16kHz (same model trained on the same dataset, but for a sample rate of 16000 Hz) - tts-hifigan-ljspeech (same model trained on LJSpeech for a sample rate of 22050 Hz).

Install SpeechBrain

pip install speechbrain

Please notice that we encourage you to read our tutorials and learn more about SpeechBrain.

Using the Vocoder

  • Basic Usage:
import torch
from speechbrain.inference.vocoders import HIFIGAN
hifi_gan = HIFIGAN.from_hparams(source="speechbrain/tts-hifigan-libritts-22050Hz", savedir="pretrained_models/tts-hifigan-libritts-22050Hz")
mel_specs = torch.rand(2, 80,298)

# Running Vocoder (spectrogram-to-waveform)
waveforms = hifi_gan.decode_batch(mel_specs)
  • Spectrogram to Waveform Conversion:
import torchaudio
from speechbrain.inference.vocoders import HIFIGAN
from speechbrain.lobes.models.FastSpeech2 import mel_spectogram

# Load a pretrained HIFIGAN Vocoder
hifi_gan = HIFIGAN.from_hparams(source="speechbrain/tts-hifigan-libritts-22050Hz", savedir="pretrained_models/tts-hifigan-libritts-22050Hz")

# Load an audio file (an example file can be found in this repository)
# Ensure that the audio signal is sampled at 22050 Hz; refer to the provided link for a 16000 Hz Vocoder.
#signal, rate = torchaudio.load('speechbrain/tts-hifigan-libritts-22050H/example_22kHz.wav')
signal, rate = torchaudio.load('/home/mirco/Downloads/example_22kHz.wav')

# Ensure the audio is sigle channel
signal = signal[0].squeeze()

torchaudio.save('waveform.wav', signal.unsqueeze(0), 22050)

# Compute the mel spectrogram.
# IMPORTANT: Use these specific parameters to match the Vocoder's training settings for optimal results.
spectrogram, _ = mel_spectogram(
    audio=signal.squeeze(),
    sample_rate=22050,
    hop_length=256,
    win_length=1024,
    n_mels=80,
    n_fft=1024,
    f_min=0.0,
    f_max=8000.0,
    power=1,
    normalized=False,
    min_max_energy_norm=True,
    norm="slaney",
    mel_scale="slaney",
    compression=True
)

# Convert the spectrogram to waveform
waveforms = hifi_gan.decode_batch(spectrogram)

# Save the reconstructed audio as a waveform
torchaudio.save('waveform_reconstructed.wav', waveforms.squeeze(1), 22050)

# If everything is set up correctly, the original and reconstructed audio should be nearly indistinguishable.

Using the Vocoder with the TTS

import torchaudio
from speechbrain.inference.TTS import Tacotron2
from speechbrain.inference.vocoders import HIFIGAN

# Intialize TTS (tacotron2) and Vocoder (HiFIGAN)
tacotron2 = Tacotron2.from_hparams(source="speechbrain/tts-tacotron2-ljspeech", savedir="pretrained_models/tts-tacotron2-ljspeech")
hifi_gan = HIFIGAN.from_hparams(source="speechbrain/tts-hifigan-libritts-22050Hz", savedir="pretrained_models/tts-hifigan-libritts-22050Hz")

# Running the TTS
mel_output, mel_length, alignment = tacotron2.encode_text("Mary had a little lamb")

# Running Vocoder (spectrogram-to-waveform)
waveforms = hifi_gan.decode_batch(mel_output)

# Save the waverform
torchaudio.save('example_TTS.wav',waveforms.squeeze(1), 22050)

Inference on GPU

To perform inference on the GPU, add run_opts={"device":"cuda"} when calling the from_hparams method.

Training

The model was trained with SpeechBrain. To train it from scratch follow these steps: 1. Clone SpeechBrain:

git clone https://github.com/speechbrain/speechbrain/
  1. Install it:
cd speechbrain
pip install -r requirements.txt
pip install -e .
  1. Run Training:
cd recipes/LibriTTS/vocoder/hifigan/
python train.py hparams/train.yaml --data_folder=/path/to/LibriTTS_data_destination --sample_rate=22050

To change the sample rate for model training go to the "recipes/LibriTTS/vocoder/hifigan/hparams/train.yaml" file and change the value for sample_rate as required. The training logs and checkpoints are available here.

Identity and Version

Repository
speechbrain/tts-hifigan-libritts-22050Hz
Publisher
SpeechBrain
Task
Text to speech
Modality
Audio
Library
speechbrain
Parameters
Not stated by the source
Languages
en
Revision
4188503131602dc234f48d7f22eebea93d788736
First published
2022-10-26
Last updated
2024-02-25

Files and Weights

5 files, 56.1 MB in total. The weights are 1 file totalling 55.8 MB in ckpt.

Weights1 file · 55.8 MB
Configuration1 file · 1.0 KB
Documentation1 file · 4.8 KB
Other1 file · 299.2 KB
Repository1 file · 1.5 KB
Every file
FileTypeSizeSHA-256
generator.ckptWeights55.8 MB db0d1249e2c9
hyperparams.yamlConfiguration1.0 KB
README.mdDocumentation4.8 KB
example_22kHz.wavOther299.2 KB
.gitattributesRepository1.5 KB

License and Download

License
apache-2.0
Access
Open weights, no gate
Download size
55.8 MB
Download from SpeechBrain

Released by SpeechBrain through its official repository on Hugging Face. Read the license.

Built From

  • Described by arXiv:2010.05646
  • Trained on (disclosed) LibriTTS

Memory Requirements

PrecisionWeights in memory
As published55.8 MB

Weights only, from the published parameter count; the key-value cache and runtime add to this.

Questions About tts-hifigan-libritts-22050Hz

Can I use tts-hifigan-libritts-22050Hz commercially?

Yes. tts-hifigan-libritts-22050Hz is released under Apache License 2.0. The Apache License 2.0 is a permissive open-source license. It permits commercial use, modification and redistribution. It requires keeping the license and copyright notices and any NOTICE file, stating significant changes, and it includes an express patent grant from contributors.

Similar Models

Model · Text to speech

Kokoro-82M

Hexgrad

Kokoro is an open-weight TTS model with 82 million parameters. Despite its lightweight architecture, it delivers comparable quality to larger models while being significantly faster and more cost-efficient. With Apache-licensed weights, Kokoro can be deployed anywhere from production environments to personal projects. You can run this basic cell on Google Colab. Listen to samples. For more languages and details, see Advanced Usage. Under the hood, kokoro uses misaki, a G2P library at https://github.com/hexgrad/misaki Model SHA256 Hash: 496dba118d1a58f5f3db2efc88dbdc216e0483fc89fe6e47ee1f2c53f18ad1e4 Data: Kokoro was trained exclusively on permissive/non-copyrighted audio data and IPA…

Open weights apache-2.0

Model · Text to speech

XTTS-v2

Coqui.ai

ⓍTTS is a Voice generation model that lets you clone voices into different languages by using just a quick 6-second audio clip. There is no need for an excessive amount of training data that spans countless hours. This is the same or similar model to what powers Coqui Studio and Coqui API. - Supports 17 languages. - Voice cloning with just a 6-second audio clip. - Emotion and style transfer by cloning. - Cross-language voice cloning. - Multi-lingual speech generation. - 24khz sampling rate. - 2 new languages; Hungarian and Korean - Architectural improvements for speaker conditioning. - Enables the use of multiple speaker references and interpolation between speakers. - Stability…

Open weights other coqui

Model · Text to speech

audio.cpp-gguf

Audio.cpp

This directory contains audio.cpp-native GGUF conversions of multiple speech models. These files are intended for use with audio.cpp. If you enjoy the project, please star audio.cpp on GitHub and this Hugging Face repository. For conversion details, supported layouts, direct-file loading, sidecar embedding, and the latest compatibility notes, see the audio.cpp GGUF guide: - https://github.com/0xShug0/audio.cpp/blob/main/docs/gguf.md!!! Converted and quantized packages are checked with automated metrics, but perceived quality can still differ for human listeners. Please validate the exact package, backend, and route to confirm the output is acceptable for your use case. The table lists the…

Open weights other audio.cpp

Model · Text to speech

chatterbox

Resemble AI

Chatterbox Multilingual V3 is the latest general-purpose multilingual TTS model in the Chatterbox family. It keeps the same 0.5B model size while improving speaker similarity, reducing hallucinations, and producing more natural, conversational speech across languages. V3 is designed for broad language coverage like V2, but with stronger stability and more expressive generation. It is the recommended multilingual model for users who want one voice cloning model that works across many languages. Try it in the Chatterbox Multilingual TTS V3 Space. Alongside V3, we are releasing the Single Language Pack: dedicated finetunes for priority languages where tighter quality control, stronger…

Open weights mit chatterbox

Model · Text to speech

F5-TTS

Yushen CHEN

Download F5-TTS or E2 TTS and place under ckpts/ Paper: F5-TTS: A Fairytaler that Fakes Fluent and Faithful Speech with Flow Matching

Open weights cc-by-nc-4.0 f5-tts

Model · Text to speech

Kokoro-82M-v1.0-ONNX

ONNX Community

Kokoro is a frontier TTS model for its size of 82 million parameters (text in/audio out). First, install the kokoro-js library from NPM using: You can then generate speech as follows: Optionally, save the audio to a file: The model is resilient to quantization, enabling efficient high-quality speech synthesis at a fraction of the original model size.

Open weights apache-2.0 transformers.js