Scheduled audio unit parameter events are delayed

I have a music sequencing app for iOS that uses AUSamplers and effects audio units.


The main playback loop is implemented using a render notify callback to send note on & off events to the samplers. I have notes successfully playing on beat by calculating buffer offsets and passing those to the

MusicDeviceMIDIEvent
calls.


I'm now trying to implement an automation feature that lets you define changes to effect parameters over time. For an initial test, I'm repeatedly ramping the master mixer volume from 0 to 1 every bar (i.e. every 2 sec at 120 bpm).


I'm using

AudioUnitScheduleParameters
to schedule immediate events, once per render callback. However, the actual volume change seems to be slightly delayed. This is very obvious at the beginning of a bar when the volume drops from 1 to 0; any notes scheduled at the beginning of that bar play briefly at full volume before dropping to 0 and ramping up as expected. I have verified that parameter event has been scheduled at a buffer offset before the note on event.


My current workaround is to run the automation "ahead" of the audio, where I add some offset to the sample count used to calculate the current volume level. I've determined the offset just by experimenting, though, and I'm not confident in the solution.


Is there some reason I'm missing that would cause scheduled parameter events to be delayed?

Replies

Which component are you calling AudioUnitScheduleParameters on? Not all AU's support this.


-DS