Use MIDI lib for read input data

Code refactor using the MIDI lib, because of some synchronous problems.
Also removed buffering concept (useless).