[Sprint Samsung Galaxy S 4 Q&A, Help & Troubleshoot] thegrrraue:
I'm using a USB MIDI keyboard (through a mini USB connector) and trying to use my Galaxy S4 to drive the sound. The reason is that it's a small, portable, solid state computing device (stage vibrations already killed a couple hard drives in the last few months) that I already own. The drawback, of course, is latency. The delay between key press and sound generation makes this unworkable.

Here's a list of what I've done, I'd love to hear any advice for making this possible. I'm hoping to update this into a complete tutorial if it is successful:

1) The best app as far as sounds available (for the music I play, this may vary for you) AND allowing external keyboard control is Music Synthesizer (https://play.google.com/store/apps/details?id=com.levien.synthesizer). It would be ideal if there was an app that allowed VST plugins for custom sounds or had its own internal latency controls, but none seem to exist on Android. Please, please notify me if I'm wrong. That would make this whole setup better.

2) Because stock Android is super bloated, I wiped and flashed TriFroceRom onto my device using TWRP. This was harder for me than I'd like to admit, so allow me to point future people to what worked for me:

First you'll need to get TWRP up and running. Here's the walk through that worked for me: http://wccftech.com/install-twrp-recovery-on-samsung-galaxy-s4-i9505/

This is the best tutorial I've found for installing TriForce: http://wccftech.com/flash-triforcerom-54-samsung-galaxy-s4-sphl720/. MAKE SURE you do not just reboot straight away. Follow that last step about going back to home, reboot menu, into system. And it may ask to fix your root permissions too. I skipped that part and had a dead phone for a while.

Also, if you're on this stage and wondering about the best way to back everything up before you do it, G Cloud (https://play.google.com/store/apps/details?id=com.genie9.gcloudbackup&hl=en) is your answer. It is free, works perfect on upload and download, and lets you look at what is on their server at any time (including browsing photos, not just file names). Text messages and contacts sync too. If you pay a little bit of money for the full version, it will even keep your application data. If you're super cool and want to put in my referral number, it's BG2III (gives me more storage, and those are uppercase letter i not number 1s).

3) I then added Ktweaker so that I could overclock and improve the system performance. I watched this video to figure it out: https://www.youtube.com/watch?v=w5hcuLG-xp0. He has a link to download the files for Ktweaker which is this: http://xdaforums.com/showthread.php?t=2294083 but you ALSO need to know that, with the links provided, you PROBABLY need 4.3 touchwiz version. TriForce Rom is a touchwiz rom for sure, and depending on when in the future you see this, check your device's about page (in the settings on your phone) to make sure which version of android you're running.

ALL OF THIS SAID, I have noticed zero improvement. I've read some documentation on Ktweaker and watched some videos on optimizing it and tried several different settings (overclocking, changing the CPU governor, reducing internal and external read ahead (and increasing, for kicks and giggles, though it seemed counter to my intuition), and ultimately have found not a single detectable millisecond of improvement in the latency.

Does anybody have any ideas? I understand that the Nexus devices are supposed to have lower latency, but a new device is not currently in my budget. It seems to me that MIDI controllers have been possible with very low latency since far before the computing power of even this phone was available, so conceivably there should be a way.