I am using AVFoundation to up convert and play a mono file that has a sample rate of 22050, through AVAudioengine with the end result being stereo and a sample rate of 44100.
At this time, I am explicitly using AVAudioConverter to do this and it is working perfectly well. However, I thought there may be a way to do this with less overhead and less code. WWDC15 Session 507, referenced two things, channel mapping being wrapped in AVAudioChannelLayout and automatic format conversions. I've been unable to determine how make this implicit conversion occur. Attempt to make this work, including inserting a mixer between a player and the main mixer, setting the output format to the desired sample rate and stereo channel output on the inserted mixer. When I do this, I get an error AVAE, "No Converter". Unfortunately, I don't know if this means it can't convert the channels or sample rate. Previously, I would have something like this (winging it here). However, I think AVAudioChannelLayout is supposed to provide a higher level abstraction, so we didn't need to access the audio unit, like I'm trying to do here. channelMap[0] = 0 // keep the left channel as the left channel channelMap[1] = 0 // map left channel to right channel output let propSize = UInt32(channelMap.count) * UInt32(MemoryLayout<Int32>.size) let status = AudioUnitSetProperty( _engine.inputNode.audioUnit, kAudioOutputUnitProperty_ChannelMap, kAudioUnitScope_Global, 1, channelMap, propSize) Does anyone have an idea of how to make the channel mapping using AVAudioChannelLayout? Also, is there an implicit up-sampling that occurs when you provide an AVAudioPCMBuffer and the output node is a higher sample rate? Thank you, W.
_______________________________________________ Do not post admin requests to the list. They will be ignored. Coreaudio-api mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com This email sent to [email protected]
