File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,32 @@ for await (using frame of complex.frames('out', {
6262}
6363```
6464
65+ - ** WhisperTranscriber** : High-level API for automatic speech recognition using OpenAI's Whisper model
66+
67+ ``` typescript
68+ import { Demuxer , Decoder , WhisperTranscriber } from ' node-av/api' ;
69+
70+ // Create transcriber (downloads model automatically if needed)
71+ using transcriber = await WhisperTranscriber .create ({
72+ model: ' base.en' ,
73+ modelDir: ' ./models' ,
74+ language: ' en' ,
75+ useGpu: true ,
76+ });
77+
78+ // Transcribe audio file
79+ await using input = await Demuxer .open (' podcast.mp3' );
80+ using decoder = await Decoder .create (input .audio ());
81+
82+ for await (const segment of transcriber .transcribe (decoder .frames (input .packets ()))) {
83+ const timestamp = ` [${(segment .start / 1000 ).toFixed (1 )}s - ${(segment .end / 1000 ).toFixed (1 )}s] ` ;
84+ console .log (` ${timestamp }: ${segment .text } ` );
85+
86+ // [12.3s - 15.6s]: Welcome to the podcast episode on Node-AV...
87+ // ...
88+ }
89+ ```
90+
6591### Fixed
6692
6793** EOF Handling & Stability Improvements** : Comprehensive improvements to end-of-file handling across the entire API stack:
You can’t perform that action at this time.
0 commit comments