1. A method for compressing music data files, comprising: extracting music data events from a music data file; generating a music data event search window, wherein the music data event search window comprises a plurality of previous events and is used for searching for at least one previous event that matches with an event of a look-ahead window; and wherein each event comprises a number of event elements; searching for one previous event in the music data event search window that has optimal matching with the event of the look-ahead window; and storing an index of the optimal matching event in a compressed codeword.