Datasets:

Modalities:
Audio
Text
Size:
< 1K
ArXiv:
Libraries:
Datasets
License:
File size: 638 Bytes
c4115a4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 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)