High-fidelity audio is essential for professional audio scenarios, such as for podcasts and singing competitions. For example, podcasts require stereo and high-fidelity audio. High-fidelity audio refers to an audio profile with a 48-KHz sampling rate and a 192-Kbps bitrate.
Before proceeding, ensure that you have prepared the development environment. See Integrate the SDK for more information.
The Agora SDK provides the setAudioProfile method for developers to set appropriate audio profiles according to the scenarios. This method has two parameters:
profilesets the sampling rate, bitrate, encoding mode, and the number of channels.
scenariosets the audio application scenario. For example, entertainment, education, or live gaming. The SDK optimizes the noise control and audio quality based on the scenarios.
// swift // Gaming agoraKit.setAudioProfile(.speechStandard, scenario: .chatRoomGaming) // Entertainment agoraKit.setAudioProfile(.musicStandard, scenario: .chatRoomEntertainment) // KTV agoraKit.setAudioProfile(.musicHighQuality, scenario: .chatRoomEntertainment) // FM high-fidelity agoraKit.setAudioProfile(.musicHighQuality, scenario: .gameStreaming)
// objective-c // Gaming [agoraKit setAudioProfile: AgoraAudioProfileSpeechStandard scenario: AgoraAudioScenarioChatRoomGaming]; // Entertainment [agoraKit setAudioProfile: AgoraAudioProfilemusicStandard, scenario: AgoraAudioScenarioChatRoomEntertainment]; // KTV [agoraKit setAudioProfile: AgoraAudioProfileMusicHighQuality, scenario: AgoraAudioScenarioChatRoomEntertainment]; // FM high-fidelity [agoraKit setAudioProfile: AgoraAudioProfilemusicHighQuality, scenario: AgoraAudioScenarioGameStreaming]
- Call the setAudioProfile method before joining the channel.
scenarioparameter takes effect only when the channel profile is live broadcast.