Use smaller files on the SD card #1650 (Firmware ONLY)
Audio Chunking System for Firmware
Overview
This PR introduces a time-based audio chunking system that improves file management, power efficiency, and remote chunk handling via Bluetooth GATT. The system records audio in configurable time-based chunks rather than continuous large files.
Features Added in PR
1. Time-Based Audio Chunking
- Audio recorded in 5-minute chunks (configurable via
CHUNK_DURATION_CYCLES) - Simple filename format:
audio/chunk_NNNNN.bin - Persistent counter ensures unique filenames across device reboots
2. Configurable System
- New Kconfig option:
CONFIG_OMI_ENABLE_AUDIO_CHUNKING - Centralized configuration in
src/sdcard_config.h - Backward compatible with legacy file system when disabled
3. Chunk Lifecycle Management
- Create: Automatic chunk creation and rotation during recording
- Stream: Send chunk files over Bluetooth to connected devices
- Delete: Remove chunks after successful upload
- Monitor: Query chunk counters and status via GATT characteristics
4. Bluetooth GATT Integration
- New characteristics for chunk counter retrieval
- Chunk streaming request characteristic
- Chunk deletion request characteristic
Configuration
Enable chunking in your project config:
CONFIG_OMI_ENABLE_AUDIO_CHUNKING=y
Adjust chunk duration in src/sdcard_config.h:
#define CHUNK_DURATION_CYCLES 600 // 5 minutes (600 × 500ms)
Testing
- Verified chunk creation, rotation, streaming, and deletion
- Counter persistence validated across reboots
- GATT characteristics tested with debug APP, Video attached
Please list all features you have supported with this PR, including your tests, to make sure the firmware fulfills the ticket requirements.
e.g., features: list audio files, transfer the audio bytes (of one file), delete audio file.
@harshithsunku
Please list all features you have supported with this PR, including your tests, to make sure the firmware fulfills the ticket requirements.
e.g., features: list audio files, transfer the audio bytes (of one file), delete audio file.
@harshithsunku
Hi @beastoin ,
I’ve implemented audio file chunking into 5-minute segments and added a few new GATT BLE characteristics:
- List chunk file range
- Delete chunk file
- Download chunk file
For validation and testing, I used my custom built debug tool instead of the mobile app (since I haven’t made app-side changes yet). Here’s a screenshot of the tool in action:
This shows the chunking flow — receiving 440-byte packets, assembling them into files (e.g., ~43 kB for a 10 second chunk), and supporting operations like streaming, downloading, and deletion.
I’ll be tied up with other work for the next two days, but I’ll resume this shortly. Only unit testing is pending — I’ll update with the final PR in a couple of days.
Hi @beastoin ,
I’ve done UT and validated the audio chunking and GATT characteristics firmware changes using my debug tool. A short video demonstration is shown below.
https://github.com/user-attachments/assets/5f484434-35a5-4602-9464-d5481cc8327d
Hi @beastoin ,
Could you please review this PR, Firmware changes are done and tested.
Thanks.
yeah, looks solid. btw, will let you know soon.
yeah, looks solid. btw, will let you know soon.
Hi @beastoin,
Any update on this.
Thanks.
man @harshithsunku,
updates: we have a lot of improvements on sd cards for omi cv1 that i think we could use for devkit as well. so let's go this way:
@TuEmb will help you on this PR with his view on the sd card improvements for omi cv1. you guys will work closely to find the best solution and make PRs that can work for both (we don't need to centralize all the code implementation, but the solution should be).
no worries about the bounties; they're still locked on you, if you do a good job and tu approves your PR, we can pay the bounties. and sorry since my room for this PR is not enough to help us go faster.
close this PR for now, it's too old so we might need a fresh view on the issue. make the final PRs then let me know.
timeframe: 2 weeks.
man @harshithsunku,
updates: we have a lot of improvements on sd cards for omi cv1 that i think we could use for devkit as well. so let's go this way:
@TuEmb will help you on this PR with his view on the sd card improvements for omi cv1. you guys will work closely to find the best solution and make PRs that can work for both (we don't need to centralize all the code implementation, but the solution should be).
no worries about the bounties; they're still locked on you, if you do a good job and tu approves your PR, we can pay the bounties. and sorry since my room for this PR is not enough to help us go faster.
close this PR for now, it's too old so we might need a fresh view on the issue. make the final PRs then let me know.
timeframe: 2 weeks.
Thanks @bestoin! @TuEmb I’ll sync with you on the SD card improvements—let me know the next steps, and share your Discord or any other preferred way to coordinate.
@harshithsunku ping me on Discord
#tu301096