spdl.io.AudioFrames

class AudioFrames[source]

Audio frames.

Methods

clone()

Clone the frames, so that data can be converted to buffer multiple times.

Attributes

num_channels

The number of channels.

num_frames

The number of audio frames.

sample_fmt

The name of sample format.

sample_rate

The sample rate of audio.

__len__() int[source]

Returns the number of frames. Same as num_frames.

clone() AudioFrames[source]

Clone the frames, so that data can be converted to buffer multiple times.

Returns:

A clone of the frame.

property num_channels: int[source]

The number of channels.

property num_frames: int[source]

The number of audio frames. Same as __len__ method.

Note

In SPDL, The number of samples == the number of frames x the number of channels

property sample_fmt: str[source]

The name of sample format.

Possible values are

  • "u8" for unsigned 8-bit integer.

  • "s16", "s32", "s64" for signed 16-bit, 32-bit and 64-bit integer.

  • "flt", "dbl" for 32-bit and 64-bit float.

If the frame is planar format (separate planes for different channels), the name will be suffixed with "p". When converted to buffer, the buffer’s shape will be channel-first format (channel, num_samples) instead of interweaved (num_samples, channel).

property sample_rate: int[source]

The sample rate of audio.