Configuration Options for Meetily's Professional Audio Mixer: RMS Ducking and Clipping Prevention

Meetily's ProfessionalAudioMixer provides configurable pre-scale factors for system and microphone audio, proportional soft-clipping at ±1.0 to prevent distortion, and adjustable ring buffer windows, with RMS-based ducking planned for future implementation.

Meetily, an open-source meeting recording application by Zackriya-Solutions, implements a sophisticated audio pipeline in its Tauri-based backend. The configuration options for Meetily's professional audio mixer allow developers to fine-tune how microphone and system audio streams are combined, balancing audio levels while preventing clipping artifacts. These settings are embedded directly in the Rust source code, giving developers granular control over the mixing behavior.

System Audio Pre-Scale Factor

The primary level control for system audio resides in the mix_window function within src-tauri/src/audio/pipeline.rs (lines 147-190). By default, the system track passes through at full scale with sys_scaled = sys * 1.0, but developers can reduce this multiplication factor to reserve headroom before the final mix.

Lowering the pre-scale factor to 0.7 or 0.6 reduces the system audio level to 70% or 60% respectively, creating acoustic space for the microphone track to dominate the output. This manual gain staging is essential when the system audio source is significantly louder than the microphone input.

// Default implementation in mix_window (line ~147)
let sys_scaled = sys_sample * 1.0;

// Modified for reduced system volume
let sys_scaled = sys_sample * 0.7;

Microphone Pre-Scale Factor (Reserved)

While the codebase contains a placeholder (let _mic_scaled = mic * 0.8) in the same mix_window implementation, this parameter is currently reserved for future use. When activated, it will enable precise balancing of mic-to-system ratios by attenuating the microphone input before the mixing stage, complementing the system audio controls.

Soft-Clipping Threshold and Clipping Prevention

Located in lines 174-182 of pipeline.rs, the soft-clipping logic prevents harsh digital distortion when combined samples exceed the 16-bit PCM range of ±1.0. Instead of hard clamping, which creates audible "radio-break" distortion, the mixer applies proportional scaling.

When the summed sample exceeds the threshold, the algorithm divides by the absolute value (sum / sum_abs), creating a smooth compression curve that maintains audio intelligibility while guaranteeing the output never exceeds digital full-scale.

// Soft-clipping implementation from pipeline.rs lines 174-182
let sum = mic_sample + sys_scaled;
let mixed = if sum.abs() > 1.0 { 
    sum / sum.abs() 
} else { 
    sum 
};

Ring Buffer Window Configuration

The AudioMixerRingBuffer::new constructor (lines 25-33) manages temporal alignment between asynchronous audio streams. The default window length is 50ms (window_ms parameter) with a maximum buffer capacity of 400ms.

Larger buffers provide the mixer additional time to align microphone and system audio chunks, reducing dropout-related artifacts by ensuring both streams contain sufficient samples before the mixing operation occurs. Developers can adjust these values to optimize for latency versus stability based on their specific hardware characteristics.

Planned RMS-Based Ducking Features

According to comments in src-tauri/src/audio/ffmpeg_mixer.rs, Meetily plans to implement RMS-based ducking that will dynamically attenuate system audio when microphone activity is detected. This professional mixing strategy will compute Root Mean Square levels over short analysis windows and apply automatic gain reduction to maintain microphone dominance during speech.

While not yet active in the current ProfessionalAudioMixer implementation, placeholders in the codebase indicate the system will compare RMS levels between streams and calculate a ducking factor to lower system volume proportionally to microphone input levels.

// Pseudo-code for future RMS ducking implementation
let rms_mic = rms_over_window(&mic_window);
let rms_sys = rms_over_window(&sys_window);
let duck_factor = (rms_mic / rms_sys).max(1.0);
let sys_scaled = sys_sample * (1.0 / duck_factor);

Key Source Files and Architecture

Understanding the file structure helps navigate the configuration options:

  • src-tauri/src/audio/pipeline.rs — Contains the ProfessionalAudioMixer implementation, mix_window function, and AudioMixerRingBuffer configuration
  • src-tauri/src/audio/ffmpeg_mixer.rs — Houses comments and architectural planning for RMS-based ducking and professional mixing strategies
  • src-tauri/src/audio/audio_processing.rs — Provides the EBU R128 loudness normalizer and high-pass filter used in the microphone processing chain
  • src-tauri/src/audio/devices — Handles device discovery and stream source configuration

Summary

  • Pre-scale factors in mix_window (lines 147-190) control relative loudness before mixing
  • Soft-clipping at ±1.0 (lines 174-182) prevents distortion through proportional scaling rather than hard clamping
  • RMS-based ducking is planned for automatic system audio attenuation based on microphone activity levels
  • Ring buffer sizing (lines 25-33) affects stream synchronization and dropout prevention
  • All configuration occurs primarily in src-tauri/src/audio/pipeline.rs within the Zackriya-Solutions/meetily repository

Frequently Asked Questions

How do I lower the system audio volume in Meetily's mixer?

Modify the pre-scale factor in src-tauri/src/audio/pipeline.rs lines 147-190, changing sys * 1.0 to a lower decimal value like sys * 0.7 to reduce system audio to 70% of its original level before mixing occurs.

What prevents audio distortion when mixing loud signals?

The soft-clipping threshold at ±1.0 implemented in lines 174-182 uses proportional scaling (sum / sum_abs) rather than hard clamping, ensuring smooth distortion-free output even when combined microphone and system streams exceed digital full-scale limits.

Is automatic ducking available in the current version?

RMS-based ducking is not yet implemented but is planned according to comments in src-tauri/src/audio/ffmpeg_mixer.rs. The current mixer relies on manual pre-scale factors to balance audio levels between sources.

Where is the mixing buffer size configured?

The AudioMixerRingBuffer::new function in src-tauri/src/audio/pipeline.rs lines 25-33 configures the window size, defaulting to 50ms with a 400ms maximum buffer to ensure proper alignment of microphone and system audio streams.

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 →