1-
21# nodejs-whisper
32
43Node.js bindings for OpenAI's Whisper model.
54
6-
7-
85[ ![ MIT License] ( https://img.shields.io/badge/License-MIT-green.svg )] ( https://choosealicense.com/licenses/mit/ )
96
10-
11-
127## Features
13-
14- - Automatically convert the audio to WAV format with a 16000 Hz frequency to support the whisper model.
15- - Output transcripts to (.txt .srt .vtt)
16- - Optimized for CPU (Including Apple Silicon ARM)
17- - Timestamp precision to single word
18- - Split on word rather than on token (Optional)
19- - Translate from source language to english (Optional)
20- - Convert audio formet to wav to support whisper model
218
9+ - Automatically convert the audio to WAV format with a 16000 Hz frequency to support the whisper model.
10+ - Output transcripts to (.txt .srt .vtt)
11+ - Optimized for CPU (Including Apple Silicon ARM)
12+ - Timestamp precision to single word
13+ - Split on word rather than on token (Optional)
14+ - Translate from source language to english (Optional)
15+ - Convert audio formet to wav to support whisper model
2216
2317## Installation
2418
25191 . Install ffmpeg and make tools
2620
27- ``` bash
21+ ``` bash
2822sudo apt update
2923sudo apt install ffmpeg build-essential
3024```
@@ -34,38 +28,39 @@ sudo apt install ffmpeg build-essential
3428``` bash
3529 npm i nodejs-whisper
3630```
31+
37322 . Download whisper model
33+
3834``` bash
3935 npx nodejs-whisper download
4036```
4137
42- - NOTE: user may need to install make tool
43-
38+ - NOTE: user may need to install make tool
39+
4440## Usage/Examples
4541
4642``` javascript
4743import path from ' path'
48- import { nodewhisper } from " nodejs-whisper"
44+ import { nodewhisper } from ' nodejs-whisper'
4945
5046// Need to provide exact path to your audio file.
5147const filePath = path .resolve (__dirname , ' YourAudioFileName' )
5248
5349await nodewhisper (filePath, {
5450 modelName: ' base.en' , // Downloaded models name
51+ autoDownloadModelName: ' base.en' , // (optional) autodownload a model if model is not present
5552 whisperOptions: {
5653 outputInText: false , // get output result in txt file
5754 outputInVtt: false , // get output result in vtt file
5855 outputInSrt: true , // get output result in srt file
5956 outputInCsv: false , // get output result in csv file
60- translateToEnglish: false ,// translate from source language to english
57+ translateToEnglish: false , // translate from source language to english
6158 wordTimestamps: false , // Word-level timestamps
6259 timestamps_length: 20 , // amount of dialogue per timestamp pair
6360 splitOnWord: true , // split on word rather than on token
6461 },
6562})
6663
67-
68-
6964// Model list
7065const MODELS_LIST = [
7166 ' tiny' ,
@@ -81,15 +76,12 @@ const MODELS_LIST = [
8176]
8277```
8378
84-
85-
86-
87-
8879## Types
8980
9081```
9182 interface IOptions {
9283 modelName: string
84+ autoDownloadModelName?: string
9385 whisperOptions?: WhisperOptions
9486}
9587
@@ -106,8 +98,6 @@ const MODELS_LIST = [
10698
10799```
108100
109-
110-
111101## Run Locally
112102
113103Clone the project
@@ -140,17 +130,14 @@ Build Project
140130 npm run build
141131```
142132
143-
144133## Made with
145134
146- - [ Whisper OpenAI (using C++ port by: ggerganov)] ( https://github.com/ggerganov/whisper.cpp )
135+ - [ Whisper OpenAI (using C++ port by: ggerganov)] ( https://github.com/ggerganov/whisper.cpp )
147136
148137## Feedback
149138
150139If you have any feedback, please reach out to us at chetanbaliyan10@gmail.com
151140
152-
153141## Authors
154142
155- - [ @chetanXpro ] ( https://www.github.com/chetanXpro )
156-
143+ - [ @chetanXpro ] ( https://www.github.com/chetanXpro )
0 commit comments