1
0

whisperBrowser.ts 472 B

123456789101112131415
  1. import { Transcriber } from "@/hooks/useTranscriber";
  2. export async function transcribeWhisperBrowser(
  3. audio: Float32Array,
  4. transcriber: Transcriber
  5. ) {
  6. console.debug('whisper_browser attempt');
  7. // Since VAD sample rate is the same as Whisper (16000), no resampling needed
  8. const audioCtx = new AudioContext();
  9. const buffer = audioCtx.createBuffer(1, audio.length, 16000);
  10. buffer.copyToChannel(new Float32Array(audio), 0, 0);
  11. transcriber.start(buffer);
  12. }