Tune hero peaks and add louder scope switch click

This commit is contained in:
2026-04-15 07:20:28 +00:00
parent 31309e1631
commit 749d45e6f3

26
main.py
View File

@@ -1320,6 +1320,31 @@ INDEX_HTML = """
modeIb: document.getElementById("modeIb"), modeIb: document.getElementById("modeIb"),
}; };
let clickAudioCtx = null;
function playScopeClick() {
try {
if (!clickAudioCtx) {
clickAudioCtx = new (window.AudioContext || window.webkitAudioContext)();
}
const now = clickAudioCtx.currentTime;
const osc = clickAudioCtx.createOscillator();
const gain = clickAudioCtx.createGain();
osc.type = "triangle";
osc.frequency.setValueAtTime(1800, now);
osc.frequency.exponentialRampToValueAtTime(950, now + 0.025);
gain.gain.setValueAtTime(0.0001, now);
gain.gain.linearRampToValueAtTime(0.14, now + 0.0025);
gain.gain.exponentialRampToValueAtTime(0.0001, now + 0.04);
osc.connect(gain);
gain.connect(clickAudioCtx.destination);
osc.start(now);
osc.stop(now + 0.045);
} catch (_) {
// Ignore audio failures silently.
}
}
function normalize(s) { function normalize(s) {
return s.toLowerCase().replace(/ё/g, "е"); return s.toLowerCase().replace(/ё/g, "е");
} }
@@ -1504,6 +1529,7 @@ INDEX_HTML = """
async function switchScope(scope) { async function switchScope(scope) {
if (scope === state.scope) return; if (scope === state.scope) return;
playScopeClick();
state.scope = scope; state.scope = scope;
state.selectedVendors.clear(); state.selectedVendors.clear();
state.selectedCategories.clear(); state.selectedCategories.clear();