Diagnostic : vumètre micro dans l'interface et logs serveur des segments/transcriptions

https://claude.ai/code/session_01YHMp3EKzr4s6o8w1ygxuUe
This commit is contained in:
Claude committed 2026-06-12 11:10:47 +00:00
1 parent 480a380dde
commit b32119d5c0
4 files changed
+31

No files matched your search

+11
View File
@@ -63,12 +63,22 @@ async function startRecording() {
}
function queuePcm(samples) {
updateVu(samples);
if (!state.recording || !state.ws || state.ws.readyState !== WebSocket.OPEN) return;
state.sendBuffer.push(samples);
state.sendBufferSamples += samples.length;
if (state.sendBufferSamples >= BATCH_SAMPLES) flushPcm();
}
function updateVu(samples) {
let peak = 0;
for (let i = 0; i < samples.length; i += 4) {
const v = Math.abs(samples[i]);
if (v > peak) peak = v;
}
$('vu-bar').style.width = Math.min(100, (peak / 32768) * 140) + '%';
}
function flushPcm() {
if (!state.sendBufferSamples) return;
const out = new Int16Array(state.sendBufferSamples);
@@ -97,6 +107,7 @@ function stopRecording(abrupt = false) {
$('record-btn').textContent = '● Démarrer';
$('record-btn').classList.remove('recording');
$('title').disabled = false;
$('vu-bar').style.width = '0%';
}
function onServerMessage(event) {