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
457148ea
Unverified
Commit
457148ea
authored
Feb 26, 2021
by
Vincent QB
Committed by
GitHub
Feb 26, 2021
Browse files
Fixes #1314 (#1316)
parent
49860425
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
8 deletions
+26
-8
docs/source/functional.rst
docs/source/functional.rst
+10
-0
docs/source/transforms.rst
docs/source/transforms.rst
+7
-0
torchaudio/functional/functional.py
torchaudio/functional/functional.py
+9
-8
No files found.
docs/source/functional.rst
View file @
457148ea
...
@@ -208,3 +208,13 @@ vad
...
@@ -208,3 +208,13 @@ vad
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autofunction:: compute_kaldi_pitch
.. autofunction:: compute_kaldi_pitch
:hidden:`spectral_centroid`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autofunction:: spectral_centroid
:hidden:`apply_codec`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autofunction:: apply_codec
docs/source/transforms.rst
View file @
457148ea
...
@@ -136,6 +136,13 @@ Transforms are common audio transforms. They can be chained together using :clas
...
@@ -136,6 +136,13 @@ Transforms are common audio transforms. They can be chained together using :clas
.. automethod:: forward
.. automethod:: forward
:hidden:`SpectralCentroid`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. autoclass:: SpectralCentroid
.. automethod:: forward
:hidden:`Vad`
:hidden:`Vad`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
...
torchaudio/functional/functional.py
View file @
457148ea
...
@@ -1011,24 +1011,25 @@ def apply_codec(
...
@@ -1011,24 +1011,25 @@ def apply_codec(
bits_per_sample
:
Optional
[
int
]
=
None
,
bits_per_sample
:
Optional
[
int
]
=
None
,
)
->
Tensor
:
)
->
Tensor
:
r
"""
r
"""
Applies codecs as a form of augmentation
Apply codecs as a form of augmentation.
Args:
Args:
waveform (Tensor): Audio data. Must be 2 dimensional. See also ```channels_first```
waveform (Tensor): Audio data. Must be 2 dimensional. See also ```channels_first```
.
sample_rate (int): Sample rate of the audio waveform
sample_rate (int): Sample rate of the audio waveform
.
format (str):
f
ile format
format (str):
F
ile format
.
channels_first (bool):
channels_first (bool):
When True, both the input and output Tensor have dimension ``[channel, time]``.
When True, both the input and output Tensor have dimension ``[channel, time]``.
Otherwise, they have dimension ``[time, channel]``.
Otherwise, they have dimension ``[time, channel]``.
compression (float): Used for formats other than WAV.
compression (float): Used for formats other than WAV.
For mor details see :py:func:`torchaudio.backend.sox_io_backend.save`
For mor details see :py:func:`torchaudio.backend.sox_io_backend.save`
.
encoding (str, optional): Changes the encoding for the supported formats.
encoding (str, optional): Changes the encoding for the supported formats.
For more details see :py:func:`torchaudio.backend.sox_io_backend.save`
For more details see :py:func:`torchaudio.backend.sox_io_backend.save`
.
bits_per_sample (int, optional): Changes the bit depth for the supported formats.
bits_per_sample (int, optional): Changes the bit depth for the supported formats.
For more details see :py:func:`torchaudio.backend.sox_io_backend.save`
For more details see :py:func:`torchaudio.backend.sox_io_backend.save`
.
Returns:
Returns:
torch.Tensor: Resulting Tensor.
torch.Tensor: Resulting Tensor.
If ``channels_first=True``, it has ``[channel, time]`` else ``[time, channel]``
If ``channels_first=True``, it has ``[channel, time]`` else ``[time, channel]``
.
"""
"""
bytes
=
io
.
BytesIO
()
bytes
=
io
.
BytesIO
()
torchaudio
.
backend
.
sox_io_backend
.
save
(
bytes
,
torchaudio
.
backend
.
sox_io_backend
.
save
(
bytes
,
...
...
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