Help with CoreAudio Input level monitoring

I have spent the past 2 weeks diving into CoreAudio and have seemingly run into a wall...

For my initial test, I am simply trying to create an AUGraph for monitoring input levels from a user chosen Audio Input Device (multi-channel in my case).

I was not able to find any way to monitor input levels of a single AUHAL input device - so I decided to create a simple AUGraph for input level monitoring.

Graph looks like:

[AUHAL Input Device] -> [B1] -> [MatrixMixerAU] -> [B2] -> [AUHAL Output Device]

Where B1 is an audio stream consisting of all the input channels available from the input device. The MatrixMixer has metering mode turned on, and level meters are read from the each submix of the MatrixMixer using kMatrixMixerParam_PostAveragePower.

B2 is a stereo (2 channel) stream from the MatrixMixerAU to the default audio device - however, since I don't really want to pass audio through to an actual output, I have the volume muted on the MatrixMixerAU output channel. I tried using a GenericOutputAU instread of the default system output, however, the GenericOutputAU never seems to pull date from the ringBuffer (the graph renderProc is never called if a GenericOutputAU is used instead of AUHAL default output device).

I have not been able to get this simple graph to work. I do not see any errors when creating the graph and initializing the graph, and I have verified that the inputProc is being called for filling up the ringBuffer - but when I read the level of the MatrixMixer, the levels are always -758 (silence).

I have posted my demo project on github in hopes I can find someone with CoreAudio expertise to help with this problem.

I am willing to move this to DTS Code Level support if there is someone in DTS with CoreAudio experience.

Notes:

  • My App is not sandboxed in this test
  • I have tried with and without hardened runtime with Audio Input checked
  • The multichannel audio device I am using for testing is the Audient iD14 USB-C audio device. It supports 12 input channels and 6 output channels.
  • All input channels have been tested and are working in Ableton Live and Logic Pro.
  • Of particular interest, is that I can't even get the Apple CAPlayThrough demo to work on my system. I see no errors when creating the graph, but all I hear is silence.
  • The MatrixMixerTest from the Apple documentation archives does work - but note, that that demo does not use Audio Input devices - it reads audio into the graph from an audio file.

Link to github project page.

Diagram of AUGraph for initial test (code that is on github)

Once I get audio input level metering to work, my plan is to implement something like in Phase 2 below - with the purpose of capturing a stereo input stream, mixing to mono, and sending to lowpass, bandpass, hipass AUs - and will again use MatrixMixer for level monitoring of the levels out of each filter.

I have no plans on passthough audio (sending actual audio out to devices) - I am simple monitoring input levels

Diagram of ultimate scope - rendering audio levels of a stereo to mono stream after passing through various filters

Help with CoreAudio Input level monitoring
 
 
Q