3

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

4
  • 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.
    Commented 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). Commented 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 Commented May 19, 2017 at 22:45
  • but the problem is that, if I do it your way, songs will not be merged through time. MIDI uses absolute time, and in order for me to merge, lets say, two MIDI files into one, I need to add the last time of the first MIDI to all timesteps of the second MIDI. Thats why using a DAW is easier and faster.
    – mjeshtri
    Commented May 19, 2017 at 23:00

1 Answer 1

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 you have read our privacy policy.

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