chat.html: single 440 Hz carrier (kill 1 Hz beat under mono codec)

The carrier used 440 Hz (L) / 441 Hz (R) for the stereo Battle Toads mode, but
the modem codec is forced to mono G.711, which downmixes the two tones into a
1 Hz beat — a slow sinusoidal amplitude swell that swamps the level readings.
Use 440 Hz on both channels so the mono downmix is a clean single tone.
This commit is contained in:
Russell Ballestrini 2026-05-28 11:34:04 -04:00
parent ad78c77bfc
commit 2cd3c05fee
No known key found for this signature in database

View file

@ -232,7 +232,7 @@
<span class="note" id="rx-label" style="min-width:3rem; text-align:right">—</span>
</div>
<p class="note">
a 440/441&nbsp;Hz stereo carrier is generated locally. each frame swings the
a 440&nbsp;Hz carrier is generated locally. each frame swings the
output gain MARK (0.80) ↔ SPACE (0.20) per bit. the modulated audio is the
outbound WebRTC track for every connected peer. mic stays off.
</p>
@ -800,7 +800,9 @@ async function startCarrier() {
if (audioCtx.state === 'suspended') await audioCtx.resume();
oscL = audioCtx.createOscillator(); oscR = audioCtx.createOscillator();
oscL.type = 'sine'; oscL.frequency.value = 440;
oscR.type = 'sine'; oscR.frequency.value = 441;
/* same freq on both channels: the codec is mono (G.711), so a 440/441 split
* would downmix into a 1 Hz beat that swamps the amplitude levels. */
oscR.type = 'sine'; oscR.frequency.value = 440;
gainL = audioCtx.createGain(); gainR = audioCtx.createGain();
gainL.gain.value = ZEBRA_VOL_MARK;
gainR.gain.value = ZEBRA_VOL_MARK;
@ -1627,7 +1629,7 @@ $('btn-audio').addEventListener('click', async () => {
$('dot-audio').className = 'dot on';
$('audio-status').textContent = 'online';
$('btn-audio').disabled = true;
logLine('sys', 'carrier started — modulated stereo at 440/441 Hz');
logLine('sys', 'carrier started — modulated 440 Hz');
} catch (e) {
logLine('err', 'carrier failed: ' + e.message);
}