chat.html: make link baud tunable (?baud=N), default 20 for Opus path
The WebRTC Opus codec encodes in 20ms frames and smears the modem's bit edges; at 50 baud a bit is ~one Opus frame, so frames rarely decode. Lower baud gives more audio quanta per symbol and survives the smear. Expose the link baud as ?baud=N (both peers must match) and lower the default to 20 so the default path is more likely to decode. Also log the actual link baud on HELLO instead of the advertised max (which was misleading).
This commit is contained in:
parent
2e8683640f
commit
4e7bd3631a
1 changed files with 7 additions and 2 deletions
|
|
@ -454,7 +454,12 @@ var QRCode;(function(){function QR8bitByte(data){this.mode=QRMode.MODE_8BIT_BYTE
|
|||
* ============================================================== */
|
||||
const ZEBRA_VOL_MARK = 0.80;
|
||||
const ZEBRA_VOL_SPACE = 0.20;
|
||||
const ZEBRA_BAUD_HANDSHAKE = 50;
|
||||
/* Link baud for the whole audio modem (handshake + data). Tunable via ?baud=N
|
||||
* because the WebRTC Opus path encodes in 20ms frames and smears bit edges:
|
||||
* lower baud = more audio quanta per symbol = survives the smear, but slower.
|
||||
* Both peers must use the same value (same default, or same ?baud=). */
|
||||
const _BAUD_PARAM = parseInt(new URLSearchParams(location.search).get('baud'), 10);
|
||||
const ZEBRA_BAUD_HANDSHAKE = (_BAUD_PARAM >= 1 && _BAUD_PARAM <= 1000) ? _BAUD_PARAM : 20;
|
||||
const ZEBRA_BAUD_MIN = 1;
|
||||
const ZEBRA_BAUD_MAX = 100000;
|
||||
const ZEBRA_BAUD_DEFAULT = 10;
|
||||
|
|
@ -1130,7 +1135,7 @@ async function announceHello() {
|
|||
if (!myMaxBaud) myMaxBaud = ZEBRA_BAUD_DEFAULT;
|
||||
const hello = await buildHelloFrame(handle, myMaxBaud);
|
||||
await txFrame(hello, ZEBRA_BAUD_HANDSHAKE);
|
||||
logLine('sys', `tx: HELLO as ${escapeHtml(handle)} (${myMaxBaud} baud)`);
|
||||
logLine('sys', `tx: HELLO as ${escapeHtml(handle)} at ${ZEBRA_BAUD_HANDSHAKE} baud (link)`);
|
||||
}
|
||||
|
||||
/* ============================================================== *
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue