exporting list of MidiData into actual midi file

Topics: Getting Started, Midi File, Midi IO
Nov 21, 2013 at 12:19 AM
Hi, I am trying to use your library to generate random sequence of notes (which should be used later as individuals in a population for the purpose of genetic algorithm), I have them stored in a list of MidiData structs. I am wondering though whether there's a way to export them to an actual midi file. I tried looking at CannedBytes.Midi.RecordToFile but I'm not exactly using a midi input port. Then there's the question of how is duration and start of each note actually stored in a midi file. Can you provide any suggestions where should I start looking? Is export even possible in this way? Thank you for your answer in advance.
Nov 21, 2013 at 7:12 AM
If you create MidiMessages for each MidiData value (using the CannedBytes.Midi.Message.MidiMessageFactory.CreateShortMessage method) you will be able to save these events to a midi file using the code in the RecordToFile sample (MidiFileSerializer).

Should be only a couple of lines of code...

Hope it helps,