speechbrain.utils.torch_audio_backend module

Library for checking the torchaudio backend.

Authors

  • Mirco Ravanelli 2021

  • Adel Moumen 2025

Summary

Functions:

check_torchaudio_backend

Checks the torchaudio backend and sets it to soundfile if windows is detected.

try_parse_torchaudio_major_version

Tries parsing the torchaudio major and minor version.

validate_backend

Validates the specified audio backend.

Reference

speechbrain.utils.torch_audio_backend.try_parse_torchaudio_major_version() tuple | None[source]

Tries parsing the torchaudio major and minor version.

Returns:

A (major, minor) tuple, otherwise None.

Return type:

tuple or None

speechbrain.utils.torch_audio_backend.check_torchaudio_backend()[source]

Checks the torchaudio backend and sets it to soundfile if windows is detected.

speechbrain.utils.torch_audio_backend.validate_backend(backend)[source]

Validates the specified audio backend.

Parameters:

backend (str or None) – The name of the backend to validate. Must be one of [None, ‘ffmpeg’, ‘sox’, ‘soundfile’].

Raises:

ValueError – If the backend is not one of the allowed values.