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.
- Transcribe audio file
- Real-time transcription of mic input
- Thread-safe implementation
- Copy the
ofxWhisper
folder to theof_v0.X.X_addons/
directory. - Add the following dependencies to your project:
- ofxPoco (oF default addon)
- arturoc/ofxHttpUtils
- npisanti/ofxAudioFile
- roymacdonald/ofxSoundObjects
#include "ofxWhisper.h"
ofxWhisper whisper;
void ofApp::setup() {
whisper.setup("your_api_key_here");
whisper.setupRecorder(); // Optionally pass a sound device ID
}
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)); } } }