AudioData class represents raw audio data received in audio renderer callbacks. It provides access to audio frame metadata and the raw audio samples.
Class Definition
Properties
bits_per_sample
int - Bits per sample
sample_rate
int - Sample rate in Hz
num_channels
int - Number of channels
num_audio_frames
int - Number of audio frames
audio_frames
bytes - Raw audio frame data
Usage in Audio Renderers
AudioData objects are received in audio renderer callbacks that you set with set_audio_renderer().
Example: Basic Audio Renderer
Example: Saving Audio to WAV File
Example: Processing Audio Frames
Notes
AudioDataobjects are read-only and provided by the SDK- The audio data format is interleaved PCM (Pulse Code Modulation)
- For stereo audio, samples are interleaved: [L, R, L, R, …]
- The total size of
audio_framesin bytes is:num_audio_frames * num_channels * (bits_per_sample / 8) - Audio renderers are called at the interval specified by
callback_interval_msinset_audio_renderer()
See Also
- CallClient.set_audio_renderer() - Set up audio renderer callbacks
- VideoFrame - Video frame data for video renderers
- CustomAudioSource - Send custom audio to a call