AudioUnit Block Wrapper


I’m trying to write a wrapper for admsyn’s AudioUnit block into cinder’s native audio pull but I’m having a really hard time.
I tried creating a subclass of audio::Node and au::Tap and then overriding the process() function.

class AUobj :  public cinder::audio::Node,  public au::Tap
    AUobj(  const Format &format = Format().channels(2).channelMode( AUobj::ChannelMode::SPECIFIED ) );
    virtual ~AUobj(){};
    void process( ci::audio::Buffer *buffer ) override;

Then using an override method from richardeakin’s wrapper for the stk library

AUobj::AUobj(  const Format &format )//set format if no input connected
: Node( format ),  au::Tap()
void AUobj::process( audio::Buffer *buffer )//override
  const size_t numChannels = buffer->getNumChannels();
  const size_t numFrames = buffer->getNumFrames();
  //performTick( &mStkFrames );
  for( size_t ch = 0; ch < numChannels; ch++ ) 
    float *channel = buffer->getChannel( ch );
    au::TapSampleBuffer tapBuf ;//for the audiounit tap
    for( size_t i = 0; i < numFrames; i++ ) 
        getSamples(tapBuf);//au tap sample buffer
        //channel[i] = mStkFrames( i, ch );//from stk wrapper
        channel[i] = tapBuf[i];//my version

But it crashes the app heavily when I try myWrapper.connect(mMonitor);
Basically, I’d like to pull in and out of the “connect” chain from either cinder::audio or the AudioUnit block.
so ultimately I’d like to do something like

auWrapper>>mMonitor;//AudioUnit to cinder::audio
mMonitor>>auWrapperOut;//cinder::audio to AudioUnit

Instead of the bitwise>> I used


but I’m still getting issues.

Also, cinder has audio cocoa NodeAudioUnit … perhaps I should start there and try to share a pointer of the AudioUnit block’s audioUnitRef and the NodeAudioUnit’s ::AudioUnit and pull the stream from the appropriate downstream/upstream depending on the type? I was worried about creating two instances of the same audioUnit. Any thoughts on how to do this? Kinda my first wrapper…


I ended up figuring out cinder’s audio cocoa audiounit implementation and I’m gonna have to manual include additional features in a custom subclass. It isn’t nearly as robust as admsyn’s block but it will have to do for my needs right now. The carbon showUI() feature is missed dearly so I’m putting parameter controls into mGui for now.


Nice, yea it’d be great to work with the NodeAudioUnit if you can, that was the intention anyway. However I haven’t been working on Mac OS X / iOS these days, so I can only give suggestions there unless some project comes up in that area.

I didn’t add the carbon showUI() portion because it would require use adding the Carbon.framework to all cinder apps. I believe that functionality would be nice in a cinderblock, we could even ship it in the core blocks folder if it works out.

FYI if you end up wanting to use some of the multi-channel audio units, you may need to dig into it a bit. I couldn’t get them working, only the Effects (synths should also be easy enough to get to work).

And also if you didn’t find it, there is a little test app I used when I first wrote that code. It’s quite old now so may be out of date, but should be a decent reference.



Cool! I ended up making a modified version of the EffectAudioNode that can initialize custom au descriptions. I could’t figure out the carbon UI so I added some simple printParameters and getParameters functions to at least be able to figure out what to control. I also added speechSynth but would like to be able to use some of the speech callbacks. I move a little slow when it comes to callbacks. I’ll try to share my progress sometime soon though.


Nice! Also happy to help get what people need out of audio units directly into EffectAudioNode. Like I said I’m not on that platform much these days but if you are, they sure can be useful.