Can AudioTrack play MIDI files?

*爱你&永不变心* 提交于 2019-12-21 05:32:13

问题


I want to know can AudioTrack Android play MIDI file?

If not, which library can. Because I want the Android library which can play and control tempo of MIDI file for my app.


回答1:


Check Android Supported media format from here Android Media Support. MIDI playback support is built-in in Android. Playing MIDI file using JetPlayer is very much handy in android. To play MIDI file you have to write code of below :

JetPlayer jetPlayer = JetPlayer.getJetPlayer();
jetPlayer.loadJetFile("/sdcard/level1.jet");
byte segmentId = 0;
// queue segment 5, repeat once, use General MIDI, transpose by -1 octave
jetPlayer.queueJetSegment(5, -1, 1, -1, 0, segmentId++);
jetPlayer.play();

For details check Example 1 & Example 2. And here is the jet creator manual which will provide you the details background process of JetPlayer.




回答2:


A good sample code to play MIDI file with Audio player in Android...

Hope it helps you .. :)



来源:https://stackoverflow.com/questions/20115908/can-audiotrack-play-midi-files

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