// Jim Thomas and John Rice // May 3, 2000 // Coco12 Assignment #3 /* We developed a program that allows the user to turn a few base sounds into a musical beat they enjoy. We inputed the sounds and used sliders to change such things as frequency, amplitude, and tempo. Our sounds are fairly simple. Using the Impulse function we were able to input a beat that would not be distorted by the sliders, somewhat keeping the original form we developed in tact. Using the LPPulse function as a slider we were able to modify the tempo of the entire program. A Spawnfunction was used in order to repeat a sound that slowly fades out to zero and is repeated throughout the entire program, creating the sauce. So, just sit back and enjoy some of JJ's special sauce. The frequency variables increase the frequency for each individual sound. The amplitude variable increase the sound level of each sound and also allow us to remove a certain sound from the mix. S_beg and S_end are specific to the spawn function and allow the user to change the frequency of the saw wave. The x variables allow the user to change the beginning and end frequency of the xline fadeout. Notice that if the ending frequency is set too high the sound will remain in the program until the program is quit. */ ( var w; // GUI window variable var tempo; // Our master tempo variable var freq1, freq3; // Individual sound variables, initiated in sliderviews, these are freq var amp1, amp2, amp3; // Amplitude Variables var res1, res2, res3; // Resonance Variables var s_beg, s_end; // Spawn, saw, and xline variables var x_beg, x_end, dur; // Xline fadeout Variables // Establishes the GUI window with set boundaries w = GUIWindow.new("Scratch Pad", Rect.newBy(148, 39, 606, 541)) .backColor_(rgb(125,75,145)); // Master Tempo Slider, adjusts the tempo of all 3 main sounds tempo = SliderView.new( w, Rect.newBy(170, 31, 128, 20), "SliderView", 12, 2, 40, 0, 'exponential') .backColor_(rgb(120,125,180)).knobColor_(rgb(120, 240, 80)); StringView.new( w, Rect.newBy(322, 31, 128, 20), "DJ's Master Tempo"); // Sound 1 Sliders and Labels freq1 = SliderView.new( w, Rect.newBy(20, 118, 128, 20), "SliderView", 100, 0, 1000, 0, 'linear') .backColor_(rgb(120,125,180)).knobColor_(rgb(120, 240, 80)); amp1 = SliderView.new( w, Rect.newBy(20, 145, 128, 20), "SliderView", 0.1, 0, 1, 0, 'linear') .backColor_(rgb(120,125,180)).knobColor_(rgb(120, 240, 80)); res1 = SliderView.new( w, Rect.newBy(20, 172, 128, 20), "SliderView", 0.5, 0, 1, 0, 'linear') .backColor_(rgb(120,125,180)).knobColor_(rgb(120, 240, 80)); StringView.new( w, Rect.newBy(20, 90, 128, 20), "SOUND_1"); StringView.new( w, Rect.newBy(160, 118, 128, 20), "Pitch_1"); StringView.new( w, Rect.newBy(160, 145, 128, 20), "Volume_1"); StringView.new( w, Rect.newBy(160, 172, 128, 20), "Resonance_1"); // Sound 2 Sliders and Labels amp2 = SliderView.new( w, Rect.newBy(20, 269, 128, 20), "SliderView", 0.7, 0, 1, 0, 'linear') .backColor_(rgb(120,125,180)).knobColor_(rgb(120, 240, 80)); res2 = SliderView.new( w, Rect.newBy(20, 296, 128, 20), "SliderView", 0.5, 0, 1, 0, 'linear') .backColor_(rgb(120,125,180)).knobColor_(rgb(120, 240, 80)); StringView.new( w, Rect.newBy(20, 214, 128, 20), "SOUND_2"); StringView.new( w, Rect.newBy(167, 269, 128, 20), "Volume2"); StringView.new( w, Rect.newBy(167, 296, 128, 20), "Resonance2"); // Sound 3 Sliders and Labels freq3 = SliderView.new( w, Rect.newBy(20, 389, 128, 20), "SliderView", 500, 100, 2000, 0, 'linear') .backColor_(rgb(120,125,180)).knobColor_(rgb(120, 240, 80)); amp3 = SliderView.new( w, Rect.newBy(20, 420, 128, 20), "SliderView", 0.2, 0, 1, 0, 'linear') .backColor_(rgb(120,125,180)).knobColor_(rgb(120, 240, 80)); res3 = SliderView.new( w, Rect.newBy(20, 449, 128, 20), "SliderView", 0.5, 0, 1, 0, 'linear') .backColor_(rgb(120,125,180)).knobColor_(rgb(120, 240, 80)); StringView.new( w, Rect.newBy(20, 338, 128, 20), "SOUND_3"); StringView.new( w, Rect.newBy(174, 365, 128, 20), "Pitch_3"); StringView.new( w, Rect.newBy(174, 392, 128, 20), "Volume_3"); StringView.new( w, Rect.newBy(174, 419, 128, 20), "Resonance_3"); // Sound 4 Sliders and Labels s_beg = SliderView.new( w, Rect.newBy(263, 118, 128, 20), "SliderView", 100, 25, 225, 0, 'linear') .backColor_(rgb(120,125,180)).knobColor_(rgb(120, 240, 80)); s_end = SliderView.new( w, Rect.newBy(263, 145, 128, 20), "SliderView", 250, 100, 500, 0, 'linear') .backColor_(rgb(120,125,180)).knobColor_(rgb(120, 240, 80)); x_beg = SliderView.new( w, Rect.newBy(263, 175, 128, 20), "SliderView", 8000, 400, 12000, 0, 'linear') .backColor_(rgb(120,125,180)).knobColor_(rgb(120, 240, 80)); x_end = SliderView.new( w, Rect.newBy(263, 205, 128, 20), "SliderView", 1, 1 , 200 , 0, 'linear') .backColor_(rgb(120,125,180)).knobColor_(rgb(120, 240, 80)); dur = SliderView.new( w, Rect.newBy(263, 234, 128, 20), "SliderView", 7, 1, 12, 0, 'linear') .backColor_(rgb(120,125,180)).knobColor_(rgb(120, 240, 80)); StringView.new( w, Rect.newBy(342, 90, 128, 20), "JJ's Special Sauce"); StringView.new( w, Rect.newBy(418, 118, 128, 20), "Tone Start Freq"); StringView.new( w, Rect.newBy(418, 145, 128, 20), "Tone End Freq"); StringView.new( w, Rect.newBy(418, 172, 128, 20), "Swoop Start Freq"); StringView.new( w, Rect.newBy(418, 199, 128, 20), "Swoop End Freq"); StringView.new( w, Rect.newBy(418, 226, 128, 20), "Swoop Length"); play({ // Bass beat with a set rhythm pattern using SinOsc as the input sound // LFPulse used in all 3 sounds as a trigger (every time passing 0 to // the positive side of the spectrum sets the trigger off thus hitting the next beat) /* Important to notice that the next beat doesn't need to be an actual value it could be zero, thus allowing the creator to invent a set rhythm */ // Sliders used to change resonance, frequency, and amplitude Decay2.ar( ImpulseSequencer.ar(`[1,0,0.3,0,0.3,0,0.3,0,1,0,0.3,0,1,0.1,0.1,0.1], LFPulse.ar(tempo.kr)), 0.001, (res1.kr), SinOsc.ar((freq1.kr),0.1, (amp1.kr))) + // Snare Drum beat also with a set rhythm pastter using PinkNoise as the input sound // PinkNoise created a nice high "drum roll" type sound Decay2.ar( ImpulseSequencer.ar(`[1, 0, 0, 0, 0.2, 0.2, 0.6, 0], LFPulse.ar(tempo.kr)), 0.2, (res2.kr), PinkNoise.ar(amp2.kr)) + // High accent used to 'spice' up the sound // Sliders used to change resonnace, frequency, and amplitude Decay2.ar( ImpulseSequencer.ar(`[0, 0, 0,0,0,0,1,0, 1, 1, 1, 0, 0,0,0,0], LFPulse.ar(tempo.kr)), 0.02, (res3.kr), Saw.ar((freq3.kr),(amp3.kr))) + // Tha special sauce. Just pour it on. // Our secret remedy for a good time Spawn.ar({RLPF.ar(Saw.ar([(s_beg.kr), (s_end.kr)],0.1), XLine.kr((x_beg.kr), (x_end.kr), (dur.kr)), 0.05)}, 2, 3)}); w.close; )