{
   "labels" : [],
   "is_private" : null,
   "id" : "1-5bC",
   "code" : "(\r\nm = SimpleMIDIFile.read(\"C:/Users/WM/Documents/Peter code/Midi/Croatia.mid\");\r\nm.timeMode_('seconds'); // convert ticks to seconds\r\n);\r\n(\r\nMIDIClient.init; // check list for available devices\r\nMIDIClient.destinations;\r\na = MIDIOut(2); //Midi number of destination\r\n);\r\n(\r\n~cont = 0;\r\n~tiempo = 0.2;\r\n~transpose = 12;\r\nt = Task({\r\n\te = m.noteSustainEvents(nil, nil); // get notes from track 1\r\ne.do{arg event;\r\n        a.noteOn(1, e[~cont][4] + ~transpose, e[~cont][5]);\r\n        e[~cont][6]*~tiempo.wait; // durations, you can scale this number to change the durations\r\n        a.noteOff(1, e[~cont][4] + ~transpose, e[~cont][5]);\r\n        ~cont=~cont+1;\r\n        ~cont.postln;\r\n};\r\n});\r\n);\r\n//Gui\r\n\r\n(\r\nvar window, button, fader;\r\nwindow = Window(\"Peter´s Code\", Rect(100, 100, 400, 500)).front;\r\nbutton = Button(window, Rect(30, 380, 150, 100));\r\nfader = Slider(window,  Rect(30, 40, 50, 320));\r\nfader.action_({|obj|\r\n\tvar tr;\r\n\ttr = obj.value.linlin(0,1,-12,12).postln;\r\n\ttr + ~transpose;\r\n\t{a.allNotesOff};\r\n});\r\nbutton.states = [[\"Off\", Color.white, Color.black], [\"On\", Color.black, Color.red]];\r\nbutton.action = {|val| if(val.value == 1, {t.play; \"Task On\".postln}, {t.stop; \"Task Off\".postln})};\r\n);",
   "name" : "SimpleMIDIFile help",
   "author" : "Wingel Pérez Mendoza",
   "ancestor_list" : [],
   "description" : "Dear friends,\r\nI am trying to manipulate different aspects in a midi file, so far, I am having problems with 2 particular aspects. I want to control my midi file with a slider, but I don´t know why is not working, another problem is that my code doesn´t play the rhythm, could you help me, please???\r\n\r\nGreetings,"
}
