2

I want to create a midi file with AlphaTab project in C#.

var score = LoadScoreFromBytes(File.ReadAllBytes("d:\\1.gp5"), new AlphaTab.Settings());

                var newMidi = new MidiFile();
                var generator = new MidiFileGenerator(
                    score, 
                    new AlphaTab.Settings(),
                    new AlphaSynthMidiFileHandler(newMidi));

                generator.Generate();

                var midiBinary = newMidi.ToBinary();

                // Here , I want to write byte[] to a midi file and play that.
  • So your real question is 'How to play MIDI file from bytes'? If yes, please correct the question title and add more description of the problem. – Maxim Jan 30 '20 at 11:59
  • I want to create midi file from a guitar pro files (gp4, gp5, gpx extensions) with AlphaTab project and save that on the local path ,for example Drive D. – Hossein Daneshfar Jan 30 '20 at 12:35
  • In your code I see that you successfully create MIDI bytes from GP files, don't you? Please add more description to your question. – Maxim Jan 30 '20 at 12:50
  • When I write this bytes object with c# file stream, it cannot play and windows media player show error. – Hossein Daneshfar Jan 30 '20 at 13:00
  • Finally, I want to convert midi to mp3 with sound font in C#. Can you help me ? If you have a solution for convert guitar pro files to mp3 file with sound font, please tell to me. – Hossein Daneshfar Jan 30 '20 at 13:03

0 Answers0