# Configure audio encoding (/en/realtime-media/voice/build/control-audio-and-devices/configure-audio-encoding/windows)

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

Audio quality requirements vary with application use-case. For example, in professional use-cases such as radio stations and singing competitions, users are particularly sensitive to audio quality. In such cases, support for dual-channel and high-quality sound is required. High-quality sound means setting a high sampling rate and a high bitrate to achieve realistic audio. Voice SDK enables you to configure audio encoding properties to meet such requirements.

      
  
      
  
      
  
      
  
      
    This article shows you how to use Voice SDK to configure appropriate audio encoding properties and application scenarios in your app.

    ## Understand the tech [#understand-the-tech-4]

    Voice SDK uses default encoding parameters and a default audio scenario that are suitable for most common applications. If the default settings do not meet your needs, refer to the examples in the implementation section to set appropriate audio encoding properties and an application scenario.

    ## Prerequisites [#prerequisites-4]

    Ensure that you have implemented the [SDK quickstart](../index.mdx) in your project.

    ## Implementation [#implementation-4]

    This section explains how to set audio encoding properties and application scenarios for common applications.

    | API                                 | Description                                                                                                                        |
    | :---------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------- |
    | `initialize(context.audioScenario)` | While initializing an `IRtcEngine` instance, set up the audio application scenario. The default value is `AUDIO_SCENARIO_DEFAULT`. |
    | `setAudioProfile(profile)`          | Audio encoding properties can be set before and after joining a channel.                                                           |
    | `setAudioScenario`                  | Audio application scenarios can be set before and after joining the channel.                                                       |

    You can add the following sample code to your project.

    ### 1-on-1 interactive teaching [#1-on-1-interactive-teaching-3]

    The 1-to-1 interactive teaching use-case requires ensuring call quality and smooth transmission. Add the following code to your project:

    ```cpp
    // Initialize the IRtcEngine instance with a specific audio application scenario
    RtcEngineContext context;
    context.audioScenario = AUDIO_SCENARIO_DEFAULT;
    m_rtcEngine->initialize(context);

    // Define the audio encoding settings
    m_rtcEngine->setAudioProfile(AUDIO_PROFILE_DEFAULT);
    ```

    ### KTV [#ktv-3]

    KTV mainly requires high sound quality and good expressiveness for music and singing. Add the following code to your project:

    ```cpp
    // Initialize the IRtcEngine instance with a specific audio application scenario
    RtcEngineContext context;
    context.audioScenario = AUDIO_SCENARIO_GAME_STREAMING;
    m_rtcEngine->initialize(context);

    // Define the audio encoding settings
    m_rtcEngine->setAudioProfile(AUDIO_PROFILE_MUSIC_HIGH_QUALITY);
    ```

    ### Voice radio [#voice-radio-3]

    Voice radio generally uses professional audio equipment, mainly requiring high sound quality and stereo. Add the following code to your project:

    ```cpp
    // Initialize the IRtcEngine instance with a specific audio application scenario
    RtcEngineContext context;
    context.audioScenario = AUDIO_SCENARIO_GAME_STREAMING;
    m_rtcEngine->initialize(context);

    // Define the audio encoding settings
    m_rtcEngine->setAudioProfile(AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO);
    ```

    ### Music teaching [#music-teaching-3]

    This use-case requires high sound quality, and support for the transmission of speaker-played sound effects. Agora recommends the following settings:

    ```cpp
    // Initialize the IRtcEngine instance with a specific audio application scenario
    RtcEngineContext context;
    context.audioScenario = AUDIO_SCENARIO_GAME_STREAMING;
    m_rtcEngine->initialize(context);

    // Define the audio encoding settings
    m_rtcEngine->setAudioProfile(AUDIO_PROFILE_MUSIC_STANDARD_STEREO);
    ```

    ## Reference [#reference-4]

    This section contains content that completes the information on this page, or points you to documentation that explains other aspects to this product.

    For more audio settings, see [Achieve high audio quality](/en/realtime-media/voice/build/enhance-the-audio-experience/best-practices-sound-quality).

    ### Frequently asked questions [#frequently-asked-questions-4]

    * [What is the difference between the in-call volume and the media volume?](/en/api-reference/faq/integration/system_volume)

    ### Sample projects [#sample-projects-3]

    Agora offers the following open-source sample project for setting audio encoding properties and application scenario functions for your reference.

    * [AudioProfile](https://github.com/AgoraIO/API-Examples/tree/main/windows/APIExample/APIExample/Advanced/AudioProfile)

    ### API reference [#api-reference-4]

    * [`initialize`](https://api-ref.agora.io/en/video-sdk/cpp/4.x/API/class_irtcengine.html#api_irtcengine_initialize)
    * [`setAudioProfile` \[2/2\]](https://api-ref.agora.io/en/video-sdk/cpp/4.x/API/class_irtcengine.html#api_irtcengine_setaudioprofile2)
    * [`setAudioScenario`](https://api-ref.agora.io/en/video-sdk/cpp/4.x/API/class_irtcengine.html#api_irtcengine_setaudioscenario)

    
  
      
  
      
  
      
  
      
  
      
  
      
  
