io.agora.rtc

## Class AudioFrame

- java.lang.Object
- - io.agora.rtc.AudioFrame

-     public class AudioFrame
      extends java.lang.Object

  Represents an audio frame with metadata and audio data.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private int` | `audioTrackNumber` The number of the audio track
    `private int` | `avsyncType` Audio-video sync type
    `private java.nio.ByteBuffer` | `buffer` Audio data buffer
    `private int` | `bytesPerSample` Number of bytes per sample
    `private int` | `channels` Number of audio channels
    `private int` | `farFiledFlag` Far field flag
    `private int` | `musicProb` Probability of music presence
    `private int` | `pitch` Pitch of the audio signal
    `private long` | `presentationMs` Presentation timestamp in milliseconds
    `private long` | `renderTimeMs` Render time in milliseconds
    `private int` | `rms` Root mean square of the audio signal
    `private int` | `rtpTimestamp` RTP timestamp of the first sample in the audio frame
    `private int` | `samplesPerChannel` Number of samples per channel
    `private int` | `samplesPerSec` Sampling rate in samples per second
    `private int` | `type` Type of audio frame
    `private int` | `voiceProb` Probability of voice presence

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AudioFrame()` Default constructor for AudioFrame.
    `AudioFrame(int type, int samplesPerChannel, int bytesPerSample, int channels, int samplesPerSec, java.nio.ByteBuffer buffer, long renderTimeMs, long presentationMs, int avsyncType, int audioTrackNumber, int rtpTimestamp, int farFiledFlag, int rms, int voiceProb, int musicProb, int pitch)` Constructs an AudioFrame with all parameters.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getAudioTrackNumber()` Gets the number of the audio track.
    `int` | `getAvsyncType()` Gets the audio-video sync type.
    `java.nio.ByteBuffer` | `getBuffer()` Gets the audio data buffer.
    `int` | `getBytesPerSample()` Gets the number of bytes per sample.
    `int` | `getChannels()` Gets the number of audio channels.
    `int` | `getFarFiledFlag()` Gets the far field flag.
    `int` | `getMusicProb()` Gets the probability of music presence.
    `int` | `getPitch()` Gets the pitch of the audio signal.
    `long` | `getPresentationMs()` Gets the presentation timestamp in milliseconds.
    `long` | `getRenderTimeMs()` Gets the render time in milliseconds.
    `int` | `getRms()` Gets the root mean square of the audio signal.
    `int` | `getRtpTimestamp()` Gets the RTP timestamp of the first sample in the audio frame.
    `int` | `getSamplesPerChannel()` Gets the number of samples per channel.
    `int` | `getSamplesPerSec()` Gets the sampling rate in samples per second.
    `int` | `getType()` Gets the type of audio frame.
    `int` | `getVoiceProb()` Gets the probability of voice presence.
    `void` | `setAudioTrackNumber(int audioTrackNumber)` Sets the number of the audio track.
    `void` | `setAvsyncType(int avsyncType)` Sets the audio-video sync type.
    `void` | `setBuffer(java.nio.ByteBuffer buffer)` Sets the audio data buffer.
    `void` | `setBytesPerSample(int bytesPerSample)` Sets the number of bytes per sample.
    `void` | `setChannels(int channels)` Sets the number of audio channels.
    `void` | `setFarFiledFlag(int farFiledFlag)` Sets the far field flag.
    `void` | `setMusicProb(int musicProb)` Sets the probability of music presence.
    `void` | `setPitch(int pitch)` Sets the pitch of the audio signal.
    `void` | `setPresentationMs(long presentationMs)` Sets the presentation timestamp in milliseconds.
    `void` | `setRenderTimeMs(long renderTimeMs)` Sets the render time in milliseconds.
    `void` | `setRms(int rms)` Sets the root mean square of the audio signal.
    `void` | `setRtpTimestamp(int rtpTimestamp)` Sets the RTP timestamp of the first sample in the audio frame.
    `void` | `setSamplesPerChannel(int samplesPerChannel)` Sets the number of samples per channel.
    `void` | `setSamplesPerSec(int samplesPerSec)` Sets the sampling rate in samples per second.
    `void` | `setType(int type)` Sets the type of audio frame.
    `void` | `setVoiceProb(int voiceProb)` Sets the probability of voice presence.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### type

          private int type

      Type of audio frame

    - #### samplesPerChannel

          private int samplesPerChannel

      Number of samples per channel

    - #### bytesPerSample

          private int bytesPerSample

      Number of bytes per sample

    - #### channels

          private int channels

      Number of audio channels

    - #### samplesPerSec

          private int samplesPerSec

      Sampling rate in samples per second

    - #### buffer

          private java.nio.ByteBuffer buffer

      Audio data buffer

    - #### renderTimeMs

          private long renderTimeMs

      Render time in milliseconds

    - #### presentationMs

          private long presentationMs

      Presentation timestamp in milliseconds

    - #### avsyncType

          private int avsyncType

      Audio-video sync type

    - #### audioTrackNumber

          private int audioTrackNumber

      The number of the audio track

    - #### rtpTimestamp

          private int rtpTimestamp

      RTP timestamp of the first sample in the audio frame

    - #### farFiledFlag

          private int farFiledFlag

      Far field flag

    - #### rms

          private int rms

      Root mean square of the audio signal

    - #### voiceProb

          private int voiceProb

      Probability of voice presence

    - #### musicProb

          private int musicProb

      Probability of music presence

    - #### pitch

          private int pitch

      Pitch of the audio signal

  - ### Constructor Detail

    - #### AudioFrame

          public AudioFrame()

      Default constructor for AudioFrame.

    - #### AudioFrame

          public AudioFrame(int type,
                            int samplesPerChannel,
                            int bytesPerSample,
                            int channels,
                            int samplesPerSec,
                            java.nio.ByteBuffer buffer,
                            long renderTimeMs,
                            long presentationMs,
                            int avsyncType,
                            int audioTrackNumber,
                            int rtpTimestamp,
                            int farFiledFlag,
                            int rms,
                            int voiceProb,
                            int musicProb,
                            int pitch)

      Constructs an AudioFrame with all parameters.
      Parameters:
        `type` - Type of audio frame
        `samplesPerChannel` - Number of samples per channel
        `bytesPerSample` - Number of bytes per sample
        `channels` - Number of audio channels
        `samplesPerSec` - Sampling rate in samples per second
        `buffer` - Audio data buffer
        `renderTimeMs` - Render time in milliseconds
        `presentationMs` - Presentation timestamp in milliseconds
        `avsyncType` - Audio-video sync type
        `audioTrackNumber` - The number of the audio track
        `rtpTimestamp` - RTP timestamp of the first sample
        `farFiledFlag` - Far field flag
        `rms` - Root mean square of the audio signal
        `voiceProb` - Probability of voice presence
        `musicProb` - Probability of music presence
        `pitch` - Pitch of the audio signal

  - ### Method Detail

    - #### getType

          public int getType()

      Gets the type of audio frame.
      Returns:
        Type of audio frame

    - #### setType

          public void setType(int type)

      Sets the type of audio frame.
      Parameters:
        `type` - Type of audio frame

    - #### getSamplesPerChannel

          public int getSamplesPerChannel()

      Gets the number of samples per channel.
      Returns:
        Number of samples per channel

    - #### setSamplesPerChannel

          public void setSamplesPerChannel(int samplesPerChannel)

      Sets the number of samples per channel.
      Parameters:
        `samplesPerChannel` - Number of samples per channel

    - #### getBytesPerSample

          public int getBytesPerSample()

      Gets the number of bytes per sample.
      Returns:
        Number of bytes per sample

    - #### setBytesPerSample

          public void setBytesPerSample(int bytesPerSample)

      Sets the number of bytes per sample.
      Parameters:
        `bytesPerSample` - Number of bytes per sample

    - #### getChannels

          public int getChannels()

      Gets the number of audio channels.
      Returns:
        Number of audio channels

    - #### setChannels

          public void setChannels(int channels)

      Sets the number of audio channels.
      Parameters:
        `channels` - Number of audio channels

    - #### getSamplesPerSec

          public int getSamplesPerSec()

      Gets the sampling rate in samples per second.
      Returns:
        Sampling rate in samples per second

    - #### setSamplesPerSec

          public void setSamplesPerSec(int samplesPerSec)

      Sets the sampling rate in samples per second.
      Parameters:
        `samplesPerSec` - Sampling rate in samples per second

    - #### getBuffer

          public java.nio.ByteBuffer getBuffer()

      Gets the audio data buffer.
      Returns:
        Audio data buffer

    - #### setBuffer

          public void setBuffer(java.nio.ByteBuffer buffer)

      Sets the audio data buffer.
      Parameters:
        `buffer` - Audio data buffer

    - #### getRenderTimeMs

          public long getRenderTimeMs()

      Gets the render time in milliseconds.
      Returns:
        Render time in milliseconds

    - #### setRenderTimeMs

          public void setRenderTimeMs(long renderTimeMs)

      Sets the render time in milliseconds.
      Parameters:
        `renderTimeMs` - Render time in milliseconds

    - #### getPresentationMs

          public long getPresentationMs()

      Gets the presentation timestamp in milliseconds.
      Returns:
        Presentation timestamp in milliseconds

    - #### setPresentationMs

          public void setPresentationMs(long presentationMs)

      Sets the presentation timestamp in milliseconds.
      Parameters:
        `presentationMs` - Presentation timestamp in milliseconds

    - #### getAvsyncType

          public int getAvsyncType()

      Gets the audio-video sync type.
      Returns:
        Audio-video sync type

    - #### setAvsyncType

          public void setAvsyncType(int avsyncType)

      Sets the audio-video sync type.
      Parameters:
        `avsyncType` - Audio-video sync type

    - #### getAudioTrackNumber

          public int getAudioTrackNumber()

      Gets the number of the audio track.
      Returns:
        The number of the audio track

    - #### setAudioTrackNumber

          public void setAudioTrackNumber(int audioTrackNumber)

      Sets the number of the audio track.
      Parameters:
        `audioTrackNumber` - The number of the audio track

    - #### getRtpTimestamp

          public int getRtpTimestamp()

      Gets the RTP timestamp of the first sample in the audio frame.
      Returns:
        RTP timestamp

    - #### setRtpTimestamp

          public void setRtpTimestamp(int rtpTimestamp)

      Sets the RTP timestamp of the first sample in the audio frame.
      Parameters:
        `rtpTimestamp` - RTP timestamp

    - #### getFarFiledFlag

          public int getFarFiledFlag()

      Gets the far field flag.
      Returns:
        Far field flag

    - #### setFarFiledFlag

          public void setFarFiledFlag(int farFiledFlag)

      Sets the far field flag.
      Parameters:
        `farFiledFlag` - Far field flag

    - #### getRms

          public int getRms()

      Gets the root mean square of the audio signal.
      Returns:
        Root mean square value

    - #### setRms

          public void setRms(int rms)

      Sets the root mean square of the audio signal.
      Parameters:
        `rms` - Root mean square value

    - #### getVoiceProb

          public int getVoiceProb()

      Gets the probability of voice presence.
      Returns:
        Probability of voice presence

    - #### setVoiceProb

          public void setVoiceProb(int voiceProb)

      Sets the probability of voice presence.
      Parameters:
        `voiceProb` - Probability of voice presence

    - #### getMusicProb

          public int getMusicProb()

      Gets the probability of music presence.
      Returns:
        Probability of music presence

    - #### setMusicProb

          public void setMusicProb(int musicProb)

      Sets the probability of music presence.
      Parameters:
        `musicProb` - Probability of music presence

    - #### getPitch

          public int getPitch()

      Gets the pitch of the audio signal.
      Returns:
        Pitch of the audio signal

    - #### setPitch

          public void setPitch(int pitch)

      Sets the pitch of the audio signal.
      Parameters:
        `pitch` - Pitch of the audio signal

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`