Enabling Voice Processing changes channels count on the input node.

I've noticed that enabling voice processing on AVAudioInputNode change the node's format - most noticeably channel count.

let inputNode = avEngine.inputNode
print("Format #1: \(inputNode.outputFormat(forBus: 0))")
// Format #1: <AVAudioFormat 0x600002bb4be0:  1 ch,  44100 Hz, Float32>
try! inputNode.setVoiceProcessingEnabled(true)
print("Format #2: \(inputNode.outputFormat(forBus: 0))")
// Format #2: <AVAudioFormat 0x600002b18f50:  3 ch,  44100 Hz, Float32, deinterleaved>

Is this expected? How can I interpret these channels?

My input device is an aggregate device where each channel comes from a different microphone. I then record each channels to separate files. But when voice processing messes up with the channels layout, I cannot rely on this anymore.

Post not yet marked as solved Up vote post of smialek Down vote post of smialek
2.2k views

Replies

Hi @smialek, did you ever figure out how to handle this audio? I go from my expected 48kHz 2 channel up to 7 channel 96kHz when I turn on voice processing and I'm also a little lost as to what I'm suppossed to do with that.