A modern, native macOS audio recording application built with SwiftUI and following MVVM architecture. Record from multiple audio sources with real-time visualization and intuitive management.
- Microphone - Record from your built-in or external microphone
- System Audio Microphone - Capture bypass system input audio microphone
- System Audio Speakers - Capture bypass system output audio (speakers/headphones)
- Live waveform display with 50-bar visualization
- Color gradient (blue β cyan β green)
- Smooth animations and RMS-based level calculation
- Works with all recording sources
- Start/Stop recording with one click
- Pause/Resume functionality
- Live recording timer (MM:SS or HH:MM:SS format)
- Visual status indicator (red = recording, orange = paused, gray = stopped)
- View all recordings with metadata:
- Timestamp (date and time)
- Duration
- File size
- Format (M4A/AAC)
- Audio source icon
- Play/Stop recordings directly in the app
- Delete recordings via context menu or keyboard (β«/ββ«)
- Remaining time display during playback
- Selection highlighting
- Automatic microphone permission requests
- Direct link to System Settings if permission denied
- Clear error messages and guidance
- Follows macOS Human Interface Guidelines
- Dark mode support dual color scheme
- Native window controls
- Keyboard shortcuts support Delete
- Focus management for accessibility
The app follows MVVM (Model-View-ViewModel) pattern with clean separation of concerns:
- Combine framework for reactive programming
- Async/await for asynchronous operations CoreData, etc
βββ Models
β βββ Recording (Core Data)
β βββ RecordingData
βββ ViewModels
β βββ AudioInspectorModel
β βββ AudioRecorderVMl
βββ Views
β βββ ContentView
β βββ AudioinspectorView
β βββ Colors
β βββ HeaderView
β βββ RecordingControlsView
β βββ AudioVisualizerView
β βββ RecordingsListView
β βββ RecordingRow
βββ Services
β βββ AudioRecordingService
β βββ AudioPlaybackService
β βββ SystemAudioRecorderSource
β βββ PersistenceController
βββ App
βββ MacVoiceRecorderApp
Services Layer:
AudioRecordingService- Handles audio capture using AVFoundationAudioPlaybackService- Manages audio playbackPersistenceController- Core Data management
ViewModel:
AudioRecorderViewModel- Business logic, state management, and service coordination- Published properties for reactive UI updates
- Proper memory management with weak references
Views:
- SwiftUI-based declarative UI
- Reusable components
- Accessibility support
- SwiftUI - Modern declarative UI framework
- AVFoundation - Audio recording and playback
AVAudioRecorderfor microphone recordingAVAudioEnginefor system audio and mixingAVAudioMixerNodefor combining audio sourcesAVAudioPlayerfor playback
- Core Data - SQL Light DB Persistent storage (programmatic model)
- Combine - Reactive programming with
@Publishedproperties
- Format: M4A (AAC codec)
- Sample Rate: 44.1 kHz
- Channels: Stereo (2)
- Bit Rate: 192 kbps
- Quality: High
- Audio Level Monitoring: RMS (Root Mean Square) calculation with 50ms updates
- Timer Precision: 100ms update interval
- Pause/Resume: Maintains accurate duration tracking across pauses
- Concurrency: Swift 6 compliant with
Sendableconformance
- macOS 12.0 (Monterey) or later
- Xcode 14.0+
- Swift 5.9+
- Clone the repository:
git clone https://github.com/yourusername/audio-recorder-macos.git
cd audio-recorder-macos- Open the project in Xcode:
open AudioRecorder.xcodeproj- Check microphone usage description to
Info.plist:
<key>NSMicrophoneUsageDescription</key>
<string>This app needs microphone access to record audio.</string>-
Check Sendbox microphone usage
-
Change development team
-
Build and run (βR)
- Select audio source using the segmented picker:
- π€ Microphone
- π System Audio
- Click Start Recording
- Monitor the live waveform visualization
- Use Pause/Resume as needed
- Click Stop when finished
- Play: Click the play button next to any recording
- Delete: Right-click β Delete, or select and press β«
- View details: Timestamp, duration, file size, format, and source
β«- Delete selected recording- Standard macOS shortcuts work in context menus
Modify the output settings in AudioRecordingService:
let outputSettings: [String: Any] = [
AVFormatIDKey: Int(kAudioFormatMPEG4AAC),
AVSampleRateKey: 44100.0,
AVNumberOfChannelsKey: 2,
AVEncoderBitRateKey: 192000
]Modify AudioVisualizerView bar count or colors:
@State private var bars: [Float] = Array(repeating: 0, count: 50) // Change countThe MVVM architecture makes testing straightforward:
- Mock
AudioRecordingServiceProtocolfor pecording tests - Mock
AudioPlaybackServiceProtocolfor playback tests - Mock Persistent manager
- Test ViewModels independently of Views
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with β€οΈ using SwiftUI and AVFoundation
- Inspired by modern macOS design principles
- Thanks to the Swift community for best practices
β If you found this project useful, please consider giving it a star!
