# Configure audio encoding (/en/realtime-media/broadcast-streaming/build/control-audio-and-devices/configure-audio-encoding/blueprint)

> 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. Video SDK enables you to configure audio encoding properties to meet such requirements.

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

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

    Video 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-10]

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

    ## Implementation [#implementation-10]

    This section shows you how to set audio encoding properties and application scenarios for common applications. You use the following APIs to configure audio encoding:

    | 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, scenario)` | You can set audio encoding properties before or after joining a channel.                                                           |
    | `SetAudioScenario`                   | You can set an application scenario before or after joining a channel.                                                             |

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

    This subsection describes how to call `SetAudioProfile` to set audio encoding properties.

    1. Create UMG

    Create a **ComboBoxString** (dropdown list) widget, named **CBS\_Audio\_Profile**, where you can select the audio encoding properties as needed. The default option is **AUDIO\_PROFILE\_DEFAULT**, with other options detailed in [EAUDIO\_PROFILE\_TYPE](https://api-ref.agora.io/en/video-sdk/blueprint/4.x/API/enum_audioscenariotype.html), as shown in the image below:

    ![ConfigureAudioEncodingBlueprint](https://assets-docs.agora.io/images/video-sdk/configure_audio_encoding_implementation_blueprint-1.png)

    2. Bind UI event

    Create a **Bind Event to On Selection Changed node**, connecting the **CBS\_Audio\_Profile** widget and the **OnSetAudioProfile** callback. Selecting different audio encoding properties in the **CBS\_Audio\_Profile** dropdown list triggers the **OnSetAudioProfile** callback, as shown in the image below:

    ![ConfigureAudioEncodingBlueprint](https://assets-docs.agora.io/images/video-sdk/configure_audio_encoding_implementation_blueprint-2.png)

    3. Implement callback function

    Create the **OnSetAudioProfile** callback function, configuring the following parameters:

    | Input parameter | Data type | Parameter description                                                                                                                          |
    | :-------------- | :-------- | :--------------------------------------------------------------------------------------------------------------------------------------------- |
    | `SelectedItem`  | String    | The selected audio encoding property option.                                                                                                   |
    | `SelectionType` | Enum      | The type of selection information, see [ESelectInfo](https://docs.unrealengine.com/4.26/en-US/API/Runtime/SlateCore/Types/ESelectInfo__Type/). |

    When this callback is triggered, the selected audio encoding property is passed into **SetAudioProfile** as a profile parameter, and the method is executed to complete the setting, as shown in the image below:

    ![ConfigureAudioEncodingBlueprint](https://assets-docs.agora.io/images/video-sdk/configure_audio_encoding_implementation_blueprint-3.png)

    ### Set up audio application scenarios [#set-up-audio-application-scenarios]

    This subsection explains how to call **SetAudioScenario** to set audio application scenarios.

    1. Create UMG

    Create a **ComboBoxString** (dropdown list) widget, named **CBS\_Audio\_Scenario**, where you select the audio application scenarios as needed. The default option is **AUDIO\_SCENARIO\_DEFAULT**, with other options detailed in [EAUDIO\_SCENARIO\_TYPE](https://api-ref.agora.io/en/video-sdk/blueprint/4.x/API/enum_audioscenariotype.html), as shown in the image below:

    ![ConfigureAudioEncodingBlueprint](https://assets-docs.agora.io/images/video-sdk/configure_audio_encoding_implementation_blueprint-4.png)

    2. Bind UI Event

    Create a **Bind Event to On Selection Changed** node, connecting the **CBS\_Audio\_Scenario** widget and the **OnSetAudioScenario** callback. Selecting different audio application scenarios in the **CBS\_Audio\_Scenario** dropdown list triggers the **OnSetAudioScenario** callback, as shown in the image below:

    ![ConfigureAudioEncodingBlueprint](https://assets-docs.agora.io/images/video-sdk/configure_audio_encoding_implementation_blueprint-5.png)

    3. Implement callback function

    Create the **OnSetAudioScenario** callback function, configuring the following parameters:

    | Input Parameter | Data Type | Parameter Description                                                                                                                          |
    | :-------------- | :-------- | :--------------------------------------------------------------------------------------------------------------------------------------------- |
    | `SelectedItem`  | String    | The selected audio encoding property option.                                                                                                   |
    | `SelectionType` | Enum      | The type of selection information, see [ESelectInfo](https://docs.unrealengine.com/4.26/en-US/API/Runtime/SlateCore/Types/ESelectInfo__Type/). |

    When this callback is triggered, the selected audio application scenario is passed to **SetAudioScenario** as scenario parameter, and the method is executed to complete the setting, as shown in the image below:

    ![ConfigureAudioEncodingBlueprint](https://assets-docs.agora.io/images/video-sdk/configure_audio_encoding_implementation_blueprint-6.png)

    ### Recommended settings [#recommended-settings]

    The recommended settings for audio encoding properties and audio application scenarios for common applications are as follows:

    | Common applications                                                                                                                 | Audio encoding properties                 | Audio application scenario      |
    | ----------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- | ------------------------------- |
    | **1-on-1 interactive teaching**: Requires ensuring call quality and smooth transmission.                                            | `AUDIO_PROFILE_DEFAULT`                   | `AUDIO_SCENARIO_DEFAULT`        |
    | **KTV**: Requires high sound quality and good music and vocal performance.                                                          | `AUDIO_PROFILE_MUSIC_HIGH_QUALITY`        | `AUDIO_SCENARIO_GAME_STREAMING` |
    | **Voice radio**: Typically uses professional audio equipment. Requires high sound quality and stereo.                               | `AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO` | `AUDIO_SCENARIO_GAME_STREAMING` |
    | **Music teaching**: Requires high sound quality and support for the transmission of speaker-played sound effects to the remote end. | `AUDIO_PROFILE_MUSIC_STANDARD_STEREO`     | `AUDIO_SCENARIO_GAME_STREAMING` |

    <CalloutContainer type="info">
      <CalloutDescription>
        Due to iOS system limitations, some audio routes cannot be recognized in call volume mode. Therefore, if you need to use an external sound card, it is recommended to set the audio application scene to the high-quality scenario `AUDIO_SCENARIO_GAME_STREAMING(3)`. In this scenario, the SDK switches to media volume to address the issue.
      </CalloutDescription>
    </CalloutContainer>

    ## Reference [#reference-10]

    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/video/build/enhance-the-audio-experience/best-practices-sound-quality).

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

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

    ### Sample projects [#sample-projects-6]

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

    * [Agora-Unreal-SDK-Blueprint-Example](https://github.com/AgoraIO-Extensions/Agora-Unreal-RTC-SDK/tree/main/Agora-Unreal-SDK-Blueprint-Example)
    * [JoinChannelAudio](https://github.com/AgoraIO-Extensions/Agora-Unreal-RTC-SDK/tree/main/Agora-Unreal-SDK-Blueprint-Example/Content/API-Example/Basic/JoinChannelAudio)

    ### API reference [#api-reference-10]

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

    
  
