diff --git a/web/src/App.tsx b/web/src/App.tsx index c64cc90..74ec081 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -8743,26 +8743,11 @@ function AppInner() { tabAudioRef.current = stream; micCaptureRef.current?.setExtraAudio(stream); setTabAudioOn(true); - // Windows system audio only covers the default output device; music on - // another device arrives as pure silence, with nothing else to tell why. - setTimeout(async () => { + // Windows system audio can arrive as pure silence (seen in Edge, with or + // without the mic open), with nothing else to tell why. + setTimeout(() => { if (tabAudioRef.current !== stream || !micCaptureRef.current || micCaptureRef.current.extraPeak >= 1e-4) return; appendLog({ text: t("tabAudio.silent"), kind: "error" }); - // ponytail: temporary diagnostics - tells "browser delivers silence" - // apart from "the mixer loses it"; drop once the Edge report is solved. - const probe = new AudioContext(); - void probe.resume(); - const analyser = probe.createAnalyser(); - probe.createMediaStreamSource(new MediaStream([track])).connect(analyser); - await new Promise((r) => setTimeout(r, 1500)); - const data = new Float32Array(analyser.fftSize); - analyser.getFloatTimeDomainData(data); - const direct = data.reduce((m, v) => Math.max(m, Math.abs(v)), 0); - appendLog({ - text: `Diag: direct=${direct.toFixed(5)} mixer=${micCaptureRef.current?.extraPeak.toFixed(5)} muted=${track.muted} state=${track.readyState} enabled=${track.enabled} probe=${probe.state} settings=${JSON.stringify(track.getSettings())}`, - kind: "error", - }); - void probe.close(); }, 5000); }; diff --git a/web/src/locales/de.json b/web/src/locales/de.json index a48b61a..d128f7d 100644 --- a/web/src/locales/de.json +++ b/web/src/locales/de.json @@ -93,7 +93,7 @@ "tabAudio.start": "Ton eines Tabs oder Fensters in den Sprachkanal geben (mit Kopfhörer kein Echo)", "tabAudio.stop": "Ton-Freigabe beenden", "tabAudio.noAudio": "Es wurde kein Ton freigegeben. Im Auswahldialog einen Tab oder ein Fenster wählen und den Ton einschalten.", - "tabAudio.silent": "Der geteilte Ton ist seit 5 Sekunden still. Bei „Systemaudio“ nimmt der Browser nur das Windows-Standard-Wiedergabegerät auf. Läuft die Musik auf einem anderen Gerät, kommt nichts an.", + "tabAudio.silent": "Vom geteilten Ton kommt seit 5 Sekunden nichts an. Systemaudio liefert nicht auf jedem Windows-Rechner Ton. Teile stattdessen einen Browser-Tab, zum Beispiel Spotify im Web oder YouTube, mit eingeschaltetem „Tab-Audio teilen“.", "toolbar.muteSound": "Ton stummschalten (Ausgabe stumm)", "toolbar.unmuteSound": "Ton aktivieren (Ausgabe an)", "toolbar.chooseOutputDevice": "Wiedergabegerät wählen", diff --git a/web/src/locales/en.json b/web/src/locales/en.json index 1a3de93..1ed0b3e 100644 --- a/web/src/locales/en.json +++ b/web/src/locales/en.json @@ -93,7 +93,7 @@ "tabAudio.start": "Share tab or window audio into the voice channel (headphones avoid an echo)", "tabAudio.stop": "Stop sharing audio", "tabAudio.noAudio": "No audio was shared. In the picker, choose a tab or window and turn on its audio.", - "tabAudio.silent": "The shared audio has been silent for 5 seconds. With \"system audio\" the browser only captures the Windows default playback device; music playing on another device doesn't come through.", + "tabAudio.silent": "Nothing has come through from the shared audio for 5 seconds. System audio doesn't deliver sound on every Windows machine; share a browser tab instead (e.g. Spotify on the web or YouTube) with \"Share tab audio\" turned on.", "toolbar.muteSound": "Mute sound (deafen)", "toolbar.unmuteSound": "Unmute sound (undeafen)", "toolbar.chooseOutputDevice": "Choose output device", diff --git a/web/src/locales/fa.json b/web/src/locales/fa.json index af0289f..65e0f03 100644 --- a/web/src/locales/fa.json +++ b/web/src/locales/fa.json @@ -93,7 +93,7 @@ "tabAudio.start": "صدای یک زبانه یا پنجره را در کانال صوتی پخش کن (با هدفون پژواک ایجاد نمی‌شود)", "tabAudio.stop": "توقف اشتراک صدا", "tabAudio.noAudio": "صدایی به اشتراک گذاشته نشد. در پنجره انتخاب، یک زبانه یا پنجره را انتخاب و صدای آن را روشن کنید.", - "tabAudio.silent": "صدای اشتراک‌گذاشته‌شده ۵ ثانیه است که بی‌صداست. با «صدای سیستم»، مرورگر فقط دستگاه پخش پیش‌فرض ویندوز را ضبط می‌کند؛ موسیقی‌ای که روی دستگاه دیگری پخش شود منتقل نمی‌شود.", + "tabAudio.silent": "۵ ثانیه است که از صدای اشتراک‌گذاشته‌شده چیزی نمی‌رسد. صدای سیستم روی همهٔ رایانه‌های ویندوزی صدا نمی‌دهد؛ به‌جای آن یک زبانهٔ مرورگر (مثلاً Spotify وب یا YouTube) را با روشن بودن «اشتراک صدای زبانه» به اشتراک بگذارید.", "toolbar.muteSound": "بی‌صدا کردن صدا (کر کردن)", "toolbar.unmuteSound": "فعال کردن صدا", "toolbar.chooseOutputDevice": "انتخاب دستگاه خروجی", diff --git a/web/src/locales/zh-CN.json b/web/src/locales/zh-CN.json index 94013e9..bc2032e 100644 --- a/web/src/locales/zh-CN.json +++ b/web/src/locales/zh-CN.json @@ -46,7 +46,7 @@ "tabAudio.start": "将标签页或窗口的声音共享到语音频道(戴耳机可避免回声)", "tabAudio.stop": "停止共享声音", "tabAudio.noAudio": "没有共享声音。请在选择窗口中选择标签页或窗口,并开启其声音。", - "tabAudio.silent": "共享的声音已静音 5 秒。使用“系统音频”时,浏览器只录制 Windows 默认播放设备;在其他设备上播放的音乐不会被传送。", + "tabAudio.silent": "共享的声音已 5 秒没有任何内容。系统音频并非在每台 Windows 电脑上都有声音;请改为共享浏览器标签页(例如网页版 Spotify 或 YouTube),并开启“共享标签页音频”。", "toolbar.muteSound": "关闭声音(拒听)", "toolbar.unmuteSound": "开启声音(取消拒听)", "toolbar.chooseOutputDevice": "选择输出设备", diff --git a/web/src/voice.ts b/web/src/voice.ts index 4f755fe..4866cf5 100644 --- a/web/src/voice.ts +++ b/web/src/voice.ts @@ -169,12 +169,18 @@ export class MicCapture { this.extraPeak = Math.max(this.extraPeak, Math.abs(extra[i])); } } + // AEC3's blocks make the two queues jitter against each other. Padding + // a short extra queue with silence clicks; skip it once instead, which + // leaves it a frame ahead from then on. Cap the lead to bound latency. + if (this.pendingExtra.length > 4 * FRAME_SAMPLES) this.pendingExtra.splice(0, this.pendingExtra.length - 2 * FRAME_SAMPLES); while (this.pending.length >= FRAME_SAMPLES) { const frame = this.pending.splice(0, FRAME_SAMPLES); - const extra = this.pendingExtra.splice(0, FRAME_SAMPLES); + const extra = this.pendingExtra.length >= FRAME_SAMPLES ? this.pendingExtra.splice(0, FRAME_SAMPLES) : []; const int16 = new Int16Array(FRAME_SAMPLES); for (let i = 0; i < FRAME_SAMPLES; i++) { - const clamped = Math.max(-1, Math.min(1, frame[i] + (extra[i] ?? 0))); + // Shared music is mastered near full scale; at -6 dB it leaves room + // for the voice on top instead of clipping. + const clamped = Math.max(-1, Math.min(1, frame[i] + (extra[i] ?? 0) * 0.5)); int16[i] = clamped < 0 ? clamped * 32768 : clamped * 32767; } this.onFrame(int16ToBase64(int16));