diff --git a/app/main.py b/app/main.py index 4130f3c..826a0c2 100644 --- a/app/main.py +++ b/app/main.py @@ -126,11 +126,15 @@ async def ws_transcribe(ws: WebSocket): seg = await queue.get() if seg is None: return + print(f"[réunion {meeting_id}] segment {seg.t0:.1f}s → {seg.t1:.1f}s " + f"({len(seg.pcm) / 2 / SAMPLE_RATE:.1f}s d'audio), transcription...", flush=True) try: text = await transcribe(seg.pcm) except Exception as exc: + print(f"[réunion {meeting_id}] ERREUR ASR : {exc}", flush=True) await ws.send_json({"type": "error", "message": f"Transcription échouée : {exc}"}) continue + print(f"[réunion {meeting_id}] texte : {text[:80]!r}", flush=True) if not text: continue await db.execute( diff --git a/app/static/app.js b/app/static/app.js index 7b65e69..a49bac3 100644 --- a/app/static/app.js +++ b/app/static/app.js @@ -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) { diff --git a/app/static/index.html b/app/static/index.html index 99c72f4..d4f8fd9 100644 --- a/app/static/index.html +++ b/app/static/index.html @@ -24,6 +24,7 @@ 00:00 +
diff --git a/app/static/style.css b/app/static/style.css index 6708f4d..ea03c74 100644 --- a/app/static/style.css +++ b/app/static/style.css @@ -92,6 +92,21 @@ button.record { background: var(--accent); font-weight: 600; min-width: 130px; } button.record.recording { background: var(--rec); } #timer { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 48px; } +#vu { + width: 70px; + height: 8px; + border-radius: 999px; + background: var(--panel-2); + overflow: hidden; +} +#vu-bar { + height: 100%; + width: 0%; + border-radius: 999px; + background: linear-gradient(90deg, #3dd68c, #ffd166 70%, #e5484d); + transition: width 80ms linear; +} + #transcript-panel { flex: 1; display: flex;