Skip to content

audio engine: bypass v2 param setter to silence per-note AudioKit warnings

jedmund requested to merge jedmund/audio-warnings into main

Created by: jedmund

Summary

  • PianoVoice's per-note writes to osc.frequency / osc.amplitude / etc. went through AudioKit's @Parameter setter, which calls the legacy C AudioUnitSetParameter. For Soundpipe nodes that call fails and spams kAudioUnitErr_InvalidParameter into the console via CheckError on every keypress and every envelope tick.
  • Route those writes through AUParameterTree's setValue(_:originator:) via a small setSafely helper. The DSP reads from the parameter tree, so audio is unchanged; the spurious error log goes away for every write we control.
  • Scope: only synthesize/Services/AudioEngine.swift.

What this does and doesn't fix

  • Silences warnings from our own writes in PianoVoice.init, start, and the decay envelope task (previously ~150+ warnings per sustained note).
  • Does not silence warnings emitted from inside SoundpipeAudioKit's own node constructors (DynamicOscillator() writing its own default frequency/amplitude, etc.). Those still fire ~27 per new PianoVoice and ~338 at app launch from SynthPlayground's preallocated graph. Addressing those requires either a global log suppression or the architectural voice-pool refactor queued up for a follow-up branch.

Test plan

  • Build + run on iPad simulator.
  • Play several notes from PlayableKeyboard; confirm piano timbre, attack, and release are unchanged.
  • Trigger scale playback in Circle of Fifths Explorer and ScaleExplorer; confirm console no longer floods with kAudioUnitErr_InvalidParameter while notes are sustaining and decaying.
  • IntervalTrainer / IntervalComparison play-root-then-target sequences still sound correct.

Merge request reports

Loading