Fails
Music bed only 6 dB under the voice
Live preview
const ctx = new AudioContext();const voice = new Audio("episode-12-voice.mp3");const music = new Audio("episode-12-music.mp3");// 20 * log10(0.5) = about -6 dBconst musicGain = new GainNode(ctx, { gain: 0.5 }); ctx.createMediaElementSource(voice).connect(ctx.destination);ctx.createMediaElementSource(music).connect(musicGain).connect(ctx.destination);
If both tracks are mastered to the same loudness, a gain of 0.5 leaves the music only about 6 dB below the speech. It needs to be at least 20 dB below, or be possible to turn off.