spdl.io.AudioFrames

class AudioFrames

Audio frames.

See Packets and Frames for information about the Frames base concept.

Attributes

clone

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

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__

Returns the number of frames. Same as num_frames.

clone

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

Returns:

A clone of the frame.

property num_channels

The number of channels.

property num_frames

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

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

The sample rate of audio.