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.
Before adjusting the audio volume, ensure that you have implemented the basic real-time communication functions in your project. For details, see Start a Call or Start Live Interactive Streaming.
The Agora Web SDK provides the setAudioProfile
method for developers to set appropriate audio profiles according to the scenarios. The profile
parameter sets the sampling rate, bitrate, and encoding mode.
The following diagram shows how to set the audio profile:
// Sets the audio profile with a 48-kHz sampling rate, stereo sound, and 192-Kbps bitrate.
localStream.setAudioProfile("high_quality_stereo");
localStream.init(function(){
// Initialization successful.
});
setAudioProfile
method before Stream.init
.