I’m building a MIDI synth using CoreAudio. Currently, I have the following audio graph:
Sampler -> Reverb -> IO
I need to add a chorus effect to the graph as well as the reverb. The problem is that there isn’t a chorus effect on the iPhone. To get around this I’m planning to implement my own chorus effect. To do this I need access to the audio stream.
The question is: what’s the best way to get access to the audio stream in the middle of the audio graph.
Sampler -> Reverb -> [Custom processing] -> IOUnit
Is there a way I can alter the audio stream using something like the AudioUnitAddRenderNotify callback? or do I have to break the audio graph like this:
Sampler -> Reverb -> [AudioUnitAddRenderNotify callback] -> buffer -> [RenderCallback] -> IOUnit
Any advice would be appreciated.
The easiest way is to add a render notify callback (
AudioUnitAddRenderNotify) to your Reverb node’s AU and process the audio in thekAudioUnitRenderAction_PostRendercall. I did an experiment and got this to work as long as the callback was added after the AUGraph was open, and no processing was done in the prerender call.