Transcribes recorded or live microphone audio in real time using the OpenAI Whisper ASR API.
Branches ahead of main
These branches have commits not yet on main — could be unmerged fixes or work in progress worth a look.
README
ofxWhisper
ofxWhisper is an openFrameworks addon for transcribing recorded audio or audio files in real-time. This addon sends audio data and uses the OpenAI Whisper ASR API to convert the audio data into text.Features
- Transcribe audio file
- Real-time transcription of mic input
- Thread-safe implementation
Usage
Setup
1. Copy the
ofxWhisper folder to the of_v0.X.X_addons/ directory. 2. Add the following dependencies to your project:- ofxPoco (oF default addon)
- arturoc/ofxHttpUtils
- npisanti/ofxAudioFile
- roymacdonald/ofxSoundObjects
Create and initialize an instance
#include "ofxWhisper.h"
ofxWhisper whisper;
void ofApp::setup() {
whisper.setup("your_api_key_here");
whisper.setupRecorder(); // Optionally pass a sound device ID
}Transcribe from file
``
whisper.transcript("sample_speech.mp3");
void ofApp::update() { // Check if the transcript is ready if (whisper.hasTranscript()) { transcript = whisper.getNextTranscript(); transcriptReady = true; } }
Record and transcript
// Space key to record and transcript void ofApp::keyPressed(int key){ if(key == ' '){ if(recorder.isRecording()){ recorder.stopRecording(); }else{ recorder.startRecording(ofToDataPath(ofGetTimestampString()+".wav", true)); } } }
``
ofxAddons