mirror of
https://github.com/R0m1k3/LiveFlow.git
synced 2026-10-11 17:27:19 +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
@@ -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(
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
<input id="title" type="text" placeholder="Titre de la réunion (optionnel)">
|
||||
<button id="record-btn" class="record">● Démarrer</button>
|
||||
<span id="timer">00:00</span>
|
||||
<div id="vu" title="Niveau du micro"><div id="vu-bar"></div></div>
|
||||
</section>
|
||||
|
||||
<section id="transcript-panel">
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user