torchwrench.extras.torchaudio module

class torchwrench.extras.torchaudio.AudioMetaDataDict[source]

Bases: TypedDict

bits_per_sample : int
encoding : str
num_channels : int
num_frames : int
sample_rate : int
class torchwrench.extras.torchaudio.CodecConfig(*args, **kwargs)[source]

Bases: Placeholder

torchwrench.extras.torchaudio.audio_metadata_to_dict(meta: _AudioMetaData) AudioMetaDataDict[source]
torchwrench.extras.torchaudio.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.

torchwrench.extras.torchaudio.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.

torchwrench.extras.torchaudio.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) tuple[Tensor, int][source]
torchwrench.extras.torchaudio.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) tuple[Tensor, int][source]