/// <summary> /// Loads a <see cref="Pattern"/> from a MIDI file /// </summary> /// <param name="filePath">Path to the MIDI file</param> /// <returns>Loaded pattern</returns> public static Pattern LoadPatternFromMidi(string filePath) { var midiParser = new MidiParser(); var patternBuilder = new StaccatoPatternBuilder(midiParser); midiParser.Parse(new Sequence(filePath)); return(patternBuilder.Pattern); }
public void it_parses() { var midiParser = new MidiParser(); var musicSheet = midiParser.Parse(TestMidiFilePath); Assert.That(musicSheet.MetronomeMark.Metronome, Is.EqualTo(120)); Assert.That(musicSheet.Melody, Is.Not.Null.And.Not.Empty); }
public static void MidiToJSON() { string dataPath = Application.dataPath.Replace('/', '\\'); string midiFilePath = dataPath + @"\UnityTools\song.mid"; FileStream fileStream = File.OpenRead(midiFilePath); string midiJSON = MidiParser.Parse(fileStream); }