Skip to content

Commit

Permalink
[Doc] Add missing modules and minor fixes (pytorch#1022)
Browse files Browse the repository at this point in the history
* Add griffinlim and DB_to_amplitude
* Fix Dataset docstring
* Fix other formatting
Co-authored-by: krishnakalyan3 <skalyan@cloudera.com>
  • Loading branch information
krishnakalyan3 authored Dec 4, 2020
1 parent 09a6fca commit 2a02d7f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/source/datasets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ torchaudio.datasets
====================

All datasets are subclasses of :class:`torch.utils.data.Dataset`
i.e, they have ``__getitem__`` and ``__len__`` methods implemented.
and have ``__getitem__`` and ``__len__`` methods implemented.
Hence, they can all be passed to a :class:`torch.utils.data.DataLoader`
which can load multiple samples parallelly using ``torch.multiprocessing`` workers.
For example: ::
Expand Down
10 changes: 10 additions & 0 deletions docs/source/functional.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,21 @@ vad

.. autofunction:: spectrogram

:hidden:`griffinlim`
~~~~~~~~~~~~~~~~~~~~~~~~~

.. autofunction:: griffinlim

:hidden:`amplitude_to_DB`
~~~~~~~~~~~~~~~~~~~~~~~~~

.. autofunction:: amplitude_to_DB

:hidden:`DB_to_amplitude`
~~~~~~~~~~~~~~~~~~~~~~~~~

.. autofunction:: DB_to_amplitude

:hidden:`create_fb_matrix`
~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
3 changes: 2 additions & 1 deletion torchaudio/functional/filtering.py
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,8 @@ def phaser(
References:
http://sox.sourceforge.net/sox.html
Scott Lehman, Effects Explained, http://harmony-central.com/Effects/effects-explained.html
Scott Lehman, Effects Explained,
https://web.archive.org/web/20051125072557/http://www.harmony-central.com/Effects/effects-explained.html
"""
actual_shape = waveform.shape
device, dtype = waveform.device, waveform.dtype
Expand Down
8 changes: 3 additions & 5 deletions torchaudio/functional/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,14 @@ def griffinlim(
r"""Compute waveform from a linear scale magnitude spectrogram using the Griffin-Lim transformation.
Implementation ported from `librosa`.
.. [1] McFee, Brian, Colin Raffel, Dawen Liang, Daniel PW Ellis, Matt McVicar, Eric Battenberg, and Oriol Nieto.
* [1] McFee, Brian, Colin Raffel, Dawen Liang, Daniel PW Ellis, Matt McVicar, Eric Battenberg, and Oriol Nieto.
"librosa: Audio and music signal analysis in python."
In Proceedings of the 14th python in science conference, pp. 18-25. 2015.
.. [2] Perraudin, N., Balazs, P., & Søndergaard, P. L.
* [2] Perraudin, N., Balazs, P., & Søndergaard, P. L.
"A fast Griffin-Lim algorithm,"
IEEE Workshop on Applications of Signal Processing to Audio and Acoustics (pp. 1-4),
Oct. 2013.
.. [3] D. W. Griffin and J. S. Lim,
* [3] D. W. Griffin and J. S. Lim,
"Signal estimation from modified short-time Fourier transform,"
IEEE Trans. ASSP, vol.32, no.2, pp.236–243, Apr. 1984.
Expand Down
3 changes: 1 addition & 2 deletions torchaudio/sox_effects/sox_effects.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,9 @@ def apply_effects_file(
... super().__init__()
... self.flist = flist
... self.sample_rate = sample_rate
... self.rng = None
...
... def __getitem__(self, index):
... speed = self.rng.uniform(0.5, 2.0)
... speed = 0.5 + 1.5 * torch.rand()
... effects = [
... ['gain', '-n', '-10'], # apply 10 db attenuation
... ['remix', '-'], # merge all the channels
Expand Down
9 changes: 5 additions & 4 deletions torchaudio/utils/sox_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ def set_verbosity(verbosity: int):
Args:
verbosity (int): Set verbosity level of libsox.
1: failure messages
2: warnings
3: details of processing
4-6: increasing levels of debug messages
* ``1`` failure messages
* ``2`` warnings
* ``3`` details of processing
* ``4``-``6`` increasing levels of debug messages
See Also:
http://sox.sourceforge.net/sox.html
Expand Down

0 comments on commit 2a02d7f

Please sign in to comment.