Skip to content

Commit

Permalink
Expose AudioMetadata
Browse files Browse the repository at this point in the history
``torchaudio.info`` returns ``AudioMetaData``. It should be exposed as public API.
  • Loading branch information
mthrok committed Aug 11, 2023
1 parent 9bd7ca5 commit ab59352
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/source/backend.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Structures used to report the metadata of audio files.
AudioMetaData
-------------

.. autoclass:: torchaudio.backend.common.AudioMetaData
.. autoclass:: torchaudio.AudioMetaData

.. py:module:: torchaudio.backend.sox_io_backend
Expand Down
5 changes: 4 additions & 1 deletion torchaudio/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from torchaudio import ( # noqa: F401
from . import ( # noqa: F401
_extension,
compliance,
datasets,
Expand All @@ -11,6 +11,8 @@
transforms,
utils,
)
from .backend.common import AudioMetaData


try:
from .version import __version__, git_version # noqa: F401
Expand All @@ -34,6 +36,7 @@ def _is_backend_dispatcher_enabled():


__all__ = [
"AudioMetaData",
"io",
"compliance",
"datasets",
Expand Down
5 changes: 2 additions & 3 deletions torchaudio/backend/common.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
class AudioMetaData:
"""Return type of ``torchaudio.info`` function.
"""AudioMetaData()
This class is used by :py:mod:`"sox_io" backend<torchaudio.backends.sox_io_backend>` and
:py:mod:`"soundfile" backend<torchaudio.backends.soundfile_backend>`.
Return type of ``torchaudio.info`` function.
:ivar int sample_rate: Sample rate
:ivar int num_frames: The number of frames
Expand Down

0 comments on commit ab59352

Please sign in to comment.