Program not startin on external power input?

did you connect the ground from the midi adapter to the ground of the arduino? the signal may be using the ground from usb as a common ground, and when you take away the computer you disconnect the ground.