Error initializing sound graph using subtype kAudioUnitSubType_VoiceProcessingIO audio IO

I am working on an iOS project that requires acoustic echo cancellation, so the kAudioUnitSubType_VoiceProcessingIO subtype seems like a good choice. Below is a description of my audio device

//io unit description AudioComponentDescription ioUnitDescription; ioUnitDescription.componentType = kAudioUnitType_Output; ioUnitDescription.componentSubType = kAudioUnitSubType_VoiceProcessingIO; ioUnitDescription.componentManufacturer = kAudioUnitManufacturer_Apple; ioUnitDescription.componentFlags = 0; ioUnitDescription.componentFlagsMask = 0; 

And based on my experience with the RemoteIO subtype, I included an input element:

 UInt32 enable = 1; AudioUnitSetProperty(ioUnit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Input, 1, &enable, sizeof(enable)); 

However, I got an error while initializing the sound graph. The same sound graph works well if VoiceProcessingIO is replaced by RemoteIO.

Is there a difference between RemoteIO and VoiceProcessingIO that needs special attention?

Thanks Chuankai

+7
source share
1 answer

In my experience, the VoiceProcessingIO sound block is much more sophisticated in terms of buffer size and sample rate. Try setting the sampling rate below 32000 Hz (maybe start at 8000 Hz and move up) and a large enough buffer size (say, 2048 samples or so). This is not documented. rdar number to come as soon as I have the chance to feed one.

When setting up, I use the following format:

  size_t bytesPerSample = sizeof(AudioSampleType); AudioStreamBasicDescription canonicalFormat; canonicalFormat.mSampleRate = self.samplerate; canonicalFormat.mFormatID = kAudioFormatLinearPCM; canonicalFormat.mFormatFlags = kAudioFormatFlagsCanonical; canonicalFormat.mFramesPerPacket = 1; canonicalFormat.mChannelsPerFrame = 1; canonicalFormat.mBitsPerChannel = 8 * bytesPerSample; canonicalFormat.mBytesPerPacket = bytesPerSample; canonicalFormat.mBytesPerFrame = bytesPerSample; 
+1
source

All Articles