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
e8ed8f46
Unverified
Commit
e8ed8f46
authored
Oct 12, 2021
by
Caroline Chen
Committed by
GitHub
Oct 12, 2021
Browse files
Use integer rates in pitch shift resample (#1861)
parent
e3443b1c
Changes
1
Show 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 @
e8ed8f46
...
@@ -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 (
floa
t): Sample rate of `waveform`.
sample_rate (
in
t): 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
]
...
...
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