Skip to content

Commit 1305f57

Browse files
committed
stretch and then resample
1 parent 3ee4177 commit 1305f57

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

torch_pitch_shift/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,13 @@ def pitch_shift(
143143
resampler = T.Resample(sample_rate, int(sample_rate / shift)).to(input.device)
144144
output = input
145145
output = output.reshape(batch_size * channels, samples)
146-
output = resampler(output)
147146
output = torch.stft(output, n_fft)[None, ...]
148147
stretcher = T.TimeStretch(fixed_rate=float(1 / shift), n_freq=output.shape[2]).to(
149148
input.device
150149
)
151150
output = stretcher(output)
152151
output = torch.istft(output[0], n_fft)
152+
output = resampler(output)
153153
del resampler, stretcher
154154
if output.shape[1] >= input.shape[2]:
155155
output = output[:, : (input.shape[2])]

0 commit comments

Comments
 (0)