// The Gooey GUI: Justin To and Nicole Tsong // /* This patch allows allows the user to manipulate sliders, which vary the frequency, phase, amplitude, and offset of a sine wave which modulates the frequency of a main waveform/ugen. The user can also vary the frequency of a sine wave which modulates the amplitude of the main waveform/ugen. The wave forms which can be modulated are a sine wave, a saw wave, and a pulse wave, as well as the formant ugen. The point of this patch was to explore different ways a waveform/ugen could be altered just by using a sine wave modulator. There is also a bell sound that can be turned on and off in the patch. These two electronically-created sounds that have very different effects. The manipulation of the sine, pulse, and saw waves and the formant ugen create sounds that the listener would immediately interpret as electronically made. The bell, on the other hand, sounds distinctly like a non-electronic sound. But we still know that the bell was created electronically, and it becomes an interesting paradox within the patch. Variables (I will concentrate on vars for the sine wave, since it's bascially the same for all): *sinnumfreq, sinnumamp - The frequency shown on screen for the freq and amp, respectively *sinfreqmain, sinampmain - The sliders for the unmodulated freq and amp, respectively *sinmodfreqfreq, sinmodfreqphase, sinmodfreqamp, sinmodfreqadd - sliders for the modulating sine wave's freq, phase, amp, and offset, respectively *sinmodampfreq - The slider for the modulating sine wave's frequency *sinfreq, sinamp - definitions of the frequency and amplitude, respectively *formantfundfreq, formantformfreq, formantwidthfreq - definition of the formant ugen fundamental frequency, formant freq, and pulsewidth of the freq, respectively *sinphase - phase of the sine wave *pulsewidth - width of the pulse wave *spawn - definition of the bell *mainSin - definition of the sine wave heard *sincheck - checkbox for the turning the sine wave on or off Signal flow (I will concentrate on vars for the sine wave, since it's bascially the same for all): *sinfreqmain, sinampmain will alter the main sine frequency and amplitude of mainSin, respectively *sinmodfreqfreq, sinmodfreqphase, sinmodfreqamp, sinmodfreqadd will alter the sine wave which is modulating sinfreq (which is the freq of mainSin) *sinmodampfreq will alter the sine wave which is modulating sinamp (which is the amp of mainSin) *sincheck will turn the wave on or off by controlling sinamp ************************************************************************************* ( var w, sinnumfreq, sinnumamp, sawnumfreq, sawnumamp, pulsenumfreq, pulsenumamp, formantnumfreq, formantnumamp, sinfreqmain, sinampmain, sawfreqmain, sawampmain, pulsefreqmain, pulseampmain, formantfreqmain, formantampmain, sinmodfreqfreq, sinmodfreqphase, sinmodfreqamp, sinmodfreqadd, sawmodfreqfreq, sawmodfreqphase, sawmodfreqamp, sawmodfreqadd, pulsemodfreqfreq, pulsemodfreqphase, pulsemodfreqamp, pulsemodfreqadd, formantmodfreqfreq, formantmodfreqphase,formantmodfreqamp, formantmodfreqadd, sinmodampfreq, sawmodampfreq, pulsemodampfreq, formantmodampfreq, sinfreq, sinphase, sinamp, sawfreq, sawamp, pulsefreq, pulsewidth, pulseamp, formantfundfreq, formantformfreq, formantwidthfreq, formantamp, spawn, mainSin, mainSaw, mainPulse, mainFormant, bellcheck, sincheck, sawcheck, pulsecheck, formantcheck; w = GUIWindow.new("panel", Rect.newBy( 36, 48, 576, 415 )).backColor_(rgb(2,2,51)); // Sine Wave // sinnumfreq = NumericalView.new( w, Rect.newBy( 15, 51, 64, 20 ), "NumericalView", 400, 0, 3000, 1, 'linear'); sinfreqmain = SliderView.new( w, Rect.newBy( 15, 77, 110, 14 ), "A1", 400, 1, 3000, 1, 'linear').backColor_(rgb(189,181,197)); sinmodfreqfreq = SliderView.new( w, Rect.newBy( 15, 187, 109, 15 ), "A2", 0, 0, 2000, 1, 'linear').backColor_(rgb(189,181,197)); sinmodfreqphase = SliderView.new( w, Rect.newBy( 15, 150, 109, 15 ), "A3", 0, 0, 1, 0, 'linear').backColor_(rgb(189,181,197)); sinmodfreqamp = SliderView.new( w, Rect.newBy( 15, 114, 109, 15 ), "A4", 0, 0, 13000, 1, 'linear').backColor_(rgb(189,181,197)); sinmodfreqadd = SliderView.new( w, Rect.newBy( 15, 223, 109, 15 ), "A5", 1, 1, 50, 1, 'linear').backColor_(rgb(189,181,197)); sinnumamp = NumericalView.new( w, Rect.newBy( 15, 264, 64, 20 ), "NumericalView", 0.3, 0, 0.6, 0.01, 'linear'); sinampmain = SliderView.new( w, Rect.newBy( 15, 296, 109, 13 ), "A6", 0.3, 0.01, 1, 0.01, 'linear').backColor_(rgb(189,181,197)); sinmodampfreq = SliderView.new( w, Rect.newBy( 15, 338, 109, 15 ), "A7", 0, 0, 1, 0, 'linear').backColor_(rgb(189,181,197)); StringView.new( w, Rect.newBy( 15, 94, 100, 15 ), "Frequency") .labelColor_(rgb(239,31,29)); StringView.new( w, Rect.newBy( 15, 134, 117, 13 ), "Freq. Modulator 1") .labelColor_(rgb(239,31,29)); StringView.new( w, Rect.newBy( 15, 169, 117, 15 ), "Phase of Freq. Mod.") .labelColor_(rgb(239,31,29)); StringView.new( w, Rect.newBy( 15, 205, 117, 14 ), "Amp. of Freq. Mod.") .labelColor_(rgb(239,31,29)); StringView.new( w, Rect.newBy( 15, 244, 128, 13 ), "Offset of Freq. Mod.") .labelColor_(rgb(239,31,29)); StringView.new( w, Rect.newBy( 15, 316, 104, 18 ), "Amplitude") .labelColor_(rgb(239,31,29)); StringView.new( w, Rect.newBy( 15, 357, 113, 14 ), "Freq. of Amp. Mod.") .labelColor_(rgb(239,31,29)); sinfreqmain.action = {sinnumfreq.value = sinfreqmain.value}; sinnumfreq.action = {sinfreqmain.value = sinnumfreq.value}; sinampmain.action = {sinnumamp.value = sinampmain.value}; sinnumamp.action = {sinampmain.value = sinnumamp.value}; // Saw Wave // sawnumfreq = NumericalView.new( w, Rect.newBy( 154, 49, 64, 20 ), "NumericalView", 100, 0, 300, 1, 'linear'); sawfreqmain = SliderView.new( w, Rect.newBy( 154, 75, 109, 14 ), "b1", 100, 0, 300, 1, 'linear').backColor_(rgb(189,181,197)); sawmodfreqfreq = SliderView.new( w, Rect.newBy( 154, 185, 109, 15 ), "b2", 0, 0, 10, 0.1, 'linear').backColor_(rgb(189,181,197)); sawmodfreqphase = SliderView.new( w, Rect.newBy( 154, 148, 109, 15 ), "b3", 0, 0, 1, 0, 'linear').backColor_(rgb(189,181,197)); sawmodfreqamp = SliderView.new( w, Rect.newBy( 154, 112, 109, 15 ), "b4", 0, 0, 200, 1, 'linear').backColor_(rgb(189,181,197)); sawmodfreqadd = SliderView.new( w, Rect.newBy( 154, 221, 109, 15 ), "b5", 1, 1, 50, 1, 'linear').backColor_(rgb(189,181,197)); StringView.new( w, Rect.newBy( 154, 316, 117, 18 ), "Amplitude").labelColor_(rgb(239,31,29)); StringView.new( w, Rect.newBy( 154, 357, 117, 14 ), "Freq. of Amp. Mod.").labelColor_(rgb(239,31,29)); StringView.new( w, Rect.newBy( 154, 92, 117, 15 ), "Frequency").labelColor_(rgb(239,31,29)); StringView.new( w, Rect.newBy( 154, 132, 117, 13 ), "Freq. of Freq. Mod.").labelColor_(rgb(239,31,29)); StringView.new( w, Rect.newBy( 154, 167, 117, 15 ), "Phase of Freq. Mod.").labelColor_(rgb(239,31,29)); StringView.new( w, Rect.newBy( 154, 203, 117, 14 ), "Amp. of Freq. Mod.").labelColor_(rgb(239,31,29)); StringView.new( w, Rect.newBy( 154, 242, 128, 13 ), "Offset of Freq. Mod.").labelColor_(rgb(239,31,29)); sawnumamp = NumericalView.new( w, Rect.newBy( 154, 264, 64, 20 ), "NumericalView", 0.3, 0, 0.6, 0.01, 'linear'); sawampmain = SliderView.new( w, Rect.newBy( 154, 296, 109, 15 ), "b6", 0.3, 0.01, 1, 0.01, 'linear').backColor_(rgb(189,181,197)); sawmodampfreq = SliderView.new( w, Rect.newBy( 154, 338, 109, 15 ), "b7", 0, 0, 50, 1, 'linear').backColor_(rgb(189,181,197)); sawfreqmain.action = {sawnumfreq.value = sawfreqmain.value}; sawnumfreq.action = {sawfreqmain.value = sawnumfreq.value}; sawampmain.action = {sawnumamp.value = sawampmain.value}; sawnumamp.action = {sawampmain.value = sawnumamp.value}; // Pulse Wave // pulsenumfreq = NumericalView.new( w, Rect.newBy( 297, 50, 64, 20 ), "NumericalView", 200, 0, 800, 1, 'linear'); pulsefreqmain = SliderView.new( w, Rect.newBy( 297, 76, 110, 14 ), "c1", 200, 0, 800, 1, 'linear').backColor_(rgb(189,181,197)); pulsemodfreqfreq = SliderView.new( w, Rect.newBy( 297, 186, 109, 15 ), "c2", 0, 0, 50, 1, 'linear').backColor_(rgb(189,181,197)); pulsemodfreqphase = SliderView.new( w, Rect.newBy( 297, 149, 109, 15 ), "c3", 0, 0, 1, 0.01, 'linear').backColor_(rgb(189,181,197)); pulsemodfreqamp = SliderView.new( w, Rect.newBy( 297, 113, 109, 15 ), "c4", 0, 0, 100, 1, 'linear').backColor_(rgb(189,181,197)); pulsemodfreqadd = SliderView.new( w, Rect.newBy( 297, 222, 109, 15 ), "c5", 0, 0, 10, 0.1, 'linear').backColor_(rgb(189,181,197)); StringView.new( w, Rect.newBy( 297, 93, 117, 15 ), "Frequency").labelColor_(rgb(239,31,29)); StringView.new( w, Rect.newBy( 297, 133, 117, 13 ), "Freq. of Freq. Mod.").labelColor_(rgb(239,31,29)); StringView.new( w, Rect.newBy( 297, 168, 117, 15 ), "Phase of Freq. Mod.").labelColor_(rgb(239,31,29)); StringView.new( w, Rect.newBy( 297, 204, 117, 14 ), "Amp. of Freq. Mod.").labelColor_(rgb(239,31,29)); StringView.new( w, Rect.newBy( 297, 243, 128, 13 ), "Offset of Freq. Mod.").labelColor_(rgb(239,31,29)); pulsenumamp = NumericalView.new( w, Rect.newBy( 297, 265, 64, 20 ), "NumericalView", 0.3, 0, 0.6, 0.01, 'linear'); pulseampmain = SliderView.new( w, Rect.newBy( 297, 297, 109, 13 ), "c6", 0.3, 0.01, 1, 0.01, 'linear').backColor_(rgb(189,181,197)); pulsemodampfreq = SliderView.new( w, Rect.newBy( 297, 339, 109, 15 ), "c7", 0, 0, 30, 0, 'linear').backColor_(rgb(189,181,197)); StringView.new( w, Rect.newBy( 297, 317, 117, 18 ), "Amplitude").labelColor_(rgb(239,31,29)); StringView.new( w, Rect.newBy( 297, 358, 117, 14 ), "Freq. of Amp. Mod.").labelColor_(rgb(239,31,29)); pulsefreqmain.action = {pulsenumfreq.value = pulsefreqmain.value}; pulsenumfreq.action = {pulsefreqmain.value = pulsenumfreq.value}; pulseampmain.action = {pulsenumamp.value = pulseampmain.value}; pulsenumamp.action = {pulseampmain.value = pulsenumamp.value}; //Formant// formantnumfreq = NumericalView.new( w, Rect.newBy( 442, 50, 64, 20 ), "NumericalView", 400, 0, 13000, 1, 'linear'); formantfreqmain = SliderView.new( w, Rect.newBy( 442, 74, 109, 15 ), "d1", 400, 0, 13000, 1, 'linear').backColor_(rgb(189,181,197)); formantmodfreqfreq = SliderView.new( w, Rect.newBy( 442, 113, 109, 15 ), "d2", 0, 0, 13000, 1, 'linear').backColor_(rgb(189,181,197)); formantmodfreqphase = SliderView.new( w, Rect.newBy( 442, 149, 109, 15 ), "d3", 0, 0, 13000, 1, 'linear').backColor_(rgb(189,181,197)); formantmodfreqamp = SliderView.new( w, Rect.newBy( 442, 187, 109, 15 ), "d4", 0, 0, 13000, 1, 'linear').backColor_(rgb(189,181,197)); formantmodfreqadd = SliderView.new( w, Rect.newBy( 442, 224, 109, 15 ), "d5", 0, 0, 13000, 1, 'linear').backColor_(rgb(189,181,197)); StringView.new( w, Rect.newBy( 443, 91, 128, 20 ), "Frequency").labelColor_(rgb(239,31,29)); StringView.new( w, Rect.newBy( 443, 130, 128, 20 ), "Freq. of Freq. Mod.").labelColor_(rgb(239,31,29)); StringView.new( w, Rect.newBy( 444, 167, 128, 20 ), "Phase of Freq. Mod.").labelColor_(rgb(239,31,29)); StringView.new( w, Rect.newBy( 443, 204, 128, 20 ), "Amp. of Freq. Mod.").labelColor_(rgb(239,31,29)); StringView.new( w, Rect.newBy( 443, 242, 128, 20 ), "Offset of Freq. Mod.").labelColor_(rgb(239,31,29)); formantnumamp = NumericalView.new( w, Rect.newBy( 440, 269, 64, 20 ), "NumericalView", 0.3, 0, 0.6, 0.01, 'linear'); formantampmain = SliderView.new( w, Rect.newBy( 441, 297, 109, 15 ), "SliderView", 0.3, 0, 0.6, 0.01, 'linear').backColor_(rgb(189,181,197)); formantmodampfreq = SliderView.new( w, Rect.newBy( 442, 340, 109, 15 ), "SliderView", 0, 0, 10, 0.01, 'linear').backColor_(rgb(189,181,197)); StringView.new( w, Rect.newBy( 444, 317, 128, 20 ), "Amplitude").labelColor_(rgb(239,31,29)); StringView.new( w, Rect.newBy( 443, 358, 128, 20 ), "Freq. of Amp. Mod.").labelColor_(rgb(239,31,29)); formantfreqmain.action = {formantnumfreq.value = formantfreqmain.value}; formantnumfreq.action = {formantfreqmain.value = formantnumfreq.value}; formantampmain.action = {formantnumamp.value = formantampmain.value}; formantnumamp.action = {formantampmain.value = pulsenumamp.value}; //Checkboxes // sincheck = CheckBoxView.new( w, Rect.newBy( 15, 13, 128, 20 ), "Sine Wave", 0, 0, 1, 0, 'linear').backColor_(rgb(189,181,197)); sawcheck = CheckBoxView.new( w, Rect.newBy( 154, 13, 128, 20 ), "Saw Wave", 0, 0, 1, 0, 'linear').backColor_(rgb(189,181,197)); pulsecheck = CheckBoxView.new( w, Rect.newBy( 297, 13, 128, 20 ), "Pulse Wave", 0, 0, 1, 0, 'linear').backColor_(rgb(189,181,197)); bellcheck = CheckBoxView.new( w, Rect.newBy( 225, 382, 116, 20 ), "Bell on/off", 0, 0, 1, 0, 'linear').backColor_(rgb(189,181,197)); formantcheck = CheckBoxView.new( w, Rect.newBy( 438, 13, 128, 20 ), "Formant Wave", 0, 0, 1, 0, 'linear').backColor_(rgb(189,181,197)); { sinfreq = ControlIn.kr (sinfreqmain) + (ControlIn.kr (sinfreqmain) * SinOsc.ar( ControlIn.kr(sinmodfreqfreq), ControlIn.kr(sinmodfreqphase), ControlIn.kr(sinmodfreqamp), ControlIn.kr(sinmodfreqadd))); sawfreq = ControlIn.kr (sawfreqmain) + (ControlIn.kr (sawfreqmain) * SinOsc.ar( ControlIn.kr(sawmodfreqfreq), ControlIn.kr(sawmodfreqphase), ControlIn.kr(sawmodfreqamp), ControlIn.kr(sawmodfreqadd))); pulsefreq = ControlIn.kr (pulsefreqmain) + (ControlIn.kr (pulsefreqmain) * SinOsc.ar( ControlIn.kr(pulsemodfreqfreq), ControlIn.kr(pulsemodfreqphase), ControlIn.kr(pulsemodfreqamp), ControlIn.kr(pulsemodfreqadd))); formantfundfreq = ControlIn.kr (formantfreqmain) + (ControlIn.kr (formantfreqmain) * SinOsc.ar( ControlIn.kr(formantmodfreqfreq), ControlIn.kr(formantmodfreqphase), ControlIn.kr(formantmodfreqamp), ControlIn.kr(formantmodfreqadd))); sinamp = ControlIn.kr (sinampmain) + (ControlIn.kr (sinampmain) * SinOsc.ar (ControlIn.kr(sinmodampfreq), 0, 1)); sawamp = ControlIn.kr (sawampmain) + (ControlIn.kr (sawampmain) * SinOsc.ar (ControlIn.kr(sawmodampfreq), 0, 1)); pulseamp = ControlIn.kr (pulseampmain) + (ControlIn.kr (pulseampmain) * SinOsc.ar (ControlIn.kr(pulsemodampfreq), 0, 1)); formantamp = ControlIn.kr (formantampmain) + (ControlIn.kr (formantampmain) * SinOsc.ar (ControlIn.kr(pulsemodampfreq), 0, 1)); sinphase = 1; pulsewidth = 0.5; formantformfreq = 20000; formantwidthfreq = 500; mainSin = SinOsc.ar(sinfreq, sinphase, sinamp * ControlIn.kr(sincheck)); mainSaw = Saw.ar (sawfreq, sawamp * ControlIn.kr(sawcheck)); mainPulse = Pulse.ar (pulsefreq, pulsewidth, pulseamp * ControlIn.kr(pulsecheck)); mainFormant = Formant.ar (formantfundfreq, formantformfreq, formantwidthfreq, formantamp * ControlIn.kr(formantcheck)); spawn = Spawn.ar( ({ SinOsc.ar( 600.rand + (200 * SinOsc.ar(480, 0, 2)), 0, Line.ar(0.4,0,2) * ControlIn.kr(bellcheck) ) }), 1, 1, nil); Mix.ar ([ spawn, mainSin, mainSaw, mainPulse, mainFormant]) }.play; w.close; )