/*************************************************************************************/ /*تتتتتتتتتتتتتتتتتتتتتتتتتتتت Camilo Navarro & Kristin Romberg, Assignment 3*/ /*************************************************************************************/ // *Our Patch "Control Da Beats" began as an idea to make something that would be fun at parties. We wanted to make a virtual rave generator that would enable the user to stich some beats together, like a dj. We tried to keep it simple by limiting the number of beats (4). We also tried to keep it fun, which is why we didn't include individual tempo options (it was to hard to sync them back up to the same tempo after you fooled around). The user can control the Master tempo of all four beats as one, and the Master Crunch (basically gain), and individually control the volume, pitch, duration, and panning of each beat. If you are so inclined it is also easy to change the actual beats by changing the one's and zero's in the four ImpulseSequencer.ar functions that generate the beats. We tried to put in four basic rave beats that would keep it as simple and fun as possible. // *Some tips to have fun: -try to have your mac's volume at about 1/4, and use Control 0 to raise the Super Collider volume (once it's running) to about 21 db above zero, the beats sound better at that point... -try reversing the pitches of the bass beats and the snare beats -try soloing beats without using volume, by raising the master crunch high, then clicking on the duration bar of the beat you want soloed and giving it a high duration value (and leaving all the other beat's durations low), then moving the master crunch back to low... // It can get tricky, but it's possible to make a pretty fluid bunch of transitions between beats.. // the basic structure of our patch consists of the 4 beats, each of which is an FSinOsc.ar Ugen nested within an LFPulse.ar (or Impulse.ar), ImpulseSequencer.ar, and Decay2.ar, respectively. This structure was decided upon after reviewing many examples and we chose it for the quality of sound it produced. The basic flow of the signal consists of the sound being generated by FSinOsc.ar UGen inside the ImpulseSequencer.ar function, and that sound being then assigned a tempo by the LFPulse.ar UGen, and a sequence of play, (1 plays it, 0 keeps it quiet), inside the ImpulseSequencer.ar UGen. From there it goes to the Decay2.ar Ugen, where it's worked on by our various variables, and finally it goes through the LinPan2.ar UGen for the panning controls. // Now let's go through patch: ------------------------------------------------------------------------------------------ ( play({ var w, tempSlider, crunchSlider, blipSlider, volSlider1, volSlider2, volSlider3, volSlider4, freqSlider1, freqSlider2, freqSlider3, freqSlider4, durSlider1, durSlider2, durSlider3, durSlider4, panSlider1, panSlider2, panSlider3, panSlider4; //----------------------------------------------------------------------------------------- //here we've declared our variables, W is (duh!) the GUI window, the tempSlider is used for the Master Tempo //control, the crunchSlider for the "Crunch it BABY!" Master control, and the blipSlider3 for the //Blip.ar control we put into the 3rd beat as an added perk. The numbered variables are for the //standardized controls, and the number behind each variable refers to which beat it is being used for. //volSlider is used for Volume, freqSlider for frequency (pitch control), durSlider for the sound's //Duration, and panSlider for panning controls. //Here we created our GUI window and assigned values to our variables, we tweaked all the values as much as //possible, to obtain better sounds: //------------------------------------------------------------------------------------------ w = GUIWindow.new("Control Da Beat", Rect.newBy( 300, 70, 480, 390 )) .backColor_(rgb(39,15,255)); tempSlider = SliderView.new( w, Rect.newBy( 45, 18, 128, 20 ), "SliderView", 10, 1, 20, 2, 'linear') .backColor_(rgb(176,176,176)).knobColor_(rgb(255,7,28)); StringView.new( w, Rect.newBy( 75, 43, 128, 20 ), "Main Tempo") .backColor_(rgb(255,2,23)); crunchSlider = SliderView.new( w, Rect.newBy( 210, 18, 128, 20 ), "SliderView", 0.2, 0.01, 0.5, 0.0001, 'linear') .backColor_(rgb(176,176,176)).knobColor_(rgb(2,255,6)); StringView.new( w, Rect.newBy( 225, 43, 128, 20 ), "Crunch it BABY!") .backColor_(rgb(0,255,4)); StringView.new( w, Rect.newBy( 15, 79, 128, 20 ), "Bass Beat") .backColor_(rgb(255,255,0)); volSlider1 = SliderView.new( w, Rect.newBy( 15, 105, 128, 20 ), "SliderView", 30, 0, 50, 0.1, 'linear') .backColor_(rgb(176,176,176)).knobColor_(rgb(255,130,5)); StringView.new( w, Rect.newBy( 149, 105, 128, 20 ), "Volume 1") .backColor_(rgb(255,130,5)); freqSlider1 = SliderView.new( w, Rect.newBy( 15, 132, 128, 20 ), "SliderView", 50, 50, 1000, 10, 'linear') .backColor_(rgb(176,176,176)).knobColor_(rgb(0,255,127)); StringView.new( w, Rect.newBy( 149, 132, 128, 20 ), "Frequency 1") .backColor_(rgb(0,255,127)); durSlider1 = SliderView.new( w, Rect.newBy( 15, 159, 128, 20 ), "SliderView", 0.02, 0.01, 1, 0.001, 'linear') .backColor_(rgb(176,176,176)).knobColor_(rgb(191,0,255)); StringView.new( w, Rect.newBy( 149, 159, 128, 20 ), "Duration 1") .backColor_(rgb(191,0,255)); panSlider1 = SliderView.new( w, Rect.newBy( 15, 185, 128, 20 ), "SliderView", 0, -1, 1, 0.01, 'linear') .backColor_(rgb(176,176,176)).knobColor_(rgb(255,38,38)); StringView.new( w, Rect.newBy( 149, 187, 128, 20 ), "Pan 1") .backColor_(rgb(255,38,38)); StringView.new( w, Rect.newBy( 15, 216, 128, 20 ), "Snare Beat") .backColor_(rgb(255,255,0)); volSlider2 = SliderView.new( w, Rect.newBy( 15, 241, 128, 20 ), "SliderView", 15, 0, 50, 0.1, 'linear') .backColor_(rgb(176,176,176)).knobColor_(rgb(0,128,255)); StringView.new( w, Rect.newBy( 149, 241, 128, 20 ), "Volume 2") .backColor_(rgb(0,128,255)); freqSlider2 = SliderView.new( w, Rect.newBy( 15, 269, 128, 20 ), "SliderView", 440, 50, 1000, 10, 'linear') .backColor_(rgb(176,176,176)).knobColor_(rgb(255,213,0)); StringView.new( w, Rect.newBy( 149, 270, 128, 20 ), "Frequency 2") .backColor_(rgb(255,213,0)); durSlider2 = SliderView.new( w, Rect.newBy( 15, 296, 128, 20 ), "SliderView", 0.02, 0.01, 1, 0.001, 'linear') .backColor_(rgb(176,176,176)).knobColor_(rgb(38,255,38)); StringView.new( w, Rect.newBy( 149, 297, 128, 20 ), "Duration 2") .backColor_(rgb(38,255,38)); panSlider2 = SliderView.new( w, Rect.newBy( 15, 324, 128, 20 ), "SliderView", 0, -1, 1, 0.01, 'linear') .backColor_(rgb(176,176,176)).knobColor_(rgb(255,76,255)); StringView.new( w, Rect.newBy( 149, 324, 128, 20 ), "Pan 2") .backColor_(rgb(255,76,255)); StringView.new( w, Rect.newBy( 236, 79, 128, 20 ), "Triple Bing") .backColor_(rgb(255,255,0)); volSlider3 = SliderView.new( w, Rect.newBy( 236, 105, 128, 20 ), "SliderView", 2, 0, 50, 0.1, 'linear') .backColor_(rgb(176,176,176)).knobColor_(rgb(176,0,0)); StringView.new( w, Rect.newBy( 371, 105, 128, 20 ), "Volume 3") .backColor_(rgb(176,0,0)).labelColor_(rgb(255,255,255)); freqSlider3 = SliderView.new( w, Rect.newBy( 236, 132, 128, 20 ), "SliderView", 700, 50, 1000, 10, 'linear') .backColor_(rgb(176,176,176)).knobColor_(rgb(0,153,0)); StringView.new( w, Rect.newBy( 371, 132, 128, 20 ), "Frequency 3") .backColor_(rgb(0,153,0)).labelColor_(rgb(255,255,255)); durSlider3 = SliderView.new( w, Rect.newBy( 236, 159, 128, 20 ), "SliderView", 0.02, 0.01, 1, 0.001, 'linear') .backColor_(rgb(176,176,176)).knobColor_(rgb(0,0,153)); StringView.new( w, Rect.newBy( 371, 159, 128, 20 ), "Duration 3") .backColor_(rgb(0,0,153)).labelColor_(rgb(255,255,255)); blipSlider = SliderView.new( w, Rect.newBy( 236, 185, 128, 20 ), "SliderView", 400, 0, 1000, 1, 'linear') .backColor_(rgb(176,176,176)).knobColor_(rgb(204,102,0)); StringView.new( w, Rect.newBy( 371, 185, 128, 20 ), "Blip 3") .backColor_(rgb(204,102,0)).labelColor_(rgb(255,255,255)); panSlider3 = SliderView.new( w, Rect.newBy( 236, 211, 128, 20 ), "SliderView", 0, -1, 1, 0.01, 'linear') .backColor_(rgb(176,176,176)).knobColor_(rgb(153,0,153)); StringView.new( w, Rect.newBy( 371, 211, 128, 20 ), "Pan 3") .backColor_(rgb(153,0,153)).labelColor_(rgb(255,255,255)); StringView.new( w, Rect.newBy( 236, 241, 128, 20 ), "Constant Roll") .backColor_(rgb(255,255,0)); volSlider4 = SliderView.new( w, Rect.newBy( 236, 269, 128, 20 ), "SliderView", 0, 0, 50, 0.1, 'linear') .backColor_(rgb(176,176,176)).knobColor_(rgb(0,255,0)); StringView.new( w, Rect.newBy( 371, 269, 128, 20 ), "Volume 4") .backColor_(rgb(0,255,0)); freqSlider4 = SliderView.new( w, Rect.newBy( 236, 296, 128, 20 ), "SliderView", 50, 50, 1000, 10, 'linear') .backColor_(rgb(176,176,176)).knobColor_(rgb(255,0,0)); StringView.new( w, Rect.newBy( 371, 296, 128, 20 ), "Frequency 4") .backColor_(rgb(255,0,0)); durSlider4 = SliderView.new( w, Rect.newBy( 236, 324, 128, 20 ), "SliderView", 0.02, 0.01, 1, 0.001, 'linear') .backColor_(rgb(176,176,176)).knobColor_(rgb(255,255,0)); StringView.new( w, Rect.newBy( 371, 324, 128, 20 ), "Duration 4") .backColor_(rgb(255,255,0)); panSlider4 = SliderView.new( w, Rect.newBy( 236, 350, 128, 20 ), "SliderView", 0, -1, 1, 0.01, 'linear') .backColor_(rgb(176,176,176)).knobColor_(rgb(255,106,0)); StringView.new( w, Rect.newBy( 371, 350, 128, 20 ), "Pan 4") .backColor_(rgb(255,106,0)); //--------------------------------------------------------------------------------------------------- // and here we go into the four beats....For the panning controls to take effect, we nested each Decay2.ar //UGen inside a LinPan2.ar panning function, and put each respective panSlider variable at the end. //The variable for Master tempo (tempSlider) was inserted inside the LFPulse.ar Ugen in the frequency spot, //and assigned values from 1 to 20. The one's and zero's comprise the ImpulseSequencer.ar's sequence, and we //fooled with these quite a bit, until we found the beats we wanted. The LFPulse is the trigger for the sequence, //and the volSlider variables were inserted into the multiplier spot of the ImpulseSequencer UGen. The //durSlider and crunchSlider variables are in the add spot and they merely change the sound output. //The FSinOsc.ar UGen generates the actual tones, and the freqSlider variables within it regulate the pitch //of the tones. The Blip.ar function is an added bonues for variability, we put it into the third beat, and //it adds some harmonics (in our case 3) to the frequency it modifies, in this case our last variable: //blipSlider. the 3rd beat also differs in that it uses an Impulse.ar instead of an LFPulse.ar UGen, again //for added sound variability. //----------------------------------------------------------------------------------------------------- LinPan2.ar( Decay2.ar (ImpulseSequencer.ar( `[1,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0], LFPulse.ar(tempSlider.kr), volSlider1.kr), durSlider1.kr, crunchSlider.kr, FSinOsc.ar((freqSlider1.kr), 0.1)), panSlider1.kr) + LinPan2.ar( Decay2.ar (ImpulseSequencer.ar( `[0,0,0,0,1,0,0,1,0,1,0,0,1,0,0,1] , LFPulse.ar(tempSlider.kr), volSlider2.kr), durSlider2.kr, crunchSlider.kr, FSinOsc.ar((freqSlider2.kr),0.1)), panSlider2.kr) + LinPan2.ar( Decay2.ar (ImpulseSequencer.ar( `[1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0] , Impulse.ar(tempSlider.kr), volSlider3.kr), durSlider3.kr, crunchSlider.kr, FSinOsc.ar(freqSlider3.kr, Blip.ar(blipSlider.kr, 3))), panSlider3.kr) + LinPan2.ar( Decay2.ar (ImpulseSequencer.ar( `[1] , LFPulse.ar(tempSlider.kr), volSlider4.kr), durSlider4.kr, crunchSlider.kr, FSinOsc.ar((freqSlider4.kr), 0.05)), panSlider4.kr); }) ) //-------------------------------------------------------------------------------------------------------- //we tried using the w.close command here at the end, but we could NOT get it to work, it was pretty frustrating!! //It's pretty funny that after writing all this code we couldn't get the simplest w.close command to work.... // All in all we found our idea was very much realized in the end, although we would have liked it better with // a few more gadgets, like delays and filters, but THEY were strictly outlawed, so we stuck with this... -------------------------------------------------THE END???-----------------------------------------------