import { useCallStateHooks, SfuModels } from "@stream-io/video-react-sdk";
const { useMicrophoneState } = useCallStateHooks();
const { microphone } = useMicrophoneState();
await microphone.setAudioBitrateProfile(
SfuModels.AudioBitrateProfile.MUSIC_HIGH_QUALITY,
);
High Fidelity and Stereo Audio
For scenarios like live music, karaoke, podcasts, or professional streaming, you may want to deliver audio that sounds natural and unprocessed. Our SDK provides APIs that let you tune the audio pipeline for higher fidelity. External high-quality microphones are also supported.
HiFi Mode
The fastest way to enable high-quality audio is by turning on HiFi mode. This is an all-in-one switch that does three things under the hood:
- Enables stereo capture – your app will record and transmit two channels instead of mono.
- Studio quality bitrate – switches to a high-quality music bitrate.
- Disables audio processing – echo cancellation, noise suppression, and automatic gain control are turned off.
Allow HiFi audio on the call type
HiFi audio is allowed by default on the livestream
call type.
You can enable it on other call types by toggling the Allow HiFi audio
setting in the call type settings.
This setting is available in the Stream Dashboard, under Video & Audio > Call Types > [call type] > Settings > Allow HiFi audio
Microphone Hi-Fi mode
Screen Share Audio Hi-Fi mode
By default, screen share audio will be published in hi-fi mode and stereo. To override that behavior, please check the following example.
Fine-grained call controls
In the following example, we are going to build a Call Controls button that allows you to toggle between HiFi and standard audio at any time during the call:
import { useCallback } from "react";
import { useCallStateHooks, SfuModels } from "@stream-io/video-react-sdk";
export const ToggleHiFiButton = () => {
const { useMicrophoneState, useCallSettings } = useCallStateHooks();
// checks if the call type settings allow HiFi audio to be enabled
const settings = useCallSettings();
const allowHiFi = settings?.audio.hifi_audio_enabled ?? false;
// checks if the microphone is in HiFi mode
const { microphone, audioBitrateProfile } = useMicrophoneState();
const isPublishingInHighQuality =
audioBitrateProfile === SfuModels.AudioBitrateProfile.MUSIC_HIGH_QUALITY;
// handles the togglling between hi-fi stereo and standard mono audio
const toggleHiFi = useCallback(async () => {
try {
await microphone.setAudioBitrateProfile(
isPublishingInHighQuality
? SfuModels.AudioBitrateProfile.VOICE_STANDARD_UNSPECIFIED
: SfuModels.AudioBitrateProfile.MUSIC_HIGH_QUALITY,
);
} catch (error) {
console.error("Failed to toggle Hi-Fi audio:", error);
}
}, [isPublishingInHighQuality, microphone]);
// the call type doesn't allow HiFi audio, so we don't render the button
if (!allowHiFi) return null;
return (
<button onClick={toggleHiFi} disabled={!allowHiFi}>
{isHiFi ? "Disable HiFi" : "Enable HiFi"}
</button>
);
};