mirror of
https://github.com/R0m1k3/LiveFlow.git
synced 2026-10-16 11:50:07 +02:00
Diagnostic : vumètre micro dans l'interface et logs serveur des segments/transcriptions
https://claude.ai/code/session_01YHMp3EKzr4s6o8w1ygxuUe
This commit is contained in:
4 files changed
+31
No files matched your search
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user