Hi-fi audio

How to stream high-fidelity audio over WebRTC with LiveKit

For high-quality audio, we provide a preset with our recommended bitrate:

const localParticipant = useLocalParticipant();
const audioTrack = await createLocalAudioTrack({
channelCount: 2,
echoCancellation: false,
noiseSuppression: false,
});
const audioPublication = await localParticipant.publishTrack(audioTrack, {
audioPreset: AudioPresets.musicHighQualityStereo,
dtx: false,
red: false,
});

Highest theoretical quality

The maximum quality audio track that can be published in LiveKit is 510kbps stereo. Note that the listener's playback stack may resample the audio, so the actual playback quality may be lower than the published quality. If you configure a high bitrate, we recommend testing under real-world conditions to find what settings work best for your use case.

For comparison, 256kbps AAC-encoded audio is considered high quality for music streaming services like Spotify.

const localParticipant = useLocalParticipant();
const audioTrack = await createLocalAudioTrack({
channelCount: 2,
echoCancellation: false,
noiseSuppression: false,
});
const audioPublication = await localParticipant.publishTrack(audioTrack, {
audioBitrate: 510000,
dtx: false,
red: false,
});