Skip to content
This repository was archived by the owner on Dec 9, 2025. It is now read-only.
This repository was archived by the owner on Dec 9, 2025. It is now read-only.

Memory-efficient streaming for long Omi device recordings #9

Description

@unforced

Problem

Currently, audio frames accumulate in memory during Omi device recordings. For very long recordings (>30 minutes), this could cause memory pressure or OOM errors.

Location: lib/utils/audio/wav_bytes_util.dart:16-17

List<List<int>> frames = [];
List<List<int>> rawPackets = [];

Suggested Solution

Implement one of the following approaches:

  1. Streaming to disk: Write frames to temporary file during recording

    static const int MAX_FRAMES_IN_MEMORY = 1000; // ~30 seconds at 16kHz
    if (frames.length > MAX_FRAMES_IN_MEMORY) {
      _flushToTemporaryFile();
    }
  2. Circular buffer: Keep only recent frames in memory and stream older ones

  3. Chunked processing: Process and write audio in chunks during recording

Benefits

  • Prevents OOM errors for long recordings
  • Reduces memory footprint
  • Enables unlimited recording length

Priority

Medium - Only affects edge cases (very long recordings)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions