// title: Re: Launchpad Spiral // author: grirgz // description: // For the challenge, let's make the path algorithmically =) // code: ( MIDIClient.init; MIDIIn.connectAll; ~lpChan = 0; ~lpIn = MIDIClient.sources.select({arg item, i; (item.name == "Launchpad Mini")})[0]; //Pick the first launcpad mini you find ~lpOut = MIDIOut.newByName("Launchpad Mini", "Launchpad Mini"); ~lpNoteNums = Array.fill([8,8], {|i,j| j+(i*16) }); ) ( var path = { var dir = [1,0]; var list = List.new; var idx = [-1,0]; var size = 8; size.do { arg x; if(x==0, 1, 2).do { (size-x).do { idx = idx + dir; list.add(idx); }; dir = [ -1 * dir[1], dir[0] ]; // rotate }; }; list; }.value.collect({ arg x; x[0]+(x[1]*16) }); r = Routine({ inf.do{ var velocity = [127, 120, 107].choose; path.do{|note, i| ~lpOut.noteOn(~lpChan, note, velocity); 0.015.wait; ~lpOut.noteOff(~lpChan, note, velocity); } } }); TempoClock.default.sched(0, r); )