Getting started with TorchAudio: audio transforms, model pipelines, and version checks
TorchAudio is a library for reading and transforming audio with PyTorch tensors, creating features, and using some pretrained speech-model pipelines. The official 2.11 documentation, checked on November 20, 2026, says TorchAudio has been in maintenance mode since 2.9 and that audio I/O is moving to TorchCodec. For new work, first check whether the feature you need remains in TorchAudio, and use the recommended TorchCodec path for I/O.
Getting started with TorchAudio: audio transforms, model pipelines, and version checks
TorchAudio is a library for reading and transforming audio with PyTorch tensors, creating features, and using some pretrained speech-model pipelines. The official 2.11 documentation, checked on November 20, 2026, says TorchAudio has been in maintenance mode since 2.9 and that audio I/O is moving to TorchCodec. For new work, first check whether the feature you need remains in TorchAudio, and use the recommended TorchCodec path for I/O.
What it is used for
`torchaudio.transforms`: compose resampling, spectrogram or mel features, volume adjustment, and data augmentation as PyTorch modules.
`torchaudio.pipelines`: provide preprocessing, inference, and postprocessing information for particular pretrained models. Changing a model’s sample rate or feature settings arbitrarily may make its inputs differ from those used in training.
`torchaudio.models` and data utilities: provide components for audio processing and speech-task model or data workflows. Check the documentation for your installed version for the current API and full scope.
For example, a transform that converts a 48 kHz waveform to 16 kHz can be created as follows:
import torchaudio
resample = torchaudio.transforms.Resample(
orig_freq=48_000,
new_freq=16_000,
)
audio_16k = resample(audio_48k)This example only changes the waveform’s sample rate. Before using a pretrained model, check the model bundle’s required input sample rate and preprocessing rules, then match those settings.
Match TorchAudio with PyTorch before installation
TorchAudio includes binary extensions linked to PyTorch. TorchAudio 2.11 supports PyTorch 2.11 and later through the stable ABI; earlier versions should be installed with their corresponding PyTorch releases. Decide whether you need a CPU, CUDA, or ROCm build before installation, and use the official PyTorch installer selector and TorchAudio compatibility matrix to install compatible builds in the same environment.
After installation, print the versions in the Python environment you will actually run:
import torch
import torchaudio
print(torch.__version__)
print(torchaudio.__version__)If import torchaudio fails with an extension-module error, first check that the active environment and the two libraries’ versions and CPU/GPU builds match. Installing into different environments or combining an older PyTorch with a newer TorchAudio can cause import failures.
Check the TorchCodec path for audio I/O
The official TorchAudio documentation says I/O functionality has been integrated into TorchCodec since 2.9. torchaudio.load() and torchaudio.save() are convenience aliases that call TorchCodec decoders and encoders; the documentation recommends moving new code to the TorchCodec API. If existing code relies on these functions, check that torchcodec is available in the installed environment and supports the file format. For new implementations, see the TorchCodec installation and usage guide.
Choose what to read next
For features from waveforms, read the transforms documentation; to run a provided model, read the pipelines documentation; for a task such as CTC alignment, speech recognition, or beamforming, choose its specific tutorial. Use the official documentation’s version selector to read the API matching your installed version. Search results may describe older torchaudio.io APIs or APIs that have been removed, so compare them with the current version’s documentation before running code.
References
[TorchAudio 2.11 documentation, overview and maintenance/I/O notice](https://docs.pytorch.org/audio/stable/torchaudio.html)
[TorchAudio 2.11 installation and compatibility matrix](https://docs.pytorch.org/audio/stable/installation)
[TorchAudio 2.11 transforms](https://docs.pytorch.org/audio/stable/transforms)
[TorchAudio 2.11 pipelines](https://docs.pytorch.org/audio/stable/pipelines.html)