Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multichannel audio convert part in test_nsf_hifigan.py #127

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tests/test_nsf_hifigan.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import soundfile as sf
import torch
import torchaudio

from fish_diffusion.modules.pitch_extractors import ParselMouthPitchExtractor
Expand All @@ -10,6 +11,10 @@

audio, sr = torchaudio.load(source)

# Change the multichannel audio to single channel
if audio.shape[0] > 1:
audio = torch.mean(audio, dim=0, keepdim=True)

mel = gan.wav2spec(audio)
f0 = ParselMouthPitchExtractor(f0_min=40.0, f0_max=2000.0, keep_zeros=False)(
audio, sr, pad_to=mel.shape[-1]
Expand Down
61 changes: 61 additions & 0 deletions tools/nsf_hifigan/config_v1_openvpi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"resblock": "1",
"learning_rate": 0.0002,
"adam_b1": 0.8,
"adam_b2": 0.99,
"lr_decay": 0.999,
"upsample_rates": [
8,
8,
2,
2,
2
],
"upsample_kernel_sizes": [
16,
16,
4,
4,
4
],
"upsample_initial_channel": 512,
"resblock_kernel_sizes": [
3,
7,
11
],
"resblock_dilation_sizes": [
[
1,
3,
5
],
[
1,
3,
5
],
[
1,
3,
5
]
],
"discriminator_periods": [
3,
5,
7,
11,
17,
23,
37
],
"segment_size": 16384,
"num_mels": 128,
"n_fft": 2048,
"hop_size": 512,
"win_size": 2048,
"sampling_rate": 44100,
"fmin": 40,
"fmax": 16000
}
Loading