Monday, May 23, 2016

Play midi files without midi driver using soundfonts on Android

Audience: Normal user
Platform:  Android


After trying to setup midi in Linux i decided to use Software Synthesis based players with custom soundfonts. Before that i will give basics of midi. Skip to APPs section if you don't want to read about midi system below.


How MIDI works?
Suppose you have memorized a pattern on piano notes and playing it on piano. Unfortunately there is no synthesizer (synth) & speaker attached. So before setting it up with synth you wrote every piano key activity on a paper or a file. You saved it like "C4 C4 D4# ... PITCH_WHEEL ... VOLUME_UP etc". Now you know the pattern, raga or rhythm of your music. Midi file is exactly this saved record!. Means there is no SOUND DATA. You write on paper that you payed a sitar or guitar. But how does that sound? To save that we really need sound file itself. That is the reason midi files are very small because there is no sound data inside mid files.

Now we know what is MID file. Now comes Synthesizer. That missing sound is produced by synth that is why the name. Midi tells a synth to play an instrument named guitar. Therefore depending upon a synth midi sound different. The big problem is that we create a music with our instruments and assume mid file will play same but if instruments are of low quality or even different in timbre may give totally different music. There are many solutions to this. Easiest solution is to produce stream music like mp3 ogg. However what is there are 1000 midi musics but very less disk space?. Its always recommended to keep midi files with original set of instruments so that in future we can reuse them for editing, remixing or other work. What we do is collect all the instruments sounds recorded and save in a bundle called SoundFont. Just like a font which contains set of Alphabets of a language.


So we have a solution.
Midi + SoundFont = Low size & preserved quality of OST (original sound track). 
More details about the topics covered can be found on wiki or tutorials on web.



APPs:

For windows, Mac related midi can be found on this link http://adamrehn.com/articles/playing-midi-soundfonts/


Android Version:
There are some apps which play midi using soundfont viz -

DroindSound, Timidity AE Player, LiveMidi, Midi Voyager, SoundFont-Midi-Player


SoundFont-Midi-Player is my own player i developed to test midi files with different soundfonts fastly. It can change soundfonts easily and fast!. Do try it here -

https://play.google.com/store/apps/details?id=org.greh.soundfontmidiplayer


- Switches between SoundFonts fast
- Test SoundFont instruments using piano
- Play Piano together with Midi music.
- Has playlist to act like a midi player
- Powered by Unmodified FluidSynth 1.1.6 Android Version. If modified source is used i will make the source available here.


Features to add:
- Hack Soundfont instrument without altering soundfont files to test midi music
- Export ogg
- Export rmid, mod?