AudioTranscriber is an iOS app built with SwiftUI and Swift Concurrency that lets users record audio, transcribe it using Apple Speech and Whisper AI, and manage sessions with SwiftData.
- iOS 17.6+
To use the Whisper API transcription feature, you must add your OpenAI API Key to the app’s configuration:
- Open
Info.plist
- Add a API key:
Key: OpenAIAPIKey, Value: Your API key
- Follows MVVM
AudioRecorder
: managesAVAudioEngine
AudioSegmentWriter
: writes segmented audio(30 second) to diskRecordingControlsViewModel
: handles recording state and permission flowTranscriptionQueueManager
: anactor
responsible for concurrent transcription with retry logicWhisperTranscriptionService
: handles up to 5 concurrent transcriptions via Whisper APIAppleTranscriptionService
: fallback if Whisper API fails, Apple Speech-to-Text- SwiftData models:
RecordingSession
andAudioSegment
with a cascading relationship
- Audio is saved in 30-second segments as
.m4a
files - Monitors:
AVAudioSession.routeChangeNotification
to detect headphone/Bluetooth connection changesAVAudioSession.interruptionNotification
to handle phone calls, Siri, etc.
- Automatically pauses/resumes recording based on hardware or system events
- Supports background recording using the
audio
background mode
RecordingSession
has a one-to-many relationship withAudioSegment
(withcascade
delete)- Each
AudioSegment
stores:fileURL
createdAt
transcriptionText
fullTranscription
is dynamically generated by combining all segment texts in order
TranscriptionQueueManager
is implemented as anactor
with:- a task queue and a
maxConcurrentTasks
limit - retry and fallback logic for transcription
- a task queue and a
- Uses
TaskGroup
for concurrent transcription of segments - Applies
@MainActor
where needed - Uses
Sendable
to make sure values passed between tasks are safe and won’t cause race conditions
- Whisper API was not fully tested due to credit limitations. If the API key is not properly set, transcription falls back to Speech-to-Text after 5 retries.
- Testing was skipped due to time constraints.