Skip to content

Commit ad13f4d

Browse files
committed
fix bug
1 parent d686b6d commit ad13f4d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

ddsp/vocoder.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -666,15 +666,20 @@ def forward(self, units_frames, f0_frames, volume_frames, spk_id=None, spk_mix_d
666666

667667
# combtooth exciter signal
668668
combtooth = torch.sinc(self.sampling_rate * x / (f0 + 1e-3))
669-
combtooth = combtooth.squeeze(-1)
669+
combtooth = combtooth.squeeze(-1)
670+
if combtooth.shape[-1] > self.win_length // 2:
671+
pad_mode = 'reflect'
672+
else:
673+
pad_mode = 'constant'
670674
combtooth_stft = torch.stft(
671675
combtooth,
672676
n_fft = self.win_length,
673677
win_length = self.win_length,
674678
hop_length = self.block_size,
675679
window = self.window,
676680
center = True,
677-
return_complex = True)
681+
return_complex = True,
682+
pad_mode = pad_mode)
678683

679684
# noise exciter signal
680685
noise = torch.randn_like(combtooth)
@@ -685,7 +690,8 @@ def forward(self, units_frames, f0_frames, volume_frames, spk_id=None, spk_mix_d
685690
hop_length = self.block_size,
686691
window = self.window,
687692
center = True,
688-
return_complex = True)
693+
return_complex = True,
694+
pad_mode = pad_mode)
689695

690696
# apply the filters
691697
signal_stft = combtooth_stft * src_filter.permute(0, 2, 1) + noise_stft * noise_filter.permute(0, 2, 1)

0 commit comments

Comments
 (0)