Datasets:

Modalities:
Audio
Text
Size:
< 1K
ArXiv:
Libraries:
Datasets
License:
ASLP-lab's picture
add dataset
c4115a4
# This source code is derived from BigVGAN (https://github.com/NVIDIA/BigVGAN),
# which is licensed under the MIT License.
import torch
import bigvgan
import numpy as np
import torchaudio
device = "cuda"
model = bigvgan.BigVGAN.from_pretrained(
"nvidia/bigvgan_v2_44khz_128band_256x", use_cuda_kernel=False
)
model.remove_weight_norm()
model = model.eval().to(device)
mel = np.load("path/to/input.npy")
mel = torch.FloatTensor(mel).unsqueeze(0).to(device)
with torch.inference_mode():
wav_gen = model(mel)
wav_gen_float = wav_gen.squeeze(0).cpu()
torchaudio.save("path/to/output.wav", wav_gen_float, model.h.sampling_rate)