diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-10 12:45:52 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-10 12:45:52 +0100 |
| commit | c30385b92ff767f8aaff58bf0bc1e5c42ce9036c (patch) | |
| tree | 724f3fca1eacf2ba2cd3d7046befd8b464e42e97 /static/wav.js | |
| parent | c8f5a1e68d3294d4e1c7be3c386f3cc538eeb7af (diff) | |
| download | deck-it-c30385b92ff767f8aaff58bf0bc1e5c42ce9036c.tar.gz deck-it-c30385b92ff767f8aaff58bf0bc1e5c42ce9036c.zip | |
fix(assistant): voice-only tab, tools in an overlay, silent clips dropped
The first voice question on the tablet was a 0.66 s silent clip: the
mic gave no feedback until the next poll, an extra tap made a near-empty
recording, and the model invented a question from the silence. The mic
now turns red on the tap itself, and a clip whose loudest sample is
under 1500 (room noise measured ~260, speech 15000+) is not sent.
Typing happens on the PC, so the text field, send button and the ask
action are gone; the bar is a large mic and a stop icon. The presets and
ops move into an overlay opened from the header, so the transcript gets
the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'static/wav.js')
| -rw-r--r-- | static/wav.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/static/wav.js b/static/wav.js index ada6302..b83fae2 100644 --- a/static/wav.js +++ b/static/wav.js @@ -34,6 +34,14 @@ export function encodeWav(samples, rate) { return buf; } +// The loudest sample of a 16-bit WAV from encodeWav, to tell silence. +export function peak(wav) { + const v = new DataView(wav); + let p = 0; + for (let i = 44; i + 1 < wav.byteLength; i += 2) p = Math.max(p, Math.abs(v.getInt16(i, true))); + return p; +} + export async function toWav(blob, rate = 16000) { const ctx = new AudioContext(); try { |
