Agora Java API Reference for Android

Public Member Functions | Public Attributes | List of all members
io.agora.base.AudioFrame Class Reference

Raw audio data. More...

## Public Member Functions
| AudioFrame (ByteBuffer buffer, int sampleRataHz, int bytesPerSample, int channelNums, int samplesPerChannel, long timestamp)
ByteBuffer | getByteBuffer ()
int | getBytesPerSample ()
int | getChannelNums ()
int | getSampleRataHz ()
int | getSamplesPerChannel ()
long | getTimestamp ()
String | toString ()

## Public Attributes
ByteBuffer | buffer
int | sampleRataHz
int | bytesPerSample
int | channelNums
int | samplesPerChannel
long | timestamp

## Detailed Description

Raw audio data.

## Member Data Documentation

## ◆ buffer

ByteBuffer io.agora.base.AudioFrame.buffer

The data buffer of the audio frame. When the audio frame uses a stereo channel, the data buffer is interleaved. The size of the data buffer is as follows: `buffer` = `samples` × `channels` × `bytesPerSample`.

## ◆ sampleRataHz

int io.agora.base.AudioFrame.sampleRataHz

The number of samples per channel in the audio frame.

## ◆ bytesPerSample

int io.agora.base.AudioFrame.bytesPerSample

The number of bytes per sample. For PCM, this parameter is generally set to 16 bits (2 bytes).

## ◆ channelNums

int io.agora.base.AudioFrame.channelNums

The number of audio channels (the data are interleaved if it is stereo).

- 1: Mono.
- 2: Stereo.

## ◆ samplesPerChannel

int io.agora.base.AudioFrame.samplesPerChannel

The number of samples per channel in the audio frame.

## ◆ timestamp

long io.agora.base.AudioFrame.timestamp

The timestamp (ms) of the audio frame.