Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
yxlllc committed Feb 2, 2024
1 parent d686b6d commit ad13f4d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ddsp/vocoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,15 +666,20 @@ def forward(self, units_frames, f0_frames, volume_frames, spk_id=None, spk_mix_d

# combtooth exciter signal
combtooth = torch.sinc(self.sampling_rate * x / (f0 + 1e-3))
combtooth = combtooth.squeeze(-1)
combtooth = combtooth.squeeze(-1)
if combtooth.shape[-1] > self.win_length // 2:
pad_mode = 'reflect'
else:
pad_mode = 'constant'
combtooth_stft = torch.stft(
combtooth,
n_fft = self.win_length,
win_length = self.win_length,
hop_length = self.block_size,
window = self.window,
center = True,
return_complex = True)
return_complex = True,
pad_mode = pad_mode)

# noise exciter signal
noise = torch.randn_like(combtooth)
Expand All @@ -685,7 +690,8 @@ def forward(self, units_frames, f0_frames, volume_frames, spk_id=None, spk_mix_d
hop_length = self.block_size,
window = self.window,
center = True,
return_complex = True)
return_complex = True,
pad_mode = pad_mode)

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

0 comments on commit ad13f4d

Please sign in to comment.