Omi Device Integration - Complete BLE Recording Support - #8
Conversation
- Add dependencies: flutter_blue_plus, flutter_local_notifications, opus codecs, collection, uuid - Configure iOS Info.plist: Bluetooth permissions and background modes (bluetooth-central, processing) - Configure Android manifest: BLE permissions, foreground service, notifications - Create lib/services/omi/models.dart: BLE UUIDs, audio codecs, device types, button events - Create lib/models/omi_device.dart: Model for paired Omi devices with serialization - Update lib/models/recording.dart: Add RecordingSource enum, deviceId, buttonTapCount fields - Update lib/services/storage_service.dart: Handle WAV files and new metadata (source, deviceId, buttonTapCount) - Create assets/firmware/ directory for future firmware files This phase establishes the foundation for Omi device integration. Next phase will add BLE connection services.
Core BLE Services: - lib/services/omi/device_connection.dart: Base BLE connection class with service discovery, ping/pong, connection management - lib/services/omi/omi_connection.dart: Omi-specific implementation with audio streaming, button events, battery monitoring, codec detection - lib/services/omi/omi_bluetooth_service.dart: Device scanning, discovery, connection management, auto-reconnect support Audio Processing: - lib/utils/audio/wav_bytes_util.dart: WAV file generation from BLE audio stream - Frame assembly from multi-packet BLE data - Codec support: PCM8, PCM16, Opus - WAV header generation - Lost frame detection and recovery State Management: - lib/providers/omi_providers.dart: Riverpod providers for Omi services - omiBluetoothServiceProvider: Main BLE service - connectedOmiDeviceProvider: Current device state - discoveredOmiDevicesProvider: Scanned devices - lastPairedDeviceProvider: Persistent pairing info - Helper functions for device persistence This phase provides the complete BLE infrastructure needed for device communication. Next phase will add the capture service and background recording support.
- Add OmiCaptureService for orchestrating device recordings - Button event handling (single/double/triple tap) - Audio stream capture with WAV file generation - Recording lifecycle management - Integration with StorageService - Add NotificationService for user feedback - Platform check (iOS/Android only) - Recording start/stop notifications - Device connection status notifications - Add PlatformUtils for feature detection - BLE support detection - Background Bluetooth support check - User-friendly error messages - shouldShowOmiFeatures flag - Add DevicePairingScreen - Device scanning UI with signal strength - Connect/disconnect functionality - Platform compatibility check - Connected device info display - Integration with Riverpod providers - Update SettingsScreen - Add Omi Device section with connection status - Navigate to DevicePairingScreen - Platform-aware feature visibility - Connection status indicator - Build tested and passing on macOS
Migrate Omi device firmware from my-omi project into Parachute: **Firmware Structure**: - firmware/devkit/ - Development kit firmware (Seeed XIAO nRF52840) - src/ - C source files (button, mic, transport, codec, etc.) - overlay/ - Hardware pin configurations - prj_*.conf - Build configurations - firmware/boards/ - Custom board definitions - firmware/bootloader/ - MCUboot for OTA updates - firmware/scripts/ - Docker build system **Current Firmware Version**: 2.0.12 - Fixed button detection with 50ms debounce - Corrected active-low button logic - Fixed LED priority (recording > connected > charging) - Mic starts OFF (prevents auto-recording on boot) - Smart tap behavior (1/2/3 taps) **Build System**: - Docker-based cross-platform builds - build-docker.sh - Compile firmware - build-and-integrate.sh - Compile + copy to Flutter assets - Works on macOS (M1/M2/M3), Linux, Windows **Assets**: - assets/firmware/ - Compiled firmware storage for OTA - README with integration instructions **Documentation**: - firmware/README.md - Comprehensive firmware dev guide - dev-docs/firmware-migration-plan.md - Migration strategy - CLAUDE.md - Updated with Omi integration overview **Key Components**: - button.c (18KB) - Smart tap detection, debouncing - transport.c (28KB) - BLE GATT services, audio streaming - mic.c - Audio capture with power control - codec.c - Multi-codec support (PCM8/16, Opus, μLaw) - led.c - Status indicators (red/blue/green) Benefits: - Single source of truth for app + firmware - Coordinated development workflow - Firmware edits directly in Parachute project - Simplified OTA update management Next: Build firmware and test integration
|
Claude finished @unforced's task —— View job PR Review - Omi Device IntegrationI've completed a comprehensive review of this massive PR that adds Omi wearable device integration. Here's my detailed feedback: ✅ StrengthsOverall Architecture
BLE Implementation
Code Quality
|
Local Whisper Implementation ----------------------------- - Add whisper_ggml package (v1.7.0) for on-device transcription - Implement WhisperLocalService with progress tracking and model selection - Add WhisperModelManager for downloading/managing models (tiny, base, small, medium, large) - Create WhisperModelDownloadCard widget for interactive model management UI - Add hybrid transcription mode: OpenAI API (cloud) vs Local (on-device) - Implement auto-transcribe feature (configurable in Settings) - Add transcription progress indicators with status updates - Store preferences: transcription mode, preferred model, auto-transcribe setting Architecture ------------ - New models: WhisperModelType, TranscriptionMode, ModelDownloadProgress, TranscriptionProgress - New services: WhisperLocalService, WhisperModelManager (with proper Riverpod lifecycle) - New providers: whisperModelManagerProvider, whisperLocalServiceProvider, transcriptionModeProvider, autoTranscribeProvider - Extended StorageService with 6 new preference methods - Updated PostRecordingScreen to support hybrid transcription with progress - Redesigned SettingsScreen with transcription mode selector and model management Android Build Fixes -------------------- - Update compileSdk from 34 to 36 (in both app and root build.gradle) - Update minSdk from 19 to 21 (required for opus_flutter_android and whisper_ggml) - Update Android Gradle Plugin from 8.7.3 to 8.9.1 - Add NDK version 29.0.13113456 (required for whisper_ggml) - Enable core library desugaring for Java 8+ API support - Add NDK suppression flag for minSdk warnings - Fix root build.gradle overriding compileSdk for all subprojects Documentation ------------- - Update CLAUDE.md with comprehensive transcription documentation - Add dev-docs/suggested-testing.md with testing audit and recommendations - Add work logs: local-whisper-implementation.md and apk-build-fixes.md Testing ------- - APK builds successfully (113 MB, 36 seconds) - All 27 unit tests passing - Ready for device testing Files Changed: 18 files - New: 4 implementation files, 3 documentation files - Modified: 4 core Dart files, 4 Android config files, 2 dependency files, 1 project doc - Total: 788 insertions(+), 233 deletions(-)
|
Claude finished @unforced's task —— View job PR Review - Omi Device IntegrationI've completed a comprehensive review of this major PR that adds Omi wearable device integration. This is an impressive implementation with ~70K lines of code across 100 files. Review Summary✅ StrengthsOverall Architecture
BLE Implementation
Code Quality
|
Update: Local Whisper Transcription + Android Build FixesThis commit adds on-device transcription capabilities and resolves all Android APK build issues. 🎙️ Local Whisper TranscriptionNew Features:
Architecture:
User Experience:
🔧 Android Build FixesFixed 5 critical build configuration issues:
Result: ✅ APK builds successfully (113 MB, 36 seconds) 📁 Files ChangedNew Implementation Files:
Modified Core Files:
Android Configuration:
Documentation:
📊 Stats
🧪 Testing StatusAutomated:
Manual Testing Needed:
🎯 Key Benefits
📝 Notes
Ready for testing! 🚀 |
- Ignore linux/flutter/ephemeral/ (plugin symlinks) - Ignore macos/Flutter/ephemeral/ (generated configs) - Ignore windows/flutter/ephemeral/ (completeness) These directories are auto-generated by Flutter and should not be tracked.
|
Claude finished @unforced's task —— View job PR Review - Omi Device IntegrationI've completed a comprehensive review of this major feature addition. This is an impressive implementation with substantial scope and good architecture. Here's my detailed analysis: Review Checklist
✅ StrengthsOverall Architecture
BLE Implementation
Local Whisper Integration
Code Quality
|
Device Pairing UI Fix --------------------- - Add connectedDeviceStream to OmiBluetoothService for reactive state updates - Emit connection state changes via StreamController whenever device connects/disconnects - Convert connectedOmiDeviceProvider from Provider to StreamProvider for reactivity - Update Settings screen to handle AsyncValue from StreamProvider - Device connection state now updates immediately in Settings UI This fixes the issue where connecting a device in DevicePairingScreen would not update the connection status in Settings screen. The UI now reactively responds to BLE connection state changes. Opus Codec Initialization Fix ------------------------------ - Initialize Opus codec in main() before app starts - Call initOpus(await opus_flutter.load()) during app initialization - Add try-catch to gracefully handle Opus initialization failures - Add debug logging for successful/failed Opus initialization This fixes the LateInitializationError when recording from Omi device with Opus codec: 'LateInitializationError: Field 'opus' has not been initialized' The opus_dart package requires explicit initialization via initOpus() before use. Without this, any attempt to create a SimpleOpusDecoder fails with the above error. Technical Details ----------------- - OmiBluetoothService now maintains a broadcast StreamController - Stream emits OmiDevice? on connection changes (null when disconnected) - Settings UI watches the stream via StreamProvider - Opus initialization happens early in main(), before any codec usage - Both fixes are non-breaking and backward compatible Testing ------- Device connection status now updates in real-time when: - Connecting from DevicePairingScreen - Disconnecting from device - Device disconnects unexpectedly - Navigating back to Settings after pairing Opus codec now works for: - Recording audio from Omi device with Opus codec (codec ID 20) - Decoding Opus frames to PCM16 WAV format - Handling button tap events that trigger recording
|
Claude finished @unforced's task —— View job PR Review - Omi Device IntegrationI've completed a comprehensive review of this major PR that adds Omi wearable device integration. This is an impressive implementation with substantial scope and good architecture. Here's my detailed analysis: Review Checklist
✅ StrengthsOverall Architecture
BLE Implementation
Local Whisper Integration
Code Quality
|
Omi Device Integration - Complete BLE Recording Support
Overview
This PR adds complete integration with Omi wearable devices, enabling voice recording via Bluetooth Low Energy (BLE). Users can pair an Omi device and use its button to make recordings that appear alongside phone recordings in the app.
What's New
🎙️ Omi Device Recording
📡 BLE Communication Layer
🔧 Firmware Integration
Key Features
User-Facing Features
Device Pairing
Recording from Device
Recording Types (based on button tap count)
Platform Support
Developer Features
Firmware Development
firmware/directorycd firmware && ./scripts/build-docker.sh./scripts/build-and-integrate.shExtensible Architecture
Implementation Details
Phase 1: Foundation (Commit: b0941b6)
RecordingSourceenum (phone, omiDevice)deviceId,buttonTapCountPhase 2: BLE Layer (Commit: 8544a33)
OmiBluetoothService- Device scanning and connectionOmiConnection- BLE GATT communicationWavBytesUtil- Audio packet assembly and WAV generationPhase 3: Capture & UI (Commit: 9db9284)
OmiCaptureService- Recording orchestrationNotificationService- User feedback (iOS/Android)PlatformUtils- Feature detectionDevicePairingScreen- Device management UIPhase 4: Firmware Integration (Commit: c947fa4)
build-and-integrate.shFile Changes
New Files (Major)
Modified Files
Dependencies Added
Testing Checklist
Manual Testing Done
Testing Needed (requires hardware)
Unit Tests
Documentation
User Documentation
Developer Documentation
dev-docs/omi-integration-plan.md- Architecture overviewdev-docs/ble-protocol-spec.md- BLE protocol detailsdev-docs/firmware-migration-plan.md- Firmware migration guidefirmware/README.md- Comprehensive firmware dev guideMigration Notes
Breaking Changes
RecordingSourceenum defaults tophoneBackwards Compatibility
phone)Future Work
Performance Considerations
BLE Audio Streaming
Battery Impact
Storage
Security Considerations
Platform-Specific Notes
iOS
Android
macOS
Commits
Review Notes
Key Files to Review
lib/services/omi/omi_bluetooth_service.dart- BLE connection logiclib/utils/audio/wav_bytes_util.dart- Audio packet assembly (complex)lib/services/omi/omi_capture_service.dart- Recording orchestrationlib/screens/device_pairing_screen.dart- UI implementationfirmware/devkit/src/button.c- Button detection firmwareAreas Needing Special Attention
Screenshots
(Add screenshots of:)
Related Issues
Deployment Notes
Rollback Plan
If issues arise:
mainbranchThis PR represents a major feature addition (~63K lines across 321 files). It's been split into logical phases with comprehensive documentation. The integration is designed to be non-breaking and platform-aware.
Ready for review! 🚀