I am working with Artificial Neural Networks, on a task regarding music generation.

Given: a collection of MIDI files (converted from Guitar Pro 6) where ONLY three tracks are used (per MIDI file): namely, guitar, bass, drums. For example, I converted 5 AC/DC songs from their Guitar Pro file, into 5 separate MIDI files containing only one guitar track, one bass track, and the drums track.

Wanted: ONE MIDI file (with the same three tracks) that is merged from all other MIDI files. To be more clear, in the example above I mentioned having 5 MIDI files of 5 different AC/DC songs. How can I convert them into ONE MIDI file that contains all those 5 songs, played consecutively? For example, if I play this ONE MIDI file, it would produce the sound of one song until its end, then the next song, and so on until the last song.

Ultimately, in order to access MIDI information in Matlab, I convert MIDI files into csv files. If it is easier to merge csv files (while making sure that songs play one after the other), then please help me with the csv merging.

The csv format is obtained from https://stackoverflow.com/questions/4747834/import-csv-file-with-mixed-data-types

csv format

  • What is the exact format of these CSV files?
    – CL.
    Apr 24, 2017 at 10:59
  • just edited it. I include the picture and source
    – mjeshtri
    Apr 24, 2017 at 11:02
  • That format uses absolute timestamps, so you would have to add the length of all previous files to all times in the next file.
    – CL.
    Apr 24, 2017 at 11:57
  • I'm under the impression that .mid files are a binary format, not a 'human-readable' one, so I assume the .csv output imaged above is the result of post-processing, right? In any case, if you have csv files like these, if the header is consistent (i.e. the notes always start on line 7, and the tempo etc doesn't change), then concatenating these in matlab is very easy; it's simply a case of collecting the csv as a cell array, discarding the first 6 elements from all cell arrays except the first one, and then concatenating them together (e.g. with the cat function). May 19, 2017 at 22:20
  • alternatively, you could use one of the many existing midi-to-xml converters, and parse the xml to your heart's desire using matlab's xml-parsing tools and some simple if-statements May 19, 2017 at 22:45

1 Answer 1


I found one solution myself: use a DAW, in my case, Cubase.

This will allow to easily play and manipulate MIDI files.

Source: https://sound.stackexchange.com/questions/24055/combine-midi-files?newreg=8269c5b81e61461a9ede73e3880b6884

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.