TranscriptionEngine

Core interface for speech-to-text transcription engines.

Usage Example

val engine = OpenAIWhisperEngine(apiKey = "your-api-key")

recorder.liveAudioFlow?.let { flow ->
val audioFlow = AudioFlow(recorder.format, flow)
engine.transcribe(audioFlow, TranscriptionConfig.Default)
.collect { result ->
when (result) {
is TranscriptionResult.Partial -> println("Hearing: ${result.text}")
is TranscriptionResult.Final -> println("Final: ${result.text}")
is TranscriptionResult.Error -> println("Error: ${result.message}")
}
}
}

Inheritors

Properties

Link copied to clipboard
abstract val isAvailable: Boolean

Whether this engine is currently available for use. Returns true if configured with valid credentials.

Link copied to clipboard

The provider type for this engine.

Functions

Link copied to clipboard
abstract fun release()

Releases any resources held by this engine. After calling this method, the engine should not be used for further transcription.

Link copied to clipboard
abstract fun transcribe(audioFlow: AudioFlow, config: TranscriptionConfig = TranscriptionConfig.Default): Flow<TranscriptionResult>

Transcribes audio from the given AudioFlow in real-time.