vitamin-caig / zxtune

Mirror of http://bitbucket.org/zxtune/zxtune repository with robot-only issues tracker
https://zxtune.bitbucket.io
148 stars 17 forks source link

midi/mid in android with Custom SoundFont loading support #2183

Open kirito90 opened 4 years ago

kirito90 commented 4 years ago

I find this https://github.com/VolcanoMobile/fluidsynth-android

may help adding midi/mid support with Custom SoundFont loading in zxtune for android

Wohlstand commented 3 years ago

Also, those libraries can be used for FM-Synth MIDI playing: OPL3/OPL2 synth: https://github.com/Wohlstand/libADLMIDI OPN2 synth (same chip as at Sega Megadrive): https://github.com/Wohlstand/libOPNMIDI They don't need any SoundFont, they work differently and they do use a special instrument bank format. They have default built-in banks together with an option for users to load custom banks (WOPL format for libADLMIDI and WOPN for libOPNMIDI).

Jobima1st commented 7 months ago

VLC in Android kinda do it now, but I prefer zxtune

vitamin-caig commented 5 days ago

Extracted from https://github.com/libgme/game-music-emu/issues/96#issuecomment-2490981047

Then, I will give some tips related to performance at these libraries (Anyway, that should be posted at your repo's issues rathar than here, but as a note to be copied in the future. Also, I lost my Bitbucket account, and glad I quickly resqued everything mine from it to my private self-hosted gitea and GitHub):

These libraries do support multiple different chip emulators with an ability to switch between them on the fly (the most accurate are Nuked emulators, but they were worst for mobile devices as they consume too much. Nuked OPL3 at least works on weak phone, but battery gets eaten quick. Nuked OPN2 just don't work on phone, it requires even more resources to work. The best chip emulator for phones at libADLMIDI is DosBox, the fastest one, and has average accuracy, somewhere it's inaccurate, but works well. At libOPNMIDI besties are MAME YM2612 and YMFM YM2612 - golden middle, the fastes is GEMS, but has worst accuracy, it works glitchy at SSG-EG parts). Can be an option for users. It's an option to select number of chips to increase/decrease polihpony. Should be an option for users. Default for libADLMIDI can work just 2, or better 4. With DosBox on phones, 4 should be fine. The pronlem when selected embedded bank uses Rhythm-mode feature of OPL2/OPL3 chip. For libADLMIDI, the ability to select one of embedded banks should be (the libALDMIDI by its API returns the list of available banks). For libOPNMIDI, are no embedded banks, but you can supply a pile of bank files (the xg.wopn is default) and allow choice between them, but mainly use xg.wopn as default one, and allow user to select any bank from the file system. The libADLMIDI also supports custom banks in WOPL format. These banks can be created/edited via my OPL3-Bank-Editor and OPN2-Bank-Editor. For both libADLMIDI and libOPNMIDI: The "automatical arpeggio" option suggested to be disabled by default, and be an option for users. The "Volumes model" option should be available for users to switch The "Channels allocation mode" should be available for users to switch "Enable panned stereo" flag is also an option that allows to escape the left-center-right stereo limitation of chips, and use full-panning stereo (using a hack in chip emulators made by me and my friend @jpcima who gone two years ago into nowhere...) Also, supported file formats: libADLMIDI supports MID, RMI, XMI (also supported multi-track files!), MUS (Id's format), IMF (also Id's used in Wolfenstein and other games), CMF, also EA's MUS format too but it's not so widely used. libOPNMIDI supports MID, RMI, XMI (multi-track files supported too), and MUS, but no IMF and CMF.

Wohlstand commented 5 days ago

Copying same as above, but with keeping all the formatting:

Then, I will give some tips related to performance at these libraries:

I'll append anything also if I remember...

Oh! It's suggested to gain the output 2x by default, otherwise, the output volume will be too quite...

Wohlstand commented 5 days ago

VLC in Android kinda do it now, but I prefer zxtune

I actually have VLC plugins for my libs, but for Android, I have to recompile the whole VLC by myself to add them into build. And, Android version of VLC as I know, lacks fine tune of each single codec like desktop versions has.