在iOS上使用声音字体导出Midi [英] export midi with sound fonts on iOS

查看:138
本文介绍了在iOS上使用声音字体导出Midi的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将分配了音字体的Midi序列导出为.wav文件?如果是这样,谁能将我带往正确的方向?

我目前正在使用 MIKMIDI ,而且我还没有遇到任何可以到目前为止.

解决方案

MIKMIDI不包含没有自己实现大部分功能的能力.也就是说,这是可能的.本质上,您需要创建自己的包括MIDI合成器单元的Core Audio图形.然后,在乐器单元的渲染回调中,根据使用AudioTimeStamp计算的时间戳和传递到渲染回调中的帧数,将事件从MIKMIDISequence中拉出.您可以使用MusicDeviceMIDIEvent()将它们播放到乐器单元.

您还需要某种方式来获取综合输出.您可以通过将通用输出添加到AU图,向其添加渲染回调,然后在该渲染回调中,采用传入的AudioBufferList并将其写出到文件中(例如,使用ExtAudioFileWrite())来做到这一点. /p>

我确实有一个小型项目可以执行此操作,并且使用MIKMIDI,但其中包含无法公开发布的代码.我将查看是否可以清除它,并使其在某些时候可以作为示例代码公开发布.我在这里提到的项目已被清除,现在已作为MIKMIDI的示例项目包括在内.请参见此处.

您还可以考虑提交请求以获取API或增强功能以​​获得更好的支持在MIKMIDI中.

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.

这篇关于在iOS上使用声音字体导出Midi的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆