Waveform.from_interleaved_samples()

static Waveform.from_interleaved_samples(frame_rate_hz, num_channels, interleaved_samples)

Creates a Waveform from interleaved audio samples.

Example

>>> from babycat import Waveform
>>> interleaved_samples = [-1.0, 0.0, 1.0, -1.0, 0.0, 1.0]
>>> waveform = Waveform.from_interleaved_samples(
...     frame_rate_hz=44_100,
...     num_channels=3,
...     interleaved_samples=interleaved_samples,
... )
>>> waveform
<babycat.Waveform: 2 frames, 3 channels, 44100 hz>
Parameters
  • frame_rate_hz (int) – The frame rate that applies to the waveform described by interleaved_samples.

  • num_channels (int) – The number of channels in the waveform described by interleaved_samples.

  • interleaved_samples (list) – A one-dimensional Python list of interleaved float audio samples.

Returns

A waveform representing interleaved_samples.

Return type

Waveform