class FlowRZong extends Zong{ int[] drumpads = { 35,44,46,47,48,42 }; float pitch = 60; float position; FlowRZong(){ name = "FlowRZong!"; makeSong(); println("song "+name+" loaded!"); } void makeSong(){ score.empty(); for(int i=0;i<2*4*4*4; i++){ makePattern(); } score.tempo(130); score.addCallbackListener(p); } void makePattern(){ for(float i=0; i<16; i++){ float auxposition = (position+i)/4; if(i%4== 0){ score.addNote(auxposition, 9, 0, 36, 120, 0.25, 0.8, 64); score.addNote(auxposition+.25, 9, 0, 36, 100, 0.25, 0.8, 64); addHighNote(auxposition); } else if(i%8==6){//%4==3//%8==6 score.addNote(auxposition, 9, 0, 38, 120, 0.25, 0.8, 64); addHighNote(auxposition); } else if(random(1)<.8){ score.addNote(auxposition,9,0,drumpads[(int)random(drumpads.length)], (int)random(80)+40, 0.2, 0.8, random(127)); addHighNote(auxposition); } else if(random(1)<.9){ score.addNote(auxposition,9,0,drumpads[(int)random(drumpads.length)]-24, (int)random(80)+40, 0.2, 0.8, random(127)); } addBassNote(auxposition); //if(i==0)score.addCallback(auxposition, 2); } position+=16; } void addBassNote(float i){ pitch = score.pcRandomWalk(36, 12, score.MINOR_PENTATONIC);//INDIAN); //score.addNote(i, 0, 38, pitch, 100+random(20), random(0.25,.5), 0.2, 64); } void addHighNote(float i){ pitch = score.pcRandomWalk(36+12*2, 12, score.MINOR_PENTATONIC);//INDIAN); score.addNote(i, 1, score.DISTORTED_GUITAR, pitch, 60+random(20), random(.5,2.5), 0.5, 64); score.addNote(i, 1, score.ELECTRIC_GUITAR, pitch+12, 20+random(20), random(5,8), 0.1, 64); score.addNote(i+.25, 1, score.DISTORTED_GUITAR, pitch, 40+random(40), random(.5,2.5), 0.1, 64); } void checksong(){ if(rocking){ bar = int(cframe/16); frame = cframe%16; //if(lyrics[bar][frame]!=null)donmiguel.sing(lyrics[bar][frame]); cframe++; } } void rock(){ //sequencer.start(); score.play(); rocking = true; println("song "+name+" rocking!"); } void stop(){ score.stop(); rocking = false; bar = 0; frame = 0; cframe = 0; println("song "+name+" stopped"); } void draw(){ if(!score.playing)stop(); } }