Mic clicks as regular sounds, own clicks off by default

The two clicks now live in the sound settings (toggle, test, custom file,
soundpack import via mic_click_on/off) instead of being fixed tones in the
voice player. Own mic clicks start off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
This commit is contained in:
MoepchiandClaude Opus 5.5 committed 2026-10-23 18:03:04 +00:00
1 parent 97421ff2de
commit 341a1644a6
9 files changed
+49 -19

No files matched your search

+5 -5
View File
@@ -7308,9 +7308,9 @@ function AppInner() {
// Off by default: a heavier, opt-in alternative/supplement to native AEC for // Off by default: a heavier, opt-in alternative/supplement to native AEC for
// speaker+mic (no headset) setups (github.com/WebSpeak3/webspeak3 issue #2). // speaker+mic (no headset) setups (github.com/WebSpeak3/webspeak3 issue #2).
const [aec3Enabled, setAec3Enabled] = useState(() => loadBoolPref(AEC3_ENABLED_KEY, false)); const [aec3Enabled, setAec3Enabled] = useState(() => loadBoolPref(AEC3_ENABLED_KEY, false));
// Playback options, defaults as in TS3. // Playback options. The clicks themselves are sounds (micClickOn/Off).
const [autoVolume, setAutoVolume] = useState(() => loadBoolPref(AUTO_VOLUME_KEY, true)); const [autoVolume, setAutoVolume] = useState(() => loadBoolPref(AUTO_VOLUME_KEY, true));
const [ownMicClicks, setOwnMicClicks] = useState(() => loadBoolPref(OWN_MIC_CLICKS_KEY, true)); const [ownMicClicks, setOwnMicClicks] = useState(() => loadBoolPref(OWN_MIC_CLICKS_KEY, false));
const [otherMicClicks, setOtherMicClicks] = useState(() => loadBoolPref(OTHER_MIC_CLICKS_KEY, false)); const [otherMicClicks, setOtherMicClicks] = useState(() => loadBoolPref(OTHER_MIC_CLICKS_KEY, false));
// Read from the socket handler, which only sees the first render's state. // Read from the socket handler, which only sees the first render's state.
const otherMicClicksRef = useRef(otherMicClicks); const otherMicClicksRef = useRef(otherMicClicks);
@@ -8233,8 +8233,8 @@ function AppInner() {
const prev = talkersRef.current; const prev = talkersRef.current;
if (otherMicClicksRef.current && !outputMutedRef.current) { if (otherMicClicksRef.current && !outputMutedRef.current) {
// One click per update, even if several people start at once. // One click per update, even if several people start at once.
if ([...next].some((id) => !prev.has(id))) audioPlayerRef.current?.playMicClick(true); if ([...next].some((id) => !prev.has(id))) void playSound("micClickOn");
else if ([...prev].some((id) => !next.has(id))) audioPlayerRef.current?.playMicClick(false); else if ([...prev].some((id) => !next.has(id))) void playSound("micClickOff");
} }
talkersRef.current = next; talkersRef.current = next;
setTalkers(next); setTalkers(next);
@@ -10418,7 +10418,7 @@ function AppInner() {
selfTalkingSeenRef.current = true; selfTalkingSeenRef.current = true;
return; return;
} }
if (ownMicClicks && !outputMuted) audioPlayerRef.current?.playMicClick(selfTalking); if (ownMicClicks && !outputMuted) void playSound(selfTalking ? "micClickOn" : "micClickOff");
}, [selfTalking]); // eslint-disable-line react-hooks/exhaustive-deps }, [selfTalking]); // eslint-disable-line react-hooks/exhaustive-deps
const showServerQueryClients = const showServerQueryClients =
activeFavoriteId != null && activeFavoriteId != null &&
+2
View File
@@ -667,6 +667,8 @@
"sounds.event.message": "Přijata zpráva", "sounds.event.message": "Přijata zpráva",
"sounds.event.poke": "Přijato šťouchnutí", "sounds.event.poke": "Přijato šťouchnutí",
"sounds.event.mute": "Přepnutí ztlumení", "sounds.event.mute": "Přepnutí ztlumení",
"sounds.event.micClickOn": "Kliknutí mikrofonu zap.",
"sounds.event.micClickOff": "Kliknutí mikrofonu vyp.",
"sounds.default": "Výchozí", "sounds.default": "Výchozí",
"sounds.custom": "Vlastní soubor: {name}", "sounds.custom": "Vlastní soubor: {name}",
"sounds.test": "▶ Test", "sounds.test": "▶ Test",
+2
View File
@@ -667,6 +667,8 @@
"sounds.event.message": "Nachricht empfangen", "sounds.event.message": "Nachricht empfangen",
"sounds.event.poke": "Anstupsen erhalten", "sounds.event.poke": "Anstupsen erhalten",
"sounds.event.mute": "Stummschaltung umgeschaltet", "sounds.event.mute": "Stummschaltung umgeschaltet",
"sounds.event.micClickOn": "Mikro Klick an",
"sounds.event.micClickOff": "Mikro Klick aus",
"sounds.default": "Standard", "sounds.default": "Standard",
"sounds.custom": "Eigene Datei: {name}", "sounds.custom": "Eigene Datei: {name}",
"sounds.test": "▶ Testen", "sounds.test": "▶ Testen",
+2
View File
@@ -667,6 +667,8 @@
"sounds.event.message": "Message received", "sounds.event.message": "Message received",
"sounds.event.poke": "Poke received", "sounds.event.poke": "Poke received",
"sounds.event.mute": "Mute toggled", "sounds.event.mute": "Mute toggled",
"sounds.event.micClickOn": "Mic click on",
"sounds.event.micClickOff": "Mic click off",
"sounds.default": "Default", "sounds.default": "Default",
"sounds.custom": "Custom file: {name}", "sounds.custom": "Custom file: {name}",
"sounds.test": "▶ Test", "sounds.test": "▶ Test",
+2
View File
@@ -666,6 +666,8 @@
"sounds.event.message": "پیام دریافت شد", "sounds.event.message": "پیام دریافت شد",
"sounds.event.poke": "سقلمه دریافت شد", "sounds.event.poke": "سقلمه دریافت شد",
"sounds.event.mute": "تغییر حالت بی‌صدا", "sounds.event.mute": "تغییر حالت بی‌صدا",
"sounds.event.micClickOn": "کلیک میکروفون روشن",
"sounds.event.micClickOff": "کلیک میکروفون خاموش",
"sounds.default": "پیش‌فرض", "sounds.default": "پیش‌فرض",
"sounds.custom": "فایل سفارشی: {name}", "sounds.custom": "فایل سفارشی: {name}",
"sounds.test": "▶ آزمایش", "sounds.test": "▶ آزمایش",
+2
View File
@@ -512,6 +512,8 @@
"sounds.event.message": "收到消息", "sounds.event.message": "收到消息",
"sounds.event.poke": "收到戳一戳", "sounds.event.poke": "收到戳一戳",
"sounds.event.mute": "切换静音", "sounds.event.mute": "切换静音",
"sounds.event.micClickOn": "麦克风开启提示音",
"sounds.event.micClickOff": "麦克风关闭提示音",
"sounds.default": "默认", "sounds.default": "默认",
"sounds.custom": "自定义文件:{name}", "sounds.custom": "自定义文件:{name}",
"sounds.test": "▶ 测试", "sounds.test": "▶ 测试",
+2
View File
@@ -24,6 +24,8 @@ const EVENT_KEYWORDS: Record<SoundEventId, string[]> = {
message: ["textmessagereceived", "chatmessage", "newmessage", "message"], message: ["textmessagereceived", "chatmessage", "newmessage", "message"],
poke: ["gotpoked", "poke"], poke: ["gotpoked", "poke"],
mute: ["micmuted", "microphonemuted", "micactivated", "microphoneactivated"], mute: ["micmuted", "microphonemuted", "micactivated", "microphoneactivated"],
micClickOn: ["micclickon"],
micClickOff: ["micclickoff"],
}; };
function normalize(filename: string): string { function normalize(filename: string): string {
+29 -2
View File
@@ -1,6 +1,25 @@
export type SoundEventId = "connect" | "disconnect" | "clientJoin" | "clientLeave" | "message" | "poke" | "mute"; export type SoundEventId =
| "connect"
| "disconnect"
| "clientJoin"
| "clientLeave"
| "message"
| "poke"
| "mute"
| "micClickOn"
| "micClickOff";
export const SOUND_EVENTS: SoundEventId[] = ["connect", "disconnect", "clientJoin", "clientLeave", "message", "poke", "mute"]; export const SOUND_EVENTS: SoundEventId[] = [
"connect",
"disconnect",
"clientJoin",
"clientLeave",
"message",
"poke",
"mute",
"micClickOn",
"micClickOff",
];
/** "ide" swaps the default chimes for synthetic terminal blips (Command Center layout). */ /** "ide" swaps the default chimes for synthetic terminal blips (Command Center layout). */
type SoundStyle = "classic" | "ide"; type SoundStyle = "classic" | "ide";
@@ -215,6 +234,10 @@ function synthNotes(event: SoundEventId): SynthNote[] {
]; ];
case "mute": case "mute":
return [{ delay: 0, freq: 660, duration: 0.06, gain: 0.3 }]; return [{ delay: 0, freq: 660, duration: 0.06, gain: 0.3 }];
case "micClickOn":
return [{ delay: 0, freq: 1400, duration: 0.03, gain: 0.15 }];
case "micClickOff":
return [{ delay: 0, freq: 900, duration: 0.03, gain: 0.15 }];
} }
} }
@@ -247,6 +270,10 @@ function ideNotes(event: SoundEventId): SynthNote[] {
]; ];
case "mute": case "mute":
return [{ delay: 0, freq: 300, endFreq: 50, duration: 0.04, gain: 0.15, type: "square" }]; return [{ delay: 0, freq: 300, endFreq: 50, duration: 0.04, gain: 0.15, type: "square" }];
case "micClickOn":
return [{ delay: 0, freq: 1600, duration: 0.02, gain: 0.08, type: "square" }];
case "micClickOff":
return [{ delay: 0, freq: 1000, duration: 0.02, gain: 0.08, type: "square" }];
} }
} }
+3 -12
View File
@@ -447,25 +447,16 @@ export class AudioPlayer {
/** Plays a short sine-wave test tone through the same volume/output-device routing as voice playback. */ /** Plays a short sine-wave test tone through the same volume/output-device routing as voice playback. */
playTestTone(): void { playTestTone(): void {
this.beep(440, 0.6, 0.3);
}
/** Short tick when someone starts (higher) or stops (lower) talking. */
playMicClick(start: boolean): void {
this.beep(start ? 1400 : 900, 0.03, 0.15);
}
private beep(freq: number, duration: number, volume: number): void {
const osc = this.context.createOscillator(); const osc = this.context.createOscillator();
osc.type = "sine"; osc.type = "sine";
osc.frequency.value = freq; osc.frequency.value = 440;
const toneGain = this.context.createGain(); const toneGain = this.context.createGain();
toneGain.gain.value = volume; toneGain.gain.value = 0.3;
osc.connect(toneGain); osc.connect(toneGain);
toneGain.connect(this.gain); toneGain.connect(this.gain);
const now = this.context.currentTime; const now = this.context.currentTime;
osc.start(now); osc.start(now);
osc.stop(now + duration); osc.stop(now + 0.6);
osc.onended = () => { osc.onended = () => {
osc.disconnect(); osc.disconnect();
toneGain.disconnect(); toneGain.disconnect();