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.
Ensure that you prepared the development environment. See Integrate the SDK.
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.
Besides the stereo and high-fidelity audio qualities, the following sample code shows the frequently used parameter settings for your reference.
// FM high-fidelity rtcEngine.setAudioProfile(Constants.AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO, Constants.AUDIO_SCENARIO_SHOWROOM); // Gaming rtcEngine.setAudioProfile(Constants.AUDIO_PROFILE_SPEECH_STANDARD, Constants.AUDIO_SCENARIO_CHATROOM_GAMING); // Entertainment rtcEngine.setAudioProfile(Constants.AUDIO_PROFILE_MUSIC_STANDARD, Constants.AUDIO_SCENARIO_CHATROOM_ENTERTAINMENT); // KTV rtcEngine.setAudioProfile(Constants.AUDIO_AUDIO_PROFILE_MUSIC_HIGH_QUALITY, Constants.AUDIO_SCENARIO_CHATROOM_ENTERTAINMENT);
- Call the setAudioProfile method before joining the channel.
scenarioparameter takes effect only when the channel profile is live broadcast.