io.agora.rtc

## Class AudioParams

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

-     public class AudioParams
      extends java.lang.Object

  Audio parameters configuration. Sample interval (seconds) = `samplePerCall`/(`sampleRate` x `channelCnt`). Ensure that the value of sample interval is equal to or greater than 0.01.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `int` | `channel` The number of audio channels, which can be set as either of the following values: - `1`: Mono (Default) - `2`: Stereo
    `int` | `mode` The use mode of the audio data: - `RAW_AUDIO_FRAME_OP_MODE_READ_ONLY(0)`: (Default) Read-only mode, in which users can only read the `AudioFrame` without modifying anything.
    `int` | `sampleRate` The audio sample rate (Hz), which can be set as one of the following values: - `8000` - `16000` (Default) - `32000` - `44100` - `48000`
    `int` | `samplesPerCall` The number of samples.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AudioParams(int sampleRate, int channelCnt, int mode, int samplesPerCall)` Constructs AudioParams with all parameters.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getChannel()` Gets the number of audio channels.
    `int` | `getMode()` Gets the use mode of the audio data.
    `int` | `getSampleRate()` Gets the audio sample rate.
    `int` | `getSamplesPerCall()` Gets the number of samples.
    `java.lang.String` | `toString()`

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

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

- - ### Field Detail

    - #### sampleRate

          public int sampleRate

      The audio sample rate (Hz), which can be set as one of the following values: - `8000` - `16000` (Default) - `32000` - `44100` - `48000`

    - #### channel

          public int channel

      The number of audio channels, which can be set as either of the following values: - `1`: Mono (Default) - `2`: Stereo

    - #### mode

          public int mode

      The use mode of the audio data: - `RAW_AUDIO_FRAME_OP_MODE_READ_ONLY(0)`: (Default) Read-only mode, in which users can only read the `AudioFrame` without modifying anything. For example, this mode applies when users acquire data with the Agora SDK and then push the RTMP or RTMPS streams. - `RAW_AUDIO_FRAME_OP_MODE_READ_WRITE(2)`: Read and write mode, in which users read the `AudioFrame`, modify it, and then play it. For example, this mode applies when users have their own sound-effect processing module to pre-process the audio (such as a voice changer).

    - #### samplesPerCall

          public int samplesPerCall

      The number of samples. For example, set it as 1024 for RTMP or RTMPS streaming.

  - ### Constructor Detail

    - #### AudioParams

          public AudioParams(int sampleRate,
                             int channelCnt,
                             int mode,
                             int samplesPerCall)

      Constructs AudioParams with all parameters.
      Parameters:
        `sampleRate` - The audio sample rate (Hz)
        `channelCnt` - The number of audio channels
        `mode` - The use mode of the audio data
        `samplesPerCall` - The number of samples

  - ### Method Detail

    - #### getSampleRate

          public int getSampleRate()

      Gets the audio sample rate.
      Returns:
        The audio sample rate (Hz)

    - #### getChannel

          public int getChannel()

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

    - #### getMode

          public int getMode()

      Gets the use mode of the audio data.
      Returns:
        The use mode of the audio data

    - #### getSamplesPerCall

          public int getSamplesPerCall()

      Gets the number of samples.
      Returns:
        The number of samples

    - #### toString

          public java.lang.String toString()

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