v80: обрезка 0.2с в начале записи — убирает щелчок (вместо trimSilence)

This commit is contained in:
“Naeel”
2026-05-23 06:13:46 +04:00
parent 689fa78734
commit f7587a3dcb
5 changed files with 90 additions and 32 deletions
+5 -2
View File
@@ -4,12 +4,15 @@ async function transcribe(blob) {
if (!GROQ_API_KEY) return { text: '', error: 'no_key' };
const tStart = performance.now();
// Обрезаем 0.2с в начале (щелчок) — декодируем → WAV
const trimmedBlob = await trimStartBlob(blob);
const form = new FormData();
form.append('file', blob, 'audio.webm');
form.append('file', trimmedBlob, 'audio.wav');
form.append('model', 'whisper-large-v3');
form.append('language', 'it');
console.log('[HTTP] blob ' + (blob.size/1024).toFixed(1) + 'KB → multipart POST');
console.log('[HTTP] blob ' + (trimmedBlob.size/1024).toFixed(1) + 'KB → multipart POST');
try {
const r = await fetch('https://lang.kube5s.ru/openai/v1/audio/transcriptions', {