目录

torchaudio

I/O functionalities

Audio I/O functions are implemented in torchaudio.backend module, but for the ease of use, the following functions are made available on torchaudio module. There are different backends available and you can switch backends with set_audio_backend().

Refer to torchaudio.backend for the detail.

torchaudio.info(filepath: str, ...)

Fetch meta data of an audio file. Refer to torchaudio.backend for the detail.

torchaudio.load(filepath: str, ...)

Load audio file into torch.Tensor object. Refer to torchaudio.backend for the detail.

torchaudio.save(filepath: str, src: torch.Tensor, sample_rate: int, ...)

Save torch.Tensor object into an audio format. Refer to torchaudio.backend for the detail.

Backend Utilities

torchaudio.list_audio_backends() → List[str][source]

List available backends

Returns

The list of available backends.

Return type

List[str]

torchaudio.get_audio_backend() → Optional[str][source]

Get the name of the current backend

Returns

The name of the current backend or None if no backend is assigned.

Return type

Optional[str]

torchaudio.set_audio_backend(backend: Optional[str])[source]

Set the backend for I/O operation

Parameters

backend (Optional[str]) – Name of the backend. One of "sox_io" or "soundfile" based on availability of the system. If None is provided the current backend is unassigned.

文档

访问 PyTorch 的全面开发人员文档

查看文档

教程

获取面向初学者和高级开发人员的深入教程

查看教程

资源

查找开发资源并解答您的问题

查看资源