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 sample rate of 48 kHz and a bitrate of 128 Kbps.
To obtain high-fidelity audio during real-time communications, you can choose the appropriate audio profile based on the audio quality, channel, and scenario.
Before setting the audio profile, ensure that you have implemented the basic real-time communication functions in your project. For details, see Start a Voice Call or Start Live Interactive Streaming.
The Agora SDK provides the SetAudioProfile
method to set the appropriate audio profile according to the scenario.
The following diagram shows how to set the audio profile:
You can set the profile and scenario parameters based on the requirements of different applications, such as the audio quality and the audio player.
Parameters | Applications | Options |
---|---|---|
audioProfile | High-fidelity audio | |
Standard audio | ||
No requirement for audio quality | ||
scenario | Prioritize the audio quality and effects | GAME_STREAMING |
Frequently mute/unmute the microphone | CHATROOM_ENTERTAINMENT | |
External audio player | SHOWROOM | |
Gaming noise reduction | CHATROOM_GAMING | |
Smoothness and stability | EDUCATION | |
Use IoT devices with low power consumption | IOT | |
Meeting scenario that mainly contains the human voice | MEETING | |
Stable transmission quality | DEFAULT |
You can also set the profile and scenario parameters based on different applications.
Applications | profile | scenario | Features |
---|---|---|---|
One-to-one classroom | DEFAULT | DEFAULT | Prioritizes the call quality with smooth transmission and high-fidelity audio. |
Battle royale game | SPEECH_STANDARD | CHATROOM_GAMING | Noise reduction and transmits the voice only. Reduces the transmission rate and suitable for multiplayer games. |
Murder mystery game | MUSIC_STANDARD | CHATROOM_ ENTERTAINMENT |
High-fidelity audio encoding and decoding. No volume or audio quality change when you mute/unmute the microphone. |
KTV | MUSIC_HIGH_ QUALITY |
GAME_STREAMING | High-fidelity audio and effects. Adapts to the high-fidelity audio application. |
Podcast | MUSIC_HIGH_ QUALITY_STEREO |
SHOWROOM | High-fidelity audio and stereo panning. Support for professional audio hardware. |
Music education | MUSIC_STANDARD_ STEREO |
GAME_STREAMING | Prioritizes audio quality. Suitable for transmitting live external audio effects. |
Collaborative teaching | MUSIC_STANDARD_ STEREO |
CHATROOM_ ENTERTAINMENT |
High-fidelity audio and effects. No volume or audio quality change when you mute/unmute the microphone. |
// FM high-fidelity
mRtcEngine.SetAudioProfile(AUDIO_PROFILE_TYPE.AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO, AUDIO_SCENARIO_TYPE.AUDIO_SCENARIO_SHOWROOM);
// Gaming
mRtcEngine.SetAudioProfile(AUDIO_PROFILE_TYPE.AUDIO_PROFILE_SPEECH_STANDARD, AUDIO_SCENARIO_TYPE.AUDIO_SCENARIO_CHATROOM_GAMING);
// Entertainment
mRtcEngine.SetAudioProfile(AUDIO_PROFILE_TYPE.AUDIO_PROFILE_MUSIC_STANDARD, AUDIO_SCENARIO_TYPE.AUDIO_SCENARIO_CHATROOM_ENTERTAINMENT);
// KTV
mRtcEngine.SetAudioProfile(AUDIO_PROFILE_TYPE.AUDIO_PROFILE_MUSIC_HIGH_QUALITY, AUDIO_SCENARIO_TYPE.AUDIO_SCENARIO_CHATROOM_ENTERTAINMENT);
Call this method before calling the JoinChannelByKey
method.
When you set the volume of a device, you can set either the in-call volume or the media volume.
The differences between the two types of volumes are as follows:
The audio scenarios in the SetAudioProfile
method use different volume settings.
Audio scenario | Volume setting |
---|---|
GAME_STREAMING | All users use the media volume. |
DEFAULT | |
EDUCATION | |
SHOWROOM | |
CHATROOM_ENTERTAINMENT | All users use the in-call volume. |
CHATROOM_GAMING | All users use the in-call volume. |
IOT | All users use the in-call volume. |
MEETING | All users use the media volume. |
Given the system restrictions, the media volume can be set as 0, but not the in-call volume. Therefore, if you want to adjust the volume to 0, ensure that you set an audio scenario that uses the media volume.