.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "tutorials/effector_tutorial.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_tutorials_effector_tutorial.py: AudioEffector Usages ==================== **Author**: `Moto Hira `__ .. warning:: Starting with version 2.8, we are refactoring TorchAudio to transition it into a maintenance phase. As a result: - The APIs described in this tutorial are deprecated in 2.8 and will be removed in 2.9. - The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. This tutorial shows how to use :py:class:`torchaudio.io.AudioEffector` to apply various effects and codecs to waveform tensor. .. GENERATED FROM PYTHON SOURCE LINES 23-29 .. note:: This tutorial requires FFmpeg libraries. Please refer to :ref:`FFmpeg dependency ` for the detail. .. GENERATED FROM PYTHON SOURCE LINES 32-44 Overview -------- :py:class:`~torchaudio.io.AudioEffector` combines in-memory encoding, decoding and filtering that are provided by :py:class:`~torchaudio.io.StreamWriter` and :py:class:`~torchaudio.io.StreamReader`. The following figure illustrates the process. .. image:: https://download.pytorch.org/torchaudio/tutorial-assets/AudioEffector.png .. GENERATED FROM PYTHON SOURCE LINES 44-50 .. code-block:: default import torch import torchaudio print(torch.__version__) print(torchaudio.__version__) .. rst-class:: sphx-glr-script-out .. code-block:: none 2.8.0+cu126 2.8.0 .. GENERATED FROM PYTHON SOURCE LINES 52-57 .. code-block:: default from torchaudio.io import AudioEffector, CodecConfig import matplotlib.pyplot as plt from IPython.display import Audio .. GENERATED FROM PYTHON SOURCE LINES 59-62 .. code-block:: default for k, v in torchaudio.utils.ffmpeg_utils.get_versions().items(): print(k, v) .. rst-class:: sphx-glr-script-out .. code-block:: none /pytorch/audio/examples/tutorials/effector_tutorial.py:59: UserWarning: torio.utils.ffmpeg_utils.get_versions has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. for k, v in torchaudio.utils.ffmpeg_utils.get_versions().items(): libavcodec (60, 3, 100) libavdevice (60, 1, 100) libavfilter (9, 3, 100) libavformat (60, 3, 100) libavutil (58, 2, 100) .. GENERATED FROM PYTHON SOURCE LINES 63-88 Usage ----- To use ``AudioEffector``, instantiate it with ``effect`` and ``format``, then either pass the waveform to :py:meth:`~torchaudio.io.AudioEffector.apply` or :py:meth:`~torchaudio.io.AudioEffector.stream` method. .. code:: python effector = AudioEffector(effect=..., format=...,) # Apply at once applied = effector.apply(waveform, sample_rate) ``apply`` method applies effect and codec to the entire waveform at once. So if the input waveform is long, and memory consumption is an issue, one can use ``stream`` method to process chunk by chunk. .. code:: python # Apply chunk by chunk for applied_chunk = effector.stream(waveform, sample_rate): ... .. GENERATED FROM PYTHON SOURCE LINES 90-93 Example ------- .. GENERATED FROM PYTHON SOURCE LINES 93-98 .. code-block:: default src = torchaudio.utils.download_asset("tutorial-assets/Lab41-SRI-VOiCES-src-sp0307-ch127535-sg0042.wav") waveform, sr = torchaudio.load(src, channels_first=False) .. rst-class:: sphx-glr-script-out .. code-block:: none /pytorch/audio/examples/tutorials/effector_tutorial.py:94: UserWarning: torchaudio.utils.download.download_asset has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. src = torchaudio.utils.download_asset("tutorial-assets/Lab41-SRI-VOiCES-src-sp0307-ch127535-sg0042.wav") /pytorch/audio/src/torchaudio/_backend/utils.py:213: UserWarning: In 2.9, this function's implementation will be changed to use torchaudio.load_with_torchcodec` under the hood. Some parameters like ``normalize``, ``format``, ``buffer_size``, and ``backend`` will be ignored. We recommend that you port your code to rely directly on TorchCodec's decoder instead: https://docs.pytorch.org/torchcodec/stable/generated/torchcodec.decoders.AudioDecoder.html#torchcodec.decoders.AudioDecoder. warnings.warn( /pytorch/audio/src/torchaudio/_backend/ffmpeg.py:88: UserWarning: torio.io._streaming_media_decoder.StreamingMediaDecoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. s = torchaudio.io.StreamReader(src, format, None, buffer_size) .. GENERATED FROM PYTHON SOURCE LINES 99-102 Gallery ------- .. GENERATED FROM PYTHON SOURCE LINES 102-120 .. code-block:: default def show(effect, *, stereo=False): wf = torch.cat([waveform] * 2, dim=1) if stereo else waveform figsize = (6.4, 2.1 if stereo else 1.2) effector = AudioEffector(effect=effect, pad_end=False) result = effector.apply(wf, int(sr)) num_channels = result.size(1) f, ax = plt.subplots(num_channels, 1, squeeze=False, figsize=figsize, sharex=True) for i in range(num_channels): ax[i][0].specgram(result[:, i], Fs=sr) f.set_tight_layout(True) return Audio(result.numpy().T, rate=sr) .. GENERATED FROM PYTHON SOURCE LINES 121-124 Original -------- .. GENERATED FROM PYTHON SOURCE LINES 124-127 .. code-block:: default show(effect=None) .. image-sg:: /tutorials/images/sphx_glr_effector_tutorial_001.png :alt: effector tutorial :srcset: /tutorials/images/sphx_glr_effector_tutorial_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /pytorch/audio/examples/tutorials/effector_tutorial.py:108: UserWarning: torchaudio.io._effector.AudioEffector has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. effector = AudioEffector(effect=effect, pad_end=False) /pytorch/audio/src/torchaudio/io/_effector.py:98: UserWarning: torio.io._streaming_media_encoder.StreamingMediaEncoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. writer = StreamWriter(buffer, format=muxer) /pytorch/audio/src/torchaudio/io/_effector.py:286: UserWarning: torio.io._streaming_media_decoder.StreamingMediaDecoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. reader = StreamReader(src, format=muxer, option=option) .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 128-131 Effects ------- .. GENERATED FROM PYTHON SOURCE LINES 133-136 tempo ~~~~~ https://ffmpeg.org/ffmpeg-filters.html#atempo .. GENERATED FROM PYTHON SOURCE LINES 136-138 .. code-block:: default show("atempo=0.7") .. image-sg:: /tutorials/images/sphx_glr_effector_tutorial_002.png :alt: effector tutorial :srcset: /tutorials/images/sphx_glr_effector_tutorial_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /pytorch/audio/examples/tutorials/effector_tutorial.py:108: UserWarning: torchaudio.io._effector.AudioEffector has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. effector = AudioEffector(effect=effect, pad_end=False) /pytorch/audio/src/torchaudio/io/_effector.py:98: UserWarning: torio.io._streaming_media_encoder.StreamingMediaEncoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. writer = StreamWriter(buffer, format=muxer) /pytorch/audio/src/torchaudio/io/_effector.py:286: UserWarning: torio.io._streaming_media_decoder.StreamingMediaDecoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. reader = StreamReader(src, format=muxer, option=option) .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 140-142 .. code-block:: default show("atempo=1.8") .. image-sg:: /tutorials/images/sphx_glr_effector_tutorial_003.png :alt: effector tutorial :srcset: /tutorials/images/sphx_glr_effector_tutorial_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /pytorch/audio/examples/tutorials/effector_tutorial.py:108: UserWarning: torchaudio.io._effector.AudioEffector has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. effector = AudioEffector(effect=effect, pad_end=False) /pytorch/audio/src/torchaudio/io/_effector.py:98: UserWarning: torio.io._streaming_media_encoder.StreamingMediaEncoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. writer = StreamWriter(buffer, format=muxer) /pytorch/audio/src/torchaudio/io/_effector.py:286: UserWarning: torio.io._streaming_media_decoder.StreamingMediaDecoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. reader = StreamReader(src, format=muxer, option=option) .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 143-146 highpass ~~~~~~~~ https://ffmpeg.org/ffmpeg-filters.html#highpass .. GENERATED FROM PYTHON SOURCE LINES 146-148 .. code-block:: default show("highpass=frequency=1500") .. image-sg:: /tutorials/images/sphx_glr_effector_tutorial_004.png :alt: effector tutorial :srcset: /tutorials/images/sphx_glr_effector_tutorial_004.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /pytorch/audio/examples/tutorials/effector_tutorial.py:108: UserWarning: torchaudio.io._effector.AudioEffector has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. effector = AudioEffector(effect=effect, pad_end=False) /pytorch/audio/src/torchaudio/io/_effector.py:98: UserWarning: torio.io._streaming_media_encoder.StreamingMediaEncoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. writer = StreamWriter(buffer, format=muxer) /pytorch/audio/src/torchaudio/io/_effector.py:286: UserWarning: torio.io._streaming_media_decoder.StreamingMediaDecoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. reader = StreamReader(src, format=muxer, option=option) .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 149-152 lowpass ~~~~~~~ https://ffmpeg.org/ffmpeg-filters.html#lowpass .. GENERATED FROM PYTHON SOURCE LINES 152-154 .. code-block:: default show("lowpass=frequency=1000") .. image-sg:: /tutorials/images/sphx_glr_effector_tutorial_005.png :alt: effector tutorial :srcset: /tutorials/images/sphx_glr_effector_tutorial_005.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /pytorch/audio/examples/tutorials/effector_tutorial.py:108: UserWarning: torchaudio.io._effector.AudioEffector has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. effector = AudioEffector(effect=effect, pad_end=False) /pytorch/audio/src/torchaudio/io/_effector.py:98: UserWarning: torio.io._streaming_media_encoder.StreamingMediaEncoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. writer = StreamWriter(buffer, format=muxer) /pytorch/audio/src/torchaudio/io/_effector.py:286: UserWarning: torio.io._streaming_media_decoder.StreamingMediaDecoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. reader = StreamReader(src, format=muxer, option=option) .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 155-158 allpass ~~~~~~~~ https://ffmpeg.org/ffmpeg-filters.html#allpass .. GENERATED FROM PYTHON SOURCE LINES 158-160 .. code-block:: default show("allpass") .. image-sg:: /tutorials/images/sphx_glr_effector_tutorial_006.png :alt: effector tutorial :srcset: /tutorials/images/sphx_glr_effector_tutorial_006.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /pytorch/audio/examples/tutorials/effector_tutorial.py:108: UserWarning: torchaudio.io._effector.AudioEffector has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. effector = AudioEffector(effect=effect, pad_end=False) /pytorch/audio/src/torchaudio/io/_effector.py:98: UserWarning: torio.io._streaming_media_encoder.StreamingMediaEncoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. writer = StreamWriter(buffer, format=muxer) /pytorch/audio/src/torchaudio/io/_effector.py:286: UserWarning: torio.io._streaming_media_decoder.StreamingMediaDecoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. reader = StreamReader(src, format=muxer, option=option) .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 161-164 bandpass ~~~~~~~~ https://ffmpeg.org/ffmpeg-filters.html#bandpass .. GENERATED FROM PYTHON SOURCE LINES 164-166 .. code-block:: default show("bandpass=frequency=3000") .. image-sg:: /tutorials/images/sphx_glr_effector_tutorial_007.png :alt: effector tutorial :srcset: /tutorials/images/sphx_glr_effector_tutorial_007.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /pytorch/audio/examples/tutorials/effector_tutorial.py:108: UserWarning: torchaudio.io._effector.AudioEffector has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. effector = AudioEffector(effect=effect, pad_end=False) /pytorch/audio/src/torchaudio/io/_effector.py:98: UserWarning: torio.io._streaming_media_encoder.StreamingMediaEncoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. writer = StreamWriter(buffer, format=muxer) /pytorch/audio/src/torchaudio/io/_effector.py:286: UserWarning: torio.io._streaming_media_decoder.StreamingMediaDecoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. reader = StreamReader(src, format=muxer, option=option) .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 167-170 bandreject ~~~~~~~~~~ https://ffmpeg.org/ffmpeg-filters.html#bandreject .. GENERATED FROM PYTHON SOURCE LINES 170-172 .. code-block:: default show("bandreject=frequency=3000") .. image-sg:: /tutorials/images/sphx_glr_effector_tutorial_008.png :alt: effector tutorial :srcset: /tutorials/images/sphx_glr_effector_tutorial_008.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /pytorch/audio/examples/tutorials/effector_tutorial.py:108: UserWarning: torchaudio.io._effector.AudioEffector has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. effector = AudioEffector(effect=effect, pad_end=False) /pytorch/audio/src/torchaudio/io/_effector.py:98: UserWarning: torio.io._streaming_media_encoder.StreamingMediaEncoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. writer = StreamWriter(buffer, format=muxer) /pytorch/audio/src/torchaudio/io/_effector.py:286: UserWarning: torio.io._streaming_media_decoder.StreamingMediaDecoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. reader = StreamReader(src, format=muxer, option=option) .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 173-176 echo ~~~~ https://ffmpeg.org/ffmpeg-filters.html#aecho .. GENERATED FROM PYTHON SOURCE LINES 176-178 .. code-block:: default show("aecho=in_gain=0.8:out_gain=0.88:delays=6:decays=0.4") .. image-sg:: /tutorials/images/sphx_glr_effector_tutorial_009.png :alt: effector tutorial :srcset: /tutorials/images/sphx_glr_effector_tutorial_009.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /pytorch/audio/examples/tutorials/effector_tutorial.py:108: UserWarning: torchaudio.io._effector.AudioEffector has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. effector = AudioEffector(effect=effect, pad_end=False) /pytorch/audio/src/torchaudio/io/_effector.py:98: UserWarning: torio.io._streaming_media_encoder.StreamingMediaEncoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. writer = StreamWriter(buffer, format=muxer) /pytorch/audio/src/torchaudio/io/_effector.py:286: UserWarning: torio.io._streaming_media_decoder.StreamingMediaDecoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. reader = StreamReader(src, format=muxer, option=option) .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 180-182 .. code-block:: default show("aecho=in_gain=0.8:out_gain=0.88:delays=60:decays=0.4") .. image-sg:: /tutorials/images/sphx_glr_effector_tutorial_010.png :alt: effector tutorial :srcset: /tutorials/images/sphx_glr_effector_tutorial_010.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /pytorch/audio/examples/tutorials/effector_tutorial.py:108: UserWarning: torchaudio.io._effector.AudioEffector has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. effector = AudioEffector(effect=effect, pad_end=False) /pytorch/audio/src/torchaudio/io/_effector.py:98: UserWarning: torio.io._streaming_media_encoder.StreamingMediaEncoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. writer = StreamWriter(buffer, format=muxer) /pytorch/audio/src/torchaudio/io/_effector.py:286: UserWarning: torio.io._streaming_media_decoder.StreamingMediaDecoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. reader = StreamReader(src, format=muxer, option=option) .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 184-186 .. code-block:: default show("aecho=in_gain=0.8:out_gain=0.9:delays=1000:decays=0.3") .. image-sg:: /tutorials/images/sphx_glr_effector_tutorial_011.png :alt: effector tutorial :srcset: /tutorials/images/sphx_glr_effector_tutorial_011.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /pytorch/audio/examples/tutorials/effector_tutorial.py:108: UserWarning: torchaudio.io._effector.AudioEffector has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. effector = AudioEffector(effect=effect, pad_end=False) /pytorch/audio/src/torchaudio/io/_effector.py:98: UserWarning: torio.io._streaming_media_encoder.StreamingMediaEncoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. writer = StreamWriter(buffer, format=muxer) /pytorch/audio/src/torchaudio/io/_effector.py:286: UserWarning: torio.io._streaming_media_decoder.StreamingMediaDecoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. reader = StreamReader(src, format=muxer, option=option) .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 187-190 chorus ~~~~~~ https://ffmpeg.org/ffmpeg-filters.html#chorus .. GENERATED FROM PYTHON SOURCE LINES 190-192 .. code-block:: default show("chorus=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3") .. image-sg:: /tutorials/images/sphx_glr_effector_tutorial_012.png :alt: effector tutorial :srcset: /tutorials/images/sphx_glr_effector_tutorial_012.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /pytorch/audio/examples/tutorials/effector_tutorial.py:108: UserWarning: torchaudio.io._effector.AudioEffector has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. effector = AudioEffector(effect=effect, pad_end=False) /pytorch/audio/src/torchaudio/io/_effector.py:98: UserWarning: torio.io._streaming_media_encoder.StreamingMediaEncoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. writer = StreamWriter(buffer, format=muxer) /pytorch/audio/src/torchaudio/io/_effector.py:286: UserWarning: torio.io._streaming_media_decoder.StreamingMediaDecoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. reader = StreamReader(src, format=muxer, option=option) .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 193-196 fft filter ~~~~~~~~~~ https://ffmpeg.org/ffmpeg-filters.html#afftfilt .. GENERATED FROM PYTHON SOURCE LINES 196-204 .. code-block:: default # fmt: off show( "afftfilt=" "real='re * (1-clip(b * (b/nb), 0, 1))':" "imag='im * (1-clip(b * (b/nb), 0, 1))'" ) .. image-sg:: /tutorials/images/sphx_glr_effector_tutorial_013.png :alt: effector tutorial :srcset: /tutorials/images/sphx_glr_effector_tutorial_013.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /pytorch/audio/examples/tutorials/effector_tutorial.py:108: UserWarning: torchaudio.io._effector.AudioEffector has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. effector = AudioEffector(effect=effect, pad_end=False) /pytorch/audio/src/torchaudio/io/_effector.py:98: UserWarning: torio.io._streaming_media_encoder.StreamingMediaEncoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. writer = StreamWriter(buffer, format=muxer) /pytorch/audio/src/torchaudio/io/_effector.py:286: UserWarning: torio.io._streaming_media_decoder.StreamingMediaDecoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. reader = StreamReader(src, format=muxer, option=option) .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 206-215 .. code-block:: default show( "afftfilt=" "real='hypot(re,im) * sin(0)':" "imag='hypot(re,im) * cos(0)':" "win_size=512:" "overlap=0.75" ) .. image-sg:: /tutorials/images/sphx_glr_effector_tutorial_014.png :alt: effector tutorial :srcset: /tutorials/images/sphx_glr_effector_tutorial_014.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /pytorch/audio/examples/tutorials/effector_tutorial.py:108: UserWarning: torchaudio.io._effector.AudioEffector has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. effector = AudioEffector(effect=effect, pad_end=False) /pytorch/audio/src/torchaudio/io/_effector.py:98: UserWarning: torio.io._streaming_media_encoder.StreamingMediaEncoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. writer = StreamWriter(buffer, format=muxer) /pytorch/audio/src/torchaudio/io/_effector.py:286: UserWarning: torio.io._streaming_media_decoder.StreamingMediaDecoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. reader = StreamReader(src, format=muxer, option=option) .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 217-227 .. code-block:: default show( "afftfilt=" "real='hypot(re,im) * cos(2 * 3.14 * (random(0) * 2-1))':" "imag='hypot(re,im) * sin(2 * 3.14 * (random(1) * 2-1))':" "win_size=128:" "overlap=0.8" ) # fmt: on .. image-sg:: /tutorials/images/sphx_glr_effector_tutorial_015.png :alt: effector tutorial :srcset: /tutorials/images/sphx_glr_effector_tutorial_015.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /pytorch/audio/examples/tutorials/effector_tutorial.py:108: UserWarning: torchaudio.io._effector.AudioEffector has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. effector = AudioEffector(effect=effect, pad_end=False) /pytorch/audio/src/torchaudio/io/_effector.py:98: UserWarning: torio.io._streaming_media_encoder.StreamingMediaEncoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. writer = StreamWriter(buffer, format=muxer) /pytorch/audio/src/torchaudio/io/_effector.py:286: UserWarning: torio.io._streaming_media_decoder.StreamingMediaDecoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. reader = StreamReader(src, format=muxer, option=option) .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 228-231 vibrato ~~~~~~~ https://ffmpeg.org/ffmpeg-filters.html#vibrato .. GENERATED FROM PYTHON SOURCE LINES 231-233 .. code-block:: default show("vibrato=f=10:d=0.8") .. image-sg:: /tutorials/images/sphx_glr_effector_tutorial_016.png :alt: effector tutorial :srcset: /tutorials/images/sphx_glr_effector_tutorial_016.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /pytorch/audio/examples/tutorials/effector_tutorial.py:108: UserWarning: torchaudio.io._effector.AudioEffector has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. effector = AudioEffector(effect=effect, pad_end=False) /pytorch/audio/src/torchaudio/io/_effector.py:98: UserWarning: torio.io._streaming_media_encoder.StreamingMediaEncoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. writer = StreamWriter(buffer, format=muxer) /pytorch/audio/src/torchaudio/io/_effector.py:286: UserWarning: torio.io._streaming_media_decoder.StreamingMediaDecoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. reader = StreamReader(src, format=muxer, option=option) /pytorch/audio/ci_env/lib/python3.10/site-packages/IPython/lib/display.py:188: RuntimeWarning: invalid value encountered in cast return scaled.astype("

.. GENERATED FROM PYTHON SOURCE LINES 234-237 tremolo ~~~~~~~ https://ffmpeg.org/ffmpeg-filters.html#tremolo .. GENERATED FROM PYTHON SOURCE LINES 237-239 .. code-block:: default show("tremolo=f=8:d=0.8") .. image-sg:: /tutorials/images/sphx_glr_effector_tutorial_017.png :alt: effector tutorial :srcset: /tutorials/images/sphx_glr_effector_tutorial_017.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /pytorch/audio/examples/tutorials/effector_tutorial.py:108: UserWarning: torchaudio.io._effector.AudioEffector has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. effector = AudioEffector(effect=effect, pad_end=False) /pytorch/audio/src/torchaudio/io/_effector.py:98: UserWarning: torio.io._streaming_media_encoder.StreamingMediaEncoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. writer = StreamWriter(buffer, format=muxer) /pytorch/audio/src/torchaudio/io/_effector.py:286: UserWarning: torio.io._streaming_media_decoder.StreamingMediaDecoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. reader = StreamReader(src, format=muxer, option=option) .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 240-243 crystalizer ~~~~~~~~~~~ https://ffmpeg.org/ffmpeg-filters.html#crystalizer .. GENERATED FROM PYTHON SOURCE LINES 243-245 .. code-block:: default show("crystalizer") .. image-sg:: /tutorials/images/sphx_glr_effector_tutorial_018.png :alt: effector tutorial :srcset: /tutorials/images/sphx_glr_effector_tutorial_018.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /pytorch/audio/examples/tutorials/effector_tutorial.py:108: UserWarning: torchaudio.io._effector.AudioEffector has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. effector = AudioEffector(effect=effect, pad_end=False) /pytorch/audio/src/torchaudio/io/_effector.py:98: UserWarning: torio.io._streaming_media_encoder.StreamingMediaEncoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. writer = StreamWriter(buffer, format=muxer) /pytorch/audio/src/torchaudio/io/_effector.py:286: UserWarning: torio.io._streaming_media_decoder.StreamingMediaDecoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. reader = StreamReader(src, format=muxer, option=option) .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 246-249 flanger ~~~~~~~ https://ffmpeg.org/ffmpeg-filters.html#flanger .. GENERATED FROM PYTHON SOURCE LINES 249-251 .. code-block:: default show("flanger") .. image-sg:: /tutorials/images/sphx_glr_effector_tutorial_019.png :alt: effector tutorial :srcset: /tutorials/images/sphx_glr_effector_tutorial_019.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /pytorch/audio/examples/tutorials/effector_tutorial.py:108: UserWarning: torchaudio.io._effector.AudioEffector has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. effector = AudioEffector(effect=effect, pad_end=False) /pytorch/audio/src/torchaudio/io/_effector.py:98: UserWarning: torio.io._streaming_media_encoder.StreamingMediaEncoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. writer = StreamWriter(buffer, format=muxer) /pytorch/audio/src/torchaudio/io/_effector.py:286: UserWarning: torio.io._streaming_media_decoder.StreamingMediaDecoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. reader = StreamReader(src, format=muxer, option=option) .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 252-255 phaser ~~~~~~ https://ffmpeg.org/ffmpeg-filters.html#aphaser .. GENERATED FROM PYTHON SOURCE LINES 255-257 .. code-block:: default show("aphaser") .. image-sg:: /tutorials/images/sphx_glr_effector_tutorial_020.png :alt: effector tutorial :srcset: /tutorials/images/sphx_glr_effector_tutorial_020.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /pytorch/audio/examples/tutorials/effector_tutorial.py:108: UserWarning: torchaudio.io._effector.AudioEffector has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. effector = AudioEffector(effect=effect, pad_end=False) /pytorch/audio/src/torchaudio/io/_effector.py:98: UserWarning: torio.io._streaming_media_encoder.StreamingMediaEncoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. writer = StreamWriter(buffer, format=muxer) /pytorch/audio/src/torchaudio/io/_effector.py:286: UserWarning: torio.io._streaming_media_decoder.StreamingMediaDecoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. reader = StreamReader(src, format=muxer, option=option) .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 258-261 pulsator ~~~~~~~~ https://ffmpeg.org/ffmpeg-filters.html#apulsator .. GENERATED FROM PYTHON SOURCE LINES 261-263 .. code-block:: default show("apulsator", stereo=True) .. image-sg:: /tutorials/images/sphx_glr_effector_tutorial_021.png :alt: effector tutorial :srcset: /tutorials/images/sphx_glr_effector_tutorial_021.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /pytorch/audio/examples/tutorials/effector_tutorial.py:108: UserWarning: torchaudio.io._effector.AudioEffector has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. effector = AudioEffector(effect=effect, pad_end=False) /pytorch/audio/src/torchaudio/io/_effector.py:98: UserWarning: torio.io._streaming_media_encoder.StreamingMediaEncoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. writer = StreamWriter(buffer, format=muxer) /pytorch/audio/src/torchaudio/io/_effector.py:286: UserWarning: torio.io._streaming_media_decoder.StreamingMediaDecoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. reader = StreamReader(src, format=muxer, option=option) .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 264-267 haas ~~~~ https://ffmpeg.org/ffmpeg-filters.html#haas .. GENERATED FROM PYTHON SOURCE LINES 267-269 .. code-block:: default show("haas") .. image-sg:: /tutorials/images/sphx_glr_effector_tutorial_022.png :alt: effector tutorial :srcset: /tutorials/images/sphx_glr_effector_tutorial_022.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /pytorch/audio/examples/tutorials/effector_tutorial.py:108: UserWarning: torchaudio.io._effector.AudioEffector has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. effector = AudioEffector(effect=effect, pad_end=False) /pytorch/audio/src/torchaudio/io/_effector.py:98: UserWarning: torio.io._streaming_media_encoder.StreamingMediaEncoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. writer = StreamWriter(buffer, format=muxer) /pytorch/audio/src/torchaudio/io/_effector.py:286: UserWarning: torio.io._streaming_media_decoder.StreamingMediaDecoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. reader = StreamReader(src, format=muxer, option=option) .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 270-273 Codecs ------ .. GENERATED FROM PYTHON SOURCE LINES 273-291 .. code-block:: default def show_multi(configs): results = [] for config in configs: effector = AudioEffector(**config) results.append(effector.apply(waveform, int(sr))) num_configs = len(configs) figsize = (6.4, 0.3 + num_configs * 0.9) f, axes = plt.subplots(num_configs, 1, figsize=figsize, sharex=True) for result, ax in zip(results, axes): ax.specgram(result[:, 0], Fs=sr) f.set_tight_layout(True) return [Audio(r.numpy().T, rate=sr) for r in results] .. GENERATED FROM PYTHON SOURCE LINES 292-295 ogg ~~~ .. GENERATED FROM PYTHON SOURCE LINES 295-304 .. code-block:: default results = show_multi( [ {"format": "ogg"}, {"format": "ogg", "encoder": "vorbis"}, {"format": "ogg", "encoder": "opus"}, ] ) .. image-sg:: /tutorials/images/sphx_glr_effector_tutorial_023.png :alt: effector tutorial :srcset: /tutorials/images/sphx_glr_effector_tutorial_023.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /pytorch/audio/examples/tutorials/effector_tutorial.py:278: UserWarning: torchaudio.io._effector.AudioEffector has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. effector = AudioEffector(**config) /pytorch/audio/src/torchaudio/io/_effector.py:98: UserWarning: torio.io._streaming_media_encoder.StreamingMediaEncoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. writer = StreamWriter(buffer, format=muxer) /pytorch/audio/src/torchaudio/io/_effector.py:286: UserWarning: torio.io._streaming_media_decoder.StreamingMediaDecoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. reader = StreamReader(src, format=muxer, option=option) .. GENERATED FROM PYTHON SOURCE LINES 305-308 ogg - default encoder (flac) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. GENERATED FROM PYTHON SOURCE LINES 308-310 .. code-block:: default results[0] .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 311-314 ogg - vorbis ^^^^^^^^^^^^ .. GENERATED FROM PYTHON SOURCE LINES 314-316 .. code-block:: default results[1] .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 317-320 ogg - opus ^^^^^^^^^^ .. GENERATED FROM PYTHON SOURCE LINES 320-322 .. code-block:: default results[2] .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 323-326 mp3 ~~~ https://trac.ffmpeg.org/wiki/Encode/MP3 .. GENERATED FROM PYTHON SOURCE LINES 326-339 .. code-block:: default results = show_multi( [ {"format": "mp3"}, {"format": "mp3", "codec_config": CodecConfig(compression_level=1)}, {"format": "mp3", "codec_config": CodecConfig(compression_level=9)}, {"format": "mp3", "codec_config": CodecConfig(bit_rate=192_000)}, {"format": "mp3", "codec_config": CodecConfig(bit_rate=8_000)}, {"format": "mp3", "codec_config": CodecConfig(qscale=9)}, {"format": "mp3", "codec_config": CodecConfig(qscale=1)}, ] ) .. image-sg:: /tutorials/images/sphx_glr_effector_tutorial_024.png :alt: effector tutorial :srcset: /tutorials/images/sphx_glr_effector_tutorial_024.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /pytorch/audio/examples/tutorials/effector_tutorial.py:330: UserWarning: torio.io._streaming_media_encoder.CodecConfig has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. {"format": "mp3", "codec_config": CodecConfig(compression_level=1)}, /pytorch/audio/examples/tutorials/effector_tutorial.py:331: UserWarning: torio.io._streaming_media_encoder.CodecConfig has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. {"format": "mp3", "codec_config": CodecConfig(compression_level=9)}, /pytorch/audio/examples/tutorials/effector_tutorial.py:332: UserWarning: torio.io._streaming_media_encoder.CodecConfig has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. {"format": "mp3", "codec_config": CodecConfig(bit_rate=192_000)}, /pytorch/audio/examples/tutorials/effector_tutorial.py:333: UserWarning: torio.io._streaming_media_encoder.CodecConfig has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. {"format": "mp3", "codec_config": CodecConfig(bit_rate=8_000)}, /pytorch/audio/examples/tutorials/effector_tutorial.py:334: UserWarning: torio.io._streaming_media_encoder.CodecConfig has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. {"format": "mp3", "codec_config": CodecConfig(qscale=9)}, /pytorch/audio/examples/tutorials/effector_tutorial.py:335: UserWarning: torio.io._streaming_media_encoder.CodecConfig has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. {"format": "mp3", "codec_config": CodecConfig(qscale=1)}, /pytorch/audio/examples/tutorials/effector_tutorial.py:278: UserWarning: torchaudio.io._effector.AudioEffector has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. effector = AudioEffector(**config) /pytorch/audio/src/torchaudio/io/_effector.py:98: UserWarning: torio.io._streaming_media_encoder.StreamingMediaEncoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. writer = StreamWriter(buffer, format=muxer) /pytorch/audio/src/torchaudio/io/_effector.py:286: UserWarning: torio.io._streaming_media_decoder.StreamingMediaDecoder has been deprecated. This deprecation is part of a large refactoring effort to transition TorchAudio into a maintenance phase. The decoding and encoding capabilities of PyTorch for both audio and video are being consolidated into TorchCodec. Please see https://github.com/pytorch/audio/issues/3902 for more information. It will be removed from the 2.9 release. reader = StreamReader(src, format=muxer, option=option) .. GENERATED FROM PYTHON SOURCE LINES 340-342 default ^^^^^^^ .. GENERATED FROM PYTHON SOURCE LINES 342-344 .. code-block:: default results[0] .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 345-347 compression_level=1 ^^^^^^^^^^^^^^^^^^^ .. GENERATED FROM PYTHON SOURCE LINES 347-349 .. code-block:: default results[1] .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 350-352 compression_level=9 ^^^^^^^^^^^^^^^^^^^ .. GENERATED FROM PYTHON SOURCE LINES 352-354 .. code-block:: default results[2] .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 355-357 bit_rate=192k ^^^^^^^^^^^^^ .. GENERATED FROM PYTHON SOURCE LINES 357-359 .. code-block:: default results[3] .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 360-362 bit_rate=8k ^^^^^^^^^^^^^ .. GENERATED FROM PYTHON SOURCE LINES 362-364 .. code-block:: default results[4] .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 365-367 qscale=9 ^^^^^^^^ .. GENERATED FROM PYTHON SOURCE LINES 367-369 .. code-block:: default results[5] .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 370-372 qscale=1 ^^^^^^^^ .. GENERATED FROM PYTHON SOURCE LINES 372-374 .. code-block:: default results[6] .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 375-376 Tag: :obj:`torchaudio.io` .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 3.000 seconds) .. _sphx_glr_download_tutorials_effector_tutorial.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: effector_tutorial.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: effector_tutorial.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_