torchoutil.extras.torchaudio module

dump_audio(
src: Tensor,
uri: BinaryIO | str | Path | PathLike | None,
sample_rate: int,
channels_first: bool = True,
format: str | None = None,
encoding: str | None = None,
bits_per_sample: int | None = None,
buffer_size: int = 4096,
backend: str | None = None,
compression: CodecConfig | float | int | None = None,
*,
overwrite: bool = True,
make_parents: bool = True,
) bytes[source]

Dump tensors to audio waveform file. Requires torchaudio package installed.

dump_with_torchaudio(
src: Tensor,
uri: BinaryIO | str | Path | PathLike | None,
sample_rate: int,
channels_first: bool = True,
format: str | None = None,
encoding: str | None = None,
bits_per_sample: int | None = None,
buffer_size: int = 4096,
backend: str | None = None,
compression: CodecConfig | float | int | None = None,
*,
overwrite: bool = True,
make_parents: bool = True,
) bytes[source]

Dump tensors to audio waveform file. Requires torchaudio package installed.

load_audio(
uri: BinaryIO | str | PathLike | Path,
frame_offset: int = 0,
num_frames: int = -1,
normalize: bool = True,
channels_first: bool = True,
format: str | None = None,
buffer_size: int = 4096,
backend: str | None = None,
) Any[source]
load_with_torchaudio(
uri: BinaryIO | str | PathLike | Path,
frame_offset: int = 0,
num_frames: int = -1,
normalize: bool = True,
channels_first: bool = True,
format: str | None = None,
buffer_size: int = 4096,
backend: str | None = None,
) Any[source]
to_torchaudio(
src: Tensor,
uri: BinaryIO | str | Path | PathLike | None,
sample_rate: int,
channels_first: bool = True,
format: str | None = None,
encoding: str | None = None,
bits_per_sample: int | None = None,
buffer_size: int = 4096,
backend: str | None = None,
compression: CodecConfig | float | int | None = None,
*,
overwrite: bool = True,
make_parents: bool = True,
) bytes[source]

Dump tensors to audio waveform file. Requires torchaudio package installed.