whisper-node-anas

Node.js bindings for OpenAI's Whisper.(Updated with latest whisper.cpp September 2023)
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-anas
- Download whisper model of choice
npx whisper-node-anas download
Usage
import whisper from "whisper-node-anas";
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-anas';
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-anas
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'