Skip to content

WARNING

该页面尚未翻译。 以下内容为英文原版。

tensorplay.audio.io

Functions

get_audio_backend() [source]

python
get_audio_backend()

Returns the name of the package used to load audio files.

info() [source]

python
info(filepath)

Get signal information of an audio file.

load() [source]

python
load(filepath, normalize=True, channels_first=True)

Loads an audio file from the filesystem.

Args

  • filepath (str): Path to the audio file.
  • normalize (bool): If True, normalize the audio to [-1, 1] (float32). If False, return original values (e.g. int16).
  • Default: True.
  • channels_first (bool): If True, return (Channels, Time). If False, return (Time, Channels).
  • Default: True (PyTorch style).

Returns

  • Tensor: Audio tensor.
  • int: Sample rate.

save() [source]

python
save(filepath, src, sample_rate)

Saves a Tensor to an audio file.

Args

  • filepath (str): Path to save.
  • src (Tensor): Audio tensor (C, T) or (T, C) or (T,).
  • sample_rate (int): Sample rate.

基于 Apache 2.0 许可发布。

📚DeepWiki