# Achieve high audio quality (/en/realtime-media/video/build/enhance-the-audio-experience/best-practices-sound-quality/android)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

Some use-cases, such as karaoke sessions, podcasts, and performance-based chats, require a high-quality audio experience. This page shows you how to achieve clear high-definition audio, without noise or interference in your app.

    ## General settings [#general-settings]

    To improve the audio quality experience, consider the following:

    ### Set audio encoding properties [#set-audio-encoding-properties]

    Call [`setAudioProfile` \[2/2\]](https://api-ref.agora.io/en/voice-sdk/android/4.x/API/class_irtcengine.html#api_irtcengine_setaudioprofile2) to set the profile to `MUSIC_HIGH_QUALITY_STEREO` (5). It uses a 48 kHz sampling rate, music encoding, two channels, and the maximum encoding rate is 128 Kbps.

    <CodeBlockTabs defaultValue="java">
      <CodeBlockTabsList>
        <CodeBlockTabsTrigger value="java">
          Java
        </CodeBlockTabsTrigger>

        <CodeBlockTabsTrigger value="kotlin">
          Kotlin
        </CodeBlockTabsTrigger>
      </CodeBlockTabsList>

      <CodeBlockTab value="java">
        ```java
        // Set the audio profile to MUSIC_HIGH_QUALITY_STEREO
        RtcEngine.setAudioProfile(Constants.AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO);
        ```
      </CodeBlockTab>

      <CodeBlockTab value="kotlin">
        ```kotlin
        // Set the audio profile to MUSIC_HIGH_QUALITY_STEREO
        RtcEngine.setAudioProfile(Constants.AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO)
        ```
      </CodeBlockTab>
    </CodeBlockTabs>

    ### Set audio use-case [#set-audio-use-case]

    Call [`setAudioScenario`](https://api-ref.agora.io/en/voice-sdk/android/4.x/API/class_irtcengine.html#api_irtcengine_setaudioscenario) to set the audio scenario to high-quality `AUDIO_SCENARIO_GAME_STREAMING` (3).

    <CodeBlockTabs defaultValue="java">
      <CodeBlockTabsList>
        <CodeBlockTabsTrigger value="java">
          Java
        </CodeBlockTabsTrigger>

        <CodeBlockTabsTrigger value="kotlin">
          Kotlin
        </CodeBlockTabsTrigger>
      </CodeBlockTabsList>

      <CodeBlockTab value="java">
        ```java
        // Set the audio scenario to GAME_STREAMING
        config.mAudioScenario = Constants.AudioScenario.getValue(Constants.AudioScenario.GAME_STREAMING);
        engine = RtcEngine.create(config);
        ```
      </CodeBlockTab>

      <CodeBlockTab value="kotlin">
        ```kotlin
        // Set the audio scenario to GAME_STREAMING
        config.mAudioScenario = Constants.AudioScenario.getValue(Constants.AudioScenario.GAME_STREAMING)
        engine = RtcEngine.create(config)
        ```
      </CodeBlockTab>
    </CodeBlockTabs>

    ## Sound card settings [#sound-card-settings]

    This section only applies to users using sound cards.

    ### Disable 3A [#disable-3a]

    Video SDK turns on 3A by default. In audio processing, 3A stands for Acoustic Echo Cancellation (AEC), Active Noise Suppression (ANS), and Automatic Gain Control (AGC). Sound card devices usually provide some built-in audio processing, such as echo and noise cancellation. Currently, if 3A is enabled in the application layer, it may cause over-processing of the audio signal and interference between different algorithms may impact sound quality. Best practice is that users with sound cards disable the 3A function by calling [`setParameters`](https://api-ref.agora.io/en/voice-sdk/android/4.x/API/class_irtcengine.html#api_irtcengine_setparameters).

    <CodeBlockTabs defaultValue="java">
      <CodeBlockTabsList>
        <CodeBlockTabsTrigger value="java">
          Java
        </CodeBlockTabsTrigger>

        <CodeBlockTabsTrigger value="kotlin">
          Kotlin
        </CodeBlockTabsTrigger>
      </CodeBlockTabsList>

      <CodeBlockTab value="java">
        ```java
        // Turn off echo cancellation
        engine.setParameters("{\"che.audio.aec.enable\":false}");
        // Turn off noise reduction
        engine.setParameters("{\"che.audio.ans.enable\":false}");
        // Turn off gain control
        engine.setParameters("{\"che.audio.agc.enable\":false}");
        ```
      </CodeBlockTab>

      <CodeBlockTab value="kotlin">
        ```kotlin
        // Turn off echo cancellation
        engine.setParameters("{\"che.audio.aec.enable\":false}")
        // Turn off noise reduction
        engine.setParameters("{\"che.audio.ans.enable\":false}")
        // Turn off gain control
        engine.setParameters("{\"che.audio.agc.enable\":false}")
        ```
      </CodeBlockTab>
    </CodeBlockTabs>

    ### Turn on stereo capture [#turn-on-stereo-capture]

    Call [`setAdvancedAudioOptions`](https://api-ref.agora.io/en/voice-sdk/android/4.x/API/class_irtcengine.html#api_irtcengine_setadvancedaudiooptions) to set the number of audio pre-processing channels to `AGORA_AUDIO_STEREO_PROCESSING` (2), that is, use two channels to collect and send stereo sound.

    <CodeBlockTabs defaultValue="java">
      <CodeBlockTabsList>
        <CodeBlockTabsTrigger value="java">
          Java
        </CodeBlockTabsTrigger>

        <CodeBlockTabsTrigger value="kotlin">
          Kotlin
        </CodeBlockTabsTrigger>
      </CodeBlockTabsList>

      <CodeBlockTab value="java">
        ```java
        // Set advanced audio options for 2 audio processing channels
        AdvancedAudioOptions options = new AdvancedAudioOptions();
        options.audioProcessingChannels = 2;
        m_lpAgoraEngine.setAdvancedAudioOptions(options);
        ```
      </CodeBlockTab>

      <CodeBlockTab value="kotlin">
        ```kotlin
        // Set advanced audio options for 2 audio processing channels
        val options = AdvancedAudioOptions()
        options.audioProcessingChannels = 2
        m_lpAgoraEngine.setAdvancedAudioOptions(options)
        ```
      </CodeBlockTab>
    </CodeBlockTabs>

    
  
      
  
      
  
      
  
      
  
      
  
      
  
      
  
      
  
