Is it possible to export a midi sequence with soundfonts assigned to them as a .wav file? If so, can anyone put me in the right direction?
I'm currently using MIKMIDI, and I haven't run into any example that does that so far.
MIKMIDI doesn't include the ability to do this without implementing most of it yourself. That said, it is possible. In essence, you need to create your own Core Audio graph including a MIDI synthesizer unit. Then, in the render callback for the instrument unit, you pull events out of the MIKMIDISequence based on timestamps calculated using the AudioTimeStamp
and number of frames passed into the render callback. You play these out to the instrument unit using MusicDeviceMIDIEvent()
.
You also need some way to get the synthesized output. You can do this by adding a generic output to the AU graph, adding a render callback to it, then in that render callback, taking the passed in AudioBufferList
and writing it out to a file (e.g. using ExtAudioFileWrite()
).
I do have a small project that does this and uses MIKMIDI, but it contains code that I can't release publicly. I'll see if I can clean it up and make it publicly releasable as example code at some point. EDIT: The project I mention here has been cleaned up and is now included as an example project with MIKMIDI. See here.
You might also consider filing a request for API or enhancements to better support this in MIKMIDI.
来源:https://stackoverflow.com/questions/32831021/export-midi-with-sound-fonts-on-ios