Unverified Commit e8ed8f46 authored by Caroline Chen's avatar Caroline Chen Committed by GitHub
Browse files

Use integer rates in pitch shift resample (#1861)

parent e3443b1c
...@@ -1690,7 +1690,7 @@ def pitch_shift( ...@@ -1690,7 +1690,7 @@ def pitch_shift(
Args: Args:
waveform (Tensor): The input waveform of shape `(..., time)`. waveform (Tensor): The input waveform of shape `(..., time)`.
sample_rate (float): Sample rate of `waveform`. sample_rate (int): Sample rate of `waveform`.
n_steps (int): The (fractional) steps to shift `waveform`. n_steps (int): The (fractional) steps to shift `waveform`.
bins_per_octave (int, optional): The number of steps per octave (Default: ``12``). bins_per_octave (int, optional): The number of steps per octave (Default: ``12``).
n_fft (int, optional): Size of FFT, creates ``n_fft // 2 + 1`` bins (Default: ``512``). n_fft (int, optional): Size of FFT, creates ``n_fft // 2 + 1`` bins (Default: ``512``).
...@@ -1736,7 +1736,7 @@ def pitch_shift( ...@@ -1736,7 +1736,7 @@ def pitch_shift(
win_length=win_length, win_length=win_length,
window=window, window=window,
length=len_stretch) length=len_stretch)
waveform_shift = resample(waveform_stretch, sample_rate / rate, float(sample_rate)) waveform_shift = resample(waveform_stretch, sample_rate // rate, float(sample_rate))
shift_len = waveform_shift.size()[-1] shift_len = waveform_shift.size()[-1]
if shift_len > ori_len: if shift_len > ori_len:
waveform_shift = waveform_shift[..., :ori_len] waveform_shift = waveform_shift[..., :ori_len]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment