Set the Audio Profile
Update time: 2025/06/11 16:45:39
The NERTC SDK allows to set profiles for the audio encoding. The document introduces you to deliver specific audio effects by using profile and scenario parameters that are included in the setAudioProfile method.
Overview
Users have varied requirements for audio quality, audio track, noise suppression in different scenarios. For example, parameters and capabilities such as sample rate, bitrate, smoothness and noise suppression need to be set to suit music scenarios such as music live streaming and online KTV. NERTC supports the setting of audio attributes at different levels to satisfy your requirements for audio quality and audio track in different scenarios, and offers quick access to the adjustment of audio attributes to achieve the optimal sound effect in common scenarios.
NERTC SDK offers an option to set multiple audio profile levels and audio scenarios using parameters profile and scenario through setAudioProfile.
Considerations
You need to call setAudioProfile before init. If you call the method after init and before joinChanel, device configurations may fail.
Procedures
Set audio profiles using setAudioProfile before you initialize the SDK.
Set audio profiles
profile represents different audio parameter configurations (audio quality) such as sample rate, bitrate, and encoding mode. The details are shown as follows:
| Audio profile type | Description |
|---|---|
| DEFAULT | Default setting. Audio scenarios: STANDARD. Music scenarios:HIGH_QUALITY |
| STANDARD | Standard quality model. Sample rate: 16kHz. Audio encoding, mono and encoding bitrate are up to 20 Kbps. |
| MIDDLE_QUALITY | Medium quality model. Sample rate: 48 kHz. Music encoding, mono and encoding bitrate are up to 32 Kbps. |
| MIDDLE_QUALITY_STEREO | Medium quality model(stereophonic). Sample rate: 48 kHz. Music encoding, stereo, and encoding bitrate are up to 64 Kbps. |
| HIGH_QUALITY | High quality model. Sample rate: 48 kHz. Music encoding, mono, and encoding bitrate are up to 64 Kbps. |
| HIGH_QUALITY_STEREO | High quality model(stereophonic). Sample rate: 48 kHz. Music encoding, stereo, and encoding bitrate are up to 128 Kbps. |
| STANDARD_EXTEND | Standard extension model. Sample rate: 16 kHz. Music encoding, mono, and encoding bitrate are up to 32 Kbps. |
Set audio scenarios
scenario defines the application scenarios of audios. Voice smoothness, noise suppression and audio quality will be optimized according to scenarios. The following scenarios are available for now:
| Scenario | Description | Volume |
|---|---|---|
| DEFAULT | Default audio scenarios (speech). | Audio and video volume |
| SPEECH | Speech scenario, which is recommendedin an audio and video call. | Audio and video volume |
| MUSIC | Music scenario. In this scenario, the audio quality setting is music-level, featuring high fidelity and super smoothness. It is recommended to be used in scenarios where high audio quality is required, such as online KTV, online vocal concert, music live streaming, and instrument teaching. | Media volume |
| CHATROOM | Voice chat room scenario, in which audio continuity and stability are guaranteed in priority. It is recommended for online voice chatting. This scenario is available only on mobile devices. | Audio and video volume |
In different scenarios, devices have specific volume types.
Recommended parameters
Scenarios parameters |
profile setting |
scenario setting |
Profile |
|---|---|---|---|
| Audio-enabled games | HIGH_QUALITY | CHATROOM | You can save the mobile data and access high-quality audios. Freezes are not triggered though you frequently enable or disable the microphone. In an audio-enabled game, keep voices and reduce noises. |
| Audio chat room(Music scenarios) | HIGH_QUALITY or HIGH_QUALITY_STEREO | MUSIC | Music-level high-quality audio effects allows you with clear audios and background music. You can experience more fun by implementing audio effects feature. |
| Online KTV | HIGH_QUALITY_STEREO | MUSIC | High-quality stereophonic applies to scenarios that require higher audio quality. You can make it more interesting by using multiple audio effects. |
| Interactive live streaming(Music scenarios) | HIGH_QUALITY or HIGH_QUALITY_STEREO | MUSIC or CHATROOM | High-quality audio effects. You can choose mono or stereo in specific live streaming scenarios. We recommend using MUSIC in a music scenario. |
| Music teaching | HIGH_QUALITY | MUSIC | High-quality audio effects and music-level audio capability are ensured. Music teaching applies to scenarios that require higher audio quality. |
|
STANDARD |
SPEECH |
Under a smooth network transmission, ensure a high-quality audio effect. Under a poor network, ensure a stable and smooth audio and video call. In a SPEECH model, you can experience lower echoes, noises and other sounds and clearer audio effects. |
Sample code
NERtcEx.getInstance().setParameters(mRtcParameters); //Set parameters before initialization.
NERtcEx.getInstance().setAudioProfile(mAudioProfile,mAudioScenario);//Set the audio scenario before initialization.
try {
NERtcEx.getInstance().init(getApplicationContext(),Config.APP_KEY,this,null);
} catch (Exception e) {
showToast("SDK initialization failed");
finish();
return;
}
API reference
| Method | Description |
|---|---|
| setAudioProfile | Audio scenario and mode must be set before init. |
| enableLocalAudio | Enable/disable local audio capture and sending. |
| muteLocalAudio | Enable/disable local audio sending. |
| subscribeRemoteAudioStream | Subscribe/unsubscribe to/from a specified audio stream. |
| subscribeAllRemoteAudioStreams | Subscribe/unsubscribe to/from audio streams of all users, which also applies for users entering the room subsequently. |





