Skip to content

Fix macOS VoiceProcessingIO input setup for screenpipe AEC.#3

Merged
louis030195 merged 4 commits into
screenpipe:mainfrom
divanshu-go:fix/macos-voice-processing-io
May 23, 2026
Merged

Fix macOS VoiceProcessingIO input setup for screenpipe AEC.#3
louis030195 merged 4 commits into
screenpipe:mainfrom
divanshu-go:fix/macos-voice-processing-io

Conversation

@divanshu-go
Copy link
Copy Markdown
Contributor

Summary

This change corrects how cpal builds macOS input streams when MacosVoiceProcessingInputConfig requests VoiceProcessingIO (used for acoustic echo cancellation on the default microphone). The previous setup enabled both input and output IO on the unit, applied some properties only on the output element, and forced the device nominal sample rate before creating the unit.

What changed

  • Enable only the input bus on VoiceProcessingIO; keep the output bus disabled (input-only capture path).
  • Add configure_voice_processing_io, apply_voice_processing_property, and apply_voice_processing_flags so bypass, AGC, mute-output, and ducking properties are applied on both Input and Output unit elements (matching how Apple’s VoiceProcessingIO properties are scoped).
  • Add K_AU_VOICE_IO_MUTE_OUTPUT and set mute output to off as part of the default flag application.
  • Stop calling set_sample_rate() on the device before creating the VoiceProcessingIO unit; let the unit use the hardware rate.
  • Set input stream format on the unit with best-effort semantics (ignore failure when the property is read-only on some paths).

Disable the VPIO output bus, apply AEC properties on both IO elements,
stop forcing sample rate before unit creation, and add screenpipe_aec()
defaults for callers.
@divanshu-go divanshu-go force-pushed the fix/macos-voice-processing-io branch from 2ebf1b3 to 9fb6ce2 Compare May 19, 2026 20:00
…port

- configure_voice_processing_stream_format: widen sample rate match from
  f64::EPSILON to < 1.0 Hz; log actual vs requested rates on mismatch
- set_sample_rate: use containment check (mMinimum <= rate <= mMaximum)
  instead of point equality so USB/virtual devices with continuous ranges
  (Focusrite, BlackHole, Loopback) no longer get StreamConfigNotSupported
- AudioObjectSetPropertyData: pass target rate as bare f64 with
  sizeof(f64) instead of AudioValueRange struct (was correct by accident
  for discrete-point devices only)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@divanshu-go divanshu-go force-pushed the fix/macos-voice-processing-io branch from 88f30d8 to bf174e5 Compare May 20, 2026 16:31
@louis030195 louis030195 merged commit 99f7c0f into screenpipe:main May 23, 2026
13 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants