/***************************************************************************************************** /* Faye H. Teng & Derek Nee, Assignment 3 */ /**************************************************************************************************** The use of sliders to control different aspects of sound brings up thoughts of a DJ. And what's the most important thing the DJ deals with? The beat! Our patch gives the user a techno beat, and the user can change the frequency, pitch, volume, and pulse width of the beat to create some funky head-nod rhythms that'd make any raver boogie with glowsticks in hand. /* */ /**************************************************************************************************** ( var w,freqslider,widthslider,mulslider,addslider,ampslider,freqnum,widthnum,mulnum,addnum,ampnum; // Our GUI window w = GUIWindow.new("Beat", Rect.newBy(163, 94, 400, 400)).backColor_(rgb(58,68,176)); // Our Numerical Views freqnum = NumericalView.new( w, Rect.newBy(160, 25, 64, 20), "NumericalView", 3, 0, 10, 0.1, 'linear'); widthnum = NumericalView.new( w, Rect.newBy(160, 75, 64, 20), "NumericalView", 0.3, 0, 2, 0.01, 'linear'); mulnum = NumericalView.new( w, Rect.newBy(160, 125, 64, 20), "NumericalView", 200, 0, 1000, 100, 'linear'); addnum = NumericalView.new( w, Rect.newBy(160, 175, 64, 20), "NumericalView", 200, 0, 1000, 100, 'linear'); ampnum = NumericalView.new( w, Rect.newBy(160, 225, 64, 20), "NumericalView", 0.1, 0, 2, 0.01, 'linear'); // Our String Views StringView.new( w, Rect.newBy(250, 25, 128, 20), "Speed"); StringView.new( w, Rect.newBy(250, 75, 128, 20), "Pulse Width"); StringView.new( w, Rect.newBy(250, 125, 128, 20), "Pitch 1"); StringView.new( w, Rect.newBy(250, 175, 128, 20), "Pitch 2"); StringView.new( w, Rect.newBy(250, 225, 128, 20), "Volume"); // Our Sliders // Frequency equates to the speed of the beat // Width equates to the pulse width // Mul changes the pitch // Add changes the pitch // Amplitude changes the volume freqslider = SliderView.new( w, Rect.newBy(15, 25, 128, 20), "SliderView", 3, 0, 10, 0.1, 'linear').backColor_(rgb(60,176,75)).knobColor_(rgb(176,86,56)); widthslider = SliderView.new( w, Rect.newBy(15, 75, 128, 20), "SliderView", 0.3, 0, 2, 0.01, 'linear').backColor_(rgb(60,176,75)).knobColor_(rgb(176,86,56)); mulslider = SliderView.new( w, Rect.newBy(15, 125, 128, 20), "SliderView", 200, 0, 1000, 10, 'linear').backColor_(rgb(60,176,75)).knobColor_(rgb(176,86,56)); addslider = SliderView.new( w, Rect.newBy(15, 175, 128, 20), "SliderView", 200, 0, 1000, 10, 'linear').backColor_(rgb(60,176,75)).knobColor_(rgb(176,86,56)); ampslider = SliderView.new( w, Rect.newBy(15, 225, 128, 20), "SliderView", 0.1, 0, 2, 0.01, 'linear').backColor_(rgb(60,176,75)).knobColor_(rgb(176,86,56)); // Sets our Numerical Views to our Sliders and vice versa freqnum.action = {freqslider.value = freqnum.value}; freqslider.action = {freqnum.value = freqslider.value}; widthnum.action = {widthslider.value = widthnum.value}; widthslider.action = {widthnum.value = widthslider.value}; mulnum.action = {mulslider.value = mulnum.value}; mulslider.action = {mulnum.value = mulslider.value}; addnum.action = {addslider.value = addnum.value}; addslider.action = {addnum.value = addslider.value}; ampnum.action = {ampslider.value = ampnum.value}; ampslider.action = {ampnum.value = ampslider.value}; // Creates our beat using a Sin Oscillator with a low frequency Pulse // The first 4 sliders control various aspects of the LFPulse which is the frequency of the SinOsc // There is also a slider to control the amplitude of SinOsc { SinOsc.ar(LFPulse.kr(freqslider.kr,widthslider.kr,mulslider.kr,addslider.kr), 0, ampslider.kr) }.play; w.close; )