Sorry to keep replying to myself, but I figured it out and thought I'd
share my solution for posterity!

As the PlaySequence sample code[1] indicates, the trick is to use
kAudioUnitSubType_GenericOutput instead of the default
kAudioUnitSubType_RemoteIO. You also have to hook up your MusicTracks to
actual AudioUnits, not virtual MIDI endpoints; kAudioUnitSubType_MIDISynth
works best, but you have to preload your instruments as discussed here[2].
The kAudioUnitProperty_OfflineRender property doesn't work with the
built-in iOS AudioUnits, but fortunately it's not required. Sadly, I don't
think this process is currently possible with AVAudioEngine: you have to
use AUGraph and friends.

Here's my updated sample code:
https://github.com/archagon/aumidisynth-offline-render-test/blob/master/AVAudioEngineTest/ViewControllerAUGraph.m

[1]:
https://developer.apple.com/library/mac/samplecode/PlaySequence/Listings/main_cpp.html
[2]: http://lists.apple.com/archives/coreaudio-api/2016/Jan/msg00015.html

On Wed, Apr 20, 2016 at 7:23 PM, Archagon <[email protected]> wrote:

> Update: I made a prototype based on a StackOverflow answer[1], but
> unfortunately it sounds like all the MIDI events come in all at once, at
> the beginning of the offline recording:
> https://github.com/archagon/aumidisynth-offline-render-test/blob/master/AVAudioEngineTest/ViewController.m
>
> Is there any way to solve this problem?
>
> [1]: http://stackoverflow.com/a/30680391/89812
>
> On Tue, Apr 19, 2016 at 1:12 AM, Archagon <[email protected]> wrote:
>
>> I have an iPad app that uses MusicPlayer (from AudioToolbox) to play MIDI
>> files. Is it possible to run MusicPlayer "off the clock" (as fast as the
>> CPU permits) and record the output to an audio file (WAV, etc.) faster than
>> normal playback speed?
>>
>
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to