Chapter 755: transcribe()
Core Idea
:::warning Unstable API: This package is experimental for the moment. As we test it, we might make a few changes to the API and switch to a WebGPU-based backend in the future.
Key Concepts
- Requirements
- Example
- Arguments
- channelWaveform
- model
- language?
- onProgress?
- onTranscriptionChunk?
Code Examples
const file = new File([], 'audio.wav');
const channelWaveform = await resampleTo16Khz({
file,
onProgress: (p) => console.log(`Resampling audio (${Math.round(p * 100)}%)...`),
});
const {transcription} = await transcribe({
channelWaveform,
model: 'tiny.en',
onProgress: (p) => console.log(`Transcribing (${Math.round(p * 100)}%)...`),
});
console.log(transcription.map((t) => t.text).join(' '));
- What it demonstrates: Usage pattern for transcribe() from the official docs.
Key Takeaways
- Understand requirements when working with transcribe().
- Understand example when working with transcribe().
- Understand arguments when working with transcribe().
- Understand channelwaveform when working with transcribe().
- Understand model when working with transcribe().
Connects To
- Convert to Captions: related page in the Whisper Web (@remotion/whisper-web) section.
- Download Whisper Model: related page in the Whisper Web (@remotion/whisper-web) section.
- Install Whisper cpp: related page in the Whisper Web (@remotion/whisper-web) section.