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 RTC SDK to set the appropriate audio profile (profile
) and audio scenario (scenario
).
This article describes how to use the Agora RTC SDK to set the audio profile and scenario in your app.
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 AgoraAudioScenarioEducation
to obtain a highly smooth and stable audio experience.
The SDK uses the AgoraAudioProfileDefault
profile and the AgoraAudioScenarioDefault
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.
Before setting the audio profile and scenario, ensure that you have implemented the basic real-time communication functions in your project. See the Quickstart Guides for details:
This section describes how to set the audio profile and scenario for common business scenarios. You can add the following sample code to your project.
This scenario mainly requires good call quality with smooth transmission. Agora recommends using the SDK default settings.
// swift
agoraKit.setAudioProfile(.default, scenario: .default)
// objective-c
[agoraKit setAudioProfile: AgoraAudioProfileDefault, scenario: AgoraAudioScenarioDefault]
This scenario mainly requires voice clarity, no noise, and a lower bitrate. Agora recommends the following settings:
// swift
agoraKit.setAudioProfile(.speechStandard, scenario: .chatRoomGaming)
// objective-c
[agoraKit setAudioProfile: AgoraAudioProfileSpeechStandard, scenario: AgoraAudioScenarioChatRoomGaming]
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:
// swift
agoraKit.setAudioProfile(.musicStandard, scenario: .chatRoomEntertainment)
// objective-c
[agoraKit setAudioProfile: AgoraAudioProfileMusicStandard, scenario: AgoraAudioScenarioChatRoomEntertainment]
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:
// swift
agoraKit.setAudioProfile(.musicHighQuality, scenario: .gameStreaming)
// objective-c
[agoraKit setAudioProfile: AgoraAudioProfileMusicHighQuality, scenario: AgoraAudioScenarioGameStreaming]
This scenario usually uses professional audio hardware devices and requires high-fidelity audio and stereo audio channels. Agora recommends the following settings:
// swift
agoraKit.setAudioProfile(.musicHighQualityStereo, scenario: .showRoom)
// objective-c
[agoraKit setAudioProfile: AgoraAudioProfileMusicHighQualityStereo, scenario: AgoraAudioScenarioShowRoom]
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:
// swift
agoraKit.setAudioProfile(.musicStandardStereo, scenario: .gameStreaming)
// objective-c
[agoraKit setAudioProfile: AgoraAudioProfileMusicStandardStereo, scenario: AgoraAudioScenarioGameStreaming]
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:
// swift
agoraKit.setAudioProfile(.musicStandardStereo, scenario: .chatRoomEntertainment)
// objective-c
[agoraKit setAudioProfile: AgoraAudioProfileMusicStandardStereo, scenario: AgoraAudioScenarioChatRoomEntertainment]
This section provides useful references for setting the audio profile and scenario.
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.
The audio scenario affects the volume type. See What is the difference between the in-call volume and the media volume.