Set the Audio Profile
Apps need to provide different audio experiences according to different business needs. In order to provide these different audio experiences, you can use the Agora Video SDK to set the appropriate audio profile (profile
) and audio scenario (scenario
).
This article describes how to use the Agora Video SDK to set the audio profile and scenario in your app.
Understand the tech
Audio profiles refer to the combined settings of the audio sample rate, bitrate, encoding mode, and number of channels; audio scenarios refer to the audio processing algorithms recommended by Agora for common business scenarios. For example, for apps in the education scenario, Agora recommends using AUDIO_SCENARIO_EDUCATION
to obtain a highly smooth and stable audio experience.
The SDK uses the AUDIO_PROFILE_DEFAULT
profile and the AUDIO_SCENARIO_DEFAULT
scenario by default. If the default settings cannot meet your requirements, you can call setAudioProfile
to set the audio profile and scenario before joining a channel.
Prerequisites
Before setting the audio profile and scenario, ensure that you have implemented the basic real-time communication functions in your project. See Start a Video Call or Start Interactive Live Streaming.
Implementation
This section describes how to set the audio profile and scenario for common business scenarios. You can add the following sample code to the /app/java/com.example.<projectname>/MainActivity
file in your project.
One-to-one online classroom
This scenario mainly requires good call quality with smooth transmission. Agora recommends using the SDK default settings.
Battle royale game
This scenario mainly requires voice clarity, no noise, and a lower bitrate. Agora recommends the following settings:
Murder mystery game
This scenario mainly requires high audio performance, with no volume or audio quality change when users mute or unmute the microphone. Agora recommends the following settings:
KTV
This scenario mainly requires high-fidelity audio, a high performance to music or singing voice, and support for rich audio effects. Agora recommends the following settings:
Podcast
This scenario usually uses professional audio hardware devices and requires high-fidelity audio and stereo audio channels. Agora recommends the following settings:
Music education
This scenario mainly requires high-fidelity audio and support for transmitting the audio effects from the local playback to remote users. Agora recommends the following settings:
Collaborative teaching
This scenario mainly requires high-fidelity audio, support for rich audio effects, and no volume or audio quality change when users mute or unmute the microphone. Agora recommends the following settings:
Reference
This section provides useful references for setting the audio profile and scenario.
Sample project
Agora provides an open-source demo project SetAudioProfile that implements setting the audio profile and scenario on GitHub. You can download the sample project and view the source code.
API reference
Volume type
The audio scenario affects the volume type. See What is the difference between the in-call volume and the media volume.