High-fidelity audio is essential for professional audio scenarios such as podcasts and singing competitions. Podcasts, for example, 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 192 Kbps.
Before proceeding, ensure that you have read the quickstart guides and implemented basic real-time audio and video functions in your project.
The Agora Web SDK provides the following methods to create audio tracks:
createMicrophoneAudioTrack
createBufferSourceAudioTrack
createCustomAudioTrack
To adjust the audio profile, set the encoderConfig
property in these methods.
You can set encoderConfig
in either of the following ways:
Use preset audio encoder configurations
AgoraRTC.createMicrophoneAudioTrack({
encoderConfig: "high_quality_stereo",
}).then(/**...**/);
Customize audio encoder configurations
AgoraRTC.createMicrophoneAudioTrack({
encoderConfig: {
sampleRate: 48000,
stereo: true,
bitrate: 128,
},
}).then(/**...**/);
Set the audio profile before calling AgoraRTCClient.publish
. After publishing an audio track, you can no longer modify its audio profile.