How can I generate musical notes on iOS and play them?

你说的曾经没有我的故事 提交于 2019-12-09 06:49:45

问题


I am creating a musical app which generate some music. I already used MIDI functions on Mac to create a MIDI file with MIDI events (unfortunately, I don't remember names of those functions).

I am looking for a way to create instrumental notes (MIDI's or anything else) programmatically in order to play them. I also would like to have multiple channels playing those notes at the same time.

I already tried 'SoundBankPlayer' but apparently, it can't play multiple instruments at the same time.

Have you got an idea?


回答1:


This answer might be a bit more work than you intended, but you can use PD on iOS to do this. More precisely, you can use libpd for iOS for the synthesis, and then use any number of community-donated patches for the sound you're looking for.




回答2:


In iOS 5:

MusicSequence, MusicTrack, MusicPlayer will do what you want.

http://developer.apple.com/library/ios/#documentation/AudioToolbox/Reference/MusicSequence_Reference/Reference/reference.html#//apple_ref/doc/uid/TP40009331




回答3:


Check out AUSampler AudioUnit for iOS, you'll probably have to delve into Core Audio, which has some learning curve. ;)



来源:https://stackoverflow.com/questions/7053008/how-can-i-generate-musical-notes-on-ios-and-play-them

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!