Let's definitely try to resolve that error first... If you are getting that error from ExtAudioFileCreateWithURL then my guess is that the ASBD you are passing in does not match the enum type you are also passing in. In other words, if you pass kAudioFileWAVEType to the create function, then your ASBD should probably look something like this:
{
AudioStreamBasicDescription streamDescription = {0};
Float64 sampleRate = 44100;
int channels = 2; // Do you want Stereo?
streamDescription.mSampleRate = sampleRate;
streamDescription.mFormatID = kAudioFormatLinearPCM;
streamDescription.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;
streamDescription.mBytesPerPacket = 4;
streamDescription.mFramesPerPacket = 1;
streamDescription.mBytesPerFrame = 4;
streamDescription.mChannelsPerFrame = channels;
streamDescription.mBitsPerChannel = 16;
}
That is just one way to do it (bordering on too manual IMO). I thought there were handy MACROS for this in the SDK but maybe I am conflating that with something else...
Minor related suggestion: consider creating this ASBD as a return value from a static function, it may be handy in the future... it was for me.
Lastly, and just for completeness: In terms of the client property, it should probably match the audio buffers you intend to pass into the WriteAsync functions and not necessarily the format of the WAV file itself. In your snippet you seem to be re-using the ASBD, which may not always apply.
--Christian