Meetily Real-Time Audio Metrics: What the Pipeline Emits and How to Monitor It

Meetily's audio pipeline emits chunk-level metrics including timestamps, sample counts, duration, and average audio levels, batching them into summaries every 50 chunks or 5 seconds for live diagnostics.

The open-source Meetily project (Zackriya-Solutions/meetily) implements a Rust-based audio processing pipeline that exposes detailed performance telemetry through its internal metrics system. As the pipeline processes PCM audio chunks, it captures granular data about each chunk's characteristics and aggregates these into consumable summaries for real-time monitoring.

Per-Chunk Audio Metrics (What Gets Captured)

The pipeline creates an AudioMetric for every processed audio chunk. These metrics are instantiated within the processing loop in src-tauri/src/audio/pipeline.rs and provide the raw data needed for health monitoring and Voice Activity Detection (VAD) analysis.

The AudioMetric Structure

Each individual metric records five specific fields:

  • Timestamp – The exact moment when the chunk was processed.
  • Chunk ID – A sequential identifier tracking the order of audio chunks.
  • Sample count – The number of PCM samples contained in the chunk.
  • Duration (ms) – Calculated from the sample count and sample rate (len / sample_rate * 1000.0).
  • Average level – The mean absolute sample amplitude, used for real-time level monitoring.

The average level calculation uses the absolute value of each sample to determine the mean amplitude: sum(|x|) / len. This provides a reliable indicator of audio presence and volume intensity without complex signal processing.

Batching and Aggregation (How Metrics Are Grouped)

Raw per-chunk metrics are grouped using an AudioMetricsBatcher to reduce overhead and provide meaningful statistical summaries. The batching logic is implemented in src-tauri/src/audio/batch_processor.rs.

The batcher triggers a summary emission under two conditions, whichever occurs first:

  • Batch size: After accumulating 50 individual AudioMetric records.
  • Time window: Every 5 seconds of processing time.

This hybrid approach ensures that high-volume streams don't overwhelm the diagnostic system while guaranteeing regular updates during low-activity periods.

The AudioMetricsSummary Structure

Each emitted AudioMetricsSummary contains aggregated statistics across the batch:

  • Total chunks processed in the batch.
  • Total samples processed across all chunks.
  • Cumulative audio duration in milliseconds.
  • Average audio level across the entire batch.
  • Timespan of the batch (start to end timestamp).
  • Chunks per second (processing rate).

These summaries are accessible via the metrics_batcher field on the pipeline instance and can be consumed by the UI thread for live dashboard updates.

Implementation in the Source Code

The metric collection occurs within the core audio processing loop in src-tauri/src/audio/pipeline.rs. Each chunk triggers a calculation of its average level and duration before being passed to the batching macro.

// Inside the pipeline loop – one metric per chunk
let avg_level = chunk.data.iter().map(|&x| x.abs()).sum::<f32>() / chunk.data.len() as f32;
let duration_ms = chunk.data.len() as f64 / chunk.sample_rate as f64 * 1000.0;

batch_audio_metric!(
    Some(batcher),          // the AudioMetricsBatcher
    chunk.chunk_id,
    chunk.data.len(),
    duration_ms,
    avg_level
);

The batch_audio_metric! macro (defined in src-tauri/src/audio/batch_processor.rs) handles the accumulation logic and automatic summary generation when thresholds are met.

To access the aggregated data for display or logging, retrieve the summaries from the batcher:

// Access the aggregated summary (e.g., from the UI thread)
let summaries = audio_pipeline
    .metrics_batcher
    .as_ref()
    .unwrap()
    .get_summaries()
    .await;

// Example fields you can display:
println!("Chunks/sec: {:.2}", summaries[0].chunks_per_second);
println!("Avg level: {:.3}", summaries[0].average_level);

The diagnostics.rs module handles the final logging of these summaries, though the AudioMetricsSummary data structure is available for any component needing real-time audio health monitoring.

Summary

  • Per-chunk data: Meetily captures timestamps, chunk IDs, sample counts, duration, and average amplitude levels for every audio chunk processed.
  • Batching strategy: Metrics aggregate into summaries every 50 chunks or 5 seconds via the AudioMetricsBatcher in src-tauri/src/audio/batch_processor.rs.
  • Summary contents: Each AudioMetricsSummary exposes total chunks, samples, duration, average level, timespan, and chunks-per-second processing rate.
  • Integration: Access metrics through the metrics_batcher field on the pipeline instance, with get_summaries() returning consumable data for UI diagnostics.

Frequently Asked Questions

How does Meetily calculate the average audio level for each chunk?

Meetily calculates the average level by iterating through each PCM sample in the chunk, taking the absolute value of each sample, summing these absolute values, and dividing by the total number of samples. This produces a mean absolute amplitude value that indicates the overall audio intensity without regard to signal polarity.

What is the batch size and interval for metric aggregation?

The AudioMetricsBatcher flushes accumulated metrics whenever it reaches 50 individual chunks or when 5 seconds have elapsed since the last summary, whichever condition occurs first. This ensures timely updates during both high-throughput and low-activity scenarios.

Where is the audio metrics batching logic implemented in the Meetily codebase?

The batching logic resides in src-tauri/src/audio/batch_processor.rs, which defines the AudioMetric and AudioMetricsSummary structs along with the batch_audio_metric! macro. The pipeline creates and uses the batcher in src-tauri/src/audio/pipeline.rs, storing it in the metrics_batcher field.

Can I access real-time audio metrics from the UI thread?

Yes, the pipeline exposes the metrics_batcher field, which provides an async get_summaries() method returning a collection of AudioMetricsSummary objects. The UI thread can await these summaries to display live metrics such as chunks per second and average audio levels, enabling real-time monitoring of audio pipeline health.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →