You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/backend.rst
+71-95Lines changed: 71 additions & 95 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,14 +10,12 @@ Overview
10
10
11
11
There are currently four implementations available.
12
12
13
-
* :ref:`"sox" <sox_backend>` (deprecated, default on Linux/macOS)
14
-
* :ref:`"sox_io" <sox_io_backend>` (default on Linux/macOS from the 0.8.0 release)
15
-
* :ref:`"soundfile" - legacy interface <soundfile_legacy_backend>` (deprecated, default on Windows)
16
-
* :ref:`"soundfile" - new interface<soundfile_backend>` (default on Windows from the 0.8.0 release)
13
+
* :ref:`"sox_io" <sox_io_backend>` (default on Linux/macOS)
14
+
* :ref:`"sox" <sox_backend>` (deprecated, will be removed in 0.9.0 release)
15
+
* :ref:`"soundfile" <soundfile_backend>` (default on Windows)
16
+
* :ref:`"soundfile" (legacy interface) <soundfile_legacy_backend>` (deprecated, will be removed in 0.9.0 release)
17
17
18
-
On Windows, only the ``"soundfile"`` backend (with both interfaces) are available. It is recommended to use the new interface as the legacy interface is deprecated.
19
-
20
-
On Linux/macOS, please use ``"sox_io"`` backend. The use of ``"sox"`` backend is strongly discouraged as it cannot correctly handle formats other than 16-bit integer WAV. See `#726 <https://github.com/pytorch/audio/pull/726>`_ for the detail.
18
+
The use of ``"sox"`` backend is strongly discouraged as it cannot correctly handle formats other than 16-bit integer WAV. See `#726 <https://github.com/pytorch/audio/pull/726>`_ for the detail.
21
19
22
20
.. note::
23
21
Instead of calling functions in ``torchaudio.backend`` directly, please use ``torchaudio.info``, ``torchaudio.load``, ``torchaudio.load_wav`` and ``torchaudio.save`` with proper backend set with :func:`torchaudio.set_audio_backend`.
@@ -32,27 +30,24 @@ Availability
32
30
Changes in default backend and deprecation
33
31
------------------------------------------
34
32
35
-
Backend module is going through a major overhaul. The following table summarizes the timeline for the changes and deprecations.
* The default backend for Linux/macOS will be changed from ``"sox"`` to ``"sox_io"`` in ``0.8.0`` release.
54
-
* The ``"sox"`` backend will be removed in the ``0.9.0`` release.
55
-
* Starting from the 0.8.0 release, ``"soundfile"`` backend will use the new interface, which has the same interface as ``"sox_io"`` backend. The legacy interface will be removed in the ``0.9.0`` release.
33
+
Backend module is going through a major overhaul. The following table summarizes the timeline for the deprecations and removals.
The ``"sox"`` backend is available on Linux/macOS and not available on Windows. This backend is currently the default when available, but is deprecated and will be removed in ``0.9.0`` release.
77
+
The ``"sox_io"`` backend is available and default on Linux/macOS and not available on Windows.
83
78
84
-
You can switch from another backend to ``sox`` backend with the following;
79
+
I/O functions of this backend support `TorchScript <https://pytorch.org/docs/stable/jit.html>`_.
80
+
81
+
You can switch from another backend to the ``sox_io`` backend with the following;
The ``"sox_io"`` backend is available on Linux/macOS and not available on Windows. This backend is recommended over the ``"sox"`` backend, and will become the default in the ``0.8.0`` release.
107
+
Sox Backend (Deprecated)
108
+
~~~~~~~~~~~~~~~~~~~~~~~~
121
109
122
-
I/O functions of this backend support `TorchScript <https://pytorch.org/docs/stable/jit.html>`_.
110
+
The ``"sox"`` backend is available on Linux/macOS and not available on Windows. This backend is deprecated and will be removed in ``0.9.0`` release.
123
111
124
-
You can switch from another backend to the ``sox_io`` backend with the following;
112
+
You can switch from another backend to ``sox`` backend with the following;
The ``"soundfile"`` backend is available when `SoundFile <https://pysoundfile.readthedocs.io/en/latest/>`_ is installed. This backend is the default on Windows.
154
149
155
-
The ``"soundfile"`` backend has two interfaces, legacy and new.
156
-
157
-
* In the ``0.7.0`` release, the legacy interface is used by default when switching to the ``"soundfile"`` backend.
158
-
* In the ``0.8.0`` release, the new interface will become the default.
159
-
* In the ``0.9.0`` release, the legacy interface will be removed.
160
-
161
-
To change the interface, set ``torchaudio.USE_SOUNDFILE_LEGACY_INTERFACE`` flag **before** switching the backend.
150
+
You can switch from another backend to the ``"soundfile"`` backend with the following;
162
151
163
152
.. code::
164
153
165
-
torchaudio.USE_SOUNDFILE_LEGACY_INTERFACE = True
166
-
torchaudio.set_audio_backend("soundfile") # The legacy interface
167
-
168
-
torchaudio.USE_SOUNDFILE_LEGACY_INTERFACE = False
169
-
torchaudio.set_audio_backend("soundfile") # The new interface
170
-
171
-
Legacy Interface (Deprecated)
172
-
-----------------------------
173
-
174
-
``"soundfile"`` backend with legacy interface is currently the default on Windows, however this interface is deprecated and will be removed in the ``0.9.0`` release.
154
+
torchaudio.set_audio_backend("soundfile")
175
155
176
-
To switch to this backend/interface, set ``torchaudio.USE_SOUNDFILE_LEGACY_INTERFACE`` flag **before** switching the backend.
177
-
178
-
.. code::
179
-
180
-
torchaudio.USE_SOUNDFILE_LEGACY_INTERFACE = True
181
-
torchaudio.set_audio_backend("soundfile") # The legacy interface
156
+
.. note::
157
+
If you are switching from `"soundfile" (legacy interface) <soundfile_legacy_backend>` backend, set ``torchaudio.USE_SOUNDFILE_LEGACY_INTERFACE`` flag **before** switching the backend.
The ``"soundfile"`` backend with new interface will become the default in the ``0.8.0`` release.
182
+
``"soundfile"`` backend with legacy interface is made available for backward compatibility reason, however this interface is deprecated and will be removed in the ``0.9.0`` release.
207
183
208
184
To switch to this backend/interface, set ``torchaudio.USE_SOUNDFILE_LEGACY_INTERFACE`` flag **before** switching the backend.
209
185
210
186
.. code::
211
187
212
-
torchaudio.USE_SOUNDFILE_LEGACY_INTERFACE = False
213
-
torchaudio.set_audio_backend("soundfile") # The new interface
188
+
torchaudio.USE_SOUNDFILE_LEGACY_INTERFACE = True
189
+
torchaudio.set_audio_backend("soundfile") # The legacy interface
0 commit comments