Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
Torchaudio
Commits
4b5db340
Commit
4b5db340
authored
Oct 12, 2021
by
Caroline Chen
Browse files
Use integer rates in pitch shift resample (#1861)
parent
04e0e2ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
torchaudio/functional/functional.py
torchaudio/functional/functional.py
+2
-2
No files found.
torchaudio/functional/functional.py
View file @
4b5db340
...
...
@@ -1690,7 +1690,7 @@ def pitch_shift(
Args:
waveform (Tensor): The input waveform of shape `(..., time)`.
sample_rate (
floa
t): Sample rate of `waveform`.
sample_rate (
in
t): Sample rate of `waveform`.
n_steps (int): The (fractional) steps to shift `waveform`.
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``).
...
...
@@ -1736,7 +1736,7 @@ def pitch_shift(
win_length
=
win_length
,
window
=
window
,
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
]
if
shift_len
>
ori_len
:
waveform_shift
=
waveform_shift
[...,
:
ori_len
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment