I’m using RemoteIO successfully to perform analysis on the incoming audio stream from the mic. I can’t seem to get a file written to disk, though. I’ve read around a number of questions:
- Example of saving audio from RemoteIO?,
- AudioBufferList contents in remoteIO audio unit playback callback,
- Recording to AAC from RemoteIO: data is getting written but file unplayable
- Recording from RemoteIO: resulting .caf is pitch shifted slower + distorted
And tried to implement the suggestions there: Except they’re not working. Where’s the correct place to call ExtAudioFileWriteAsync, and how do I set it up?
Aside from the (fairly arduous but better covered by Apple’s example code) setup process of RemoteIO itself, the key points of insight were:
AudioStreamBasicDescription(*audioFormat) that I used to set up the stream in the first place. I don’t know how long I spent trying to set up a new one with slightly different parameters, based on other questions and posts. Just referencing the stream attributes from my ivar was sufficient.recordingCallback, um, callback, but do it asynchronously. Lots of info talks about doing it in the playbackCallback or setting up some third audioFileWriteCallback. This resulted in silent files or 4KB (i.e. empty) files. Don’t do it.in
recordingCallbackafterAudioUnitRenderintobufferList:-(void)startRecording {
That’s it!