whisper-node-ts
Node.js bindings for OpenAI's Whisper.
Base on whisper-node
Features
- Output transcripts to JSON (also .txt .srt .vtt)
- Optimized for CPU (Including Apple Silicon ARM)
- Timestamp precision to single word
Installation
- Add dependency to project
npm install whisper-node-ts
- Download whisper model of choice
npx whisper-node-ts download
Usage
import whisper from "whisper-node-ts";
const transcript = await whisper("example/sample.wav");
console.log(transcript);
Output (JSON)
[
{
start: "00:00:14.310",
end: "00:00:16.480",
speech: "howdy"
}
];
Usage with Additional Options
import whisper from 'whisper-node-ts';
const filePath = "example/sample.wav",
const options = {
modelName: "tiny.en",
modelPath: "/custom/path/to/model.bin",
whisperOptions: {
gen_file_txt: false,
gen_file_subtitle: false,
gen_file_vtt: false,
timestamp_size: 10,
word_timestamps: true
}
}
const transcript = await whisper(filePath, options);
Made with
Roadmap
Modifying whisper-node-ts
npm run dev
- runs nodemon and tsc on '/src/test.ts'
npm run build
- runs tsc, outputs to '/dist' and gives sh permission to 'dist/download.js'