//Explore the effect of ading various kinds of noise (White, Brown, and Pink) in modifying //an existing sound wave //Create variables for the GUI window, and Sliders var w, s1, s2, s3, s4, s5, n1, n2, n3, n4, n5; w = GUIWindow.new("Control Window", Rect.newBy(156, 428, 432, 215)) .backColor_(rgb(145,174,186)); s1 = SliderView.new( w, Rect.newBy(149, 12, 195, 22), "SliderView", 220, 0, 440, 20, 'linear') .backColor_(rgb(103,142,148)).labelColor_(rgb(47,176,82)).knobColor_(rgb(176,176,176)); s2 = SliderView.new( w, Rect.newBy(149, 111, 195, 22), "SliderView", 0, 0, 1, 0.1, 'linear') .backColor_(rgb(103,142,148)).labelColor_(rgb(47,176,82)).knobColor_(rgb(89,18,34)); s3 = SliderView.new( w, Rect.newBy(149, 136, 195, 22), "SliderView", 0, 0, 1, 0.1, 'linear') .backColor_(rgb(103,142,148)).labelColor_(rgb(49,68,176)).knobColor_(rgb(252,248,255)); s4 = SliderView.new( w, Rect.newBy(149, 161, 195, 22), "SliderView", 0, 0, 1, 0.1, 'linear') .backColor_(rgb(103,142,148)).labelColor_(rgb(47,176,82)).knobColor_(rgb(227,161,220)); s5 = SliderView.new( w, Rect.newBy(149, 58, 195, 22), "SliderView", 0, -1, 1, 0.1, 'linear') .backColor_(rgb(103,142,148)).labelColor_(rgb(103,142,148)).knobColor_(rgb(176,176,176)); //Create all the necessary text for the GUI StringView.new( w, Rect.newBy(9, 11, 95, 18), "Wave Frequency"); StringView.new( w, Rect.newBy(10, 111, 76, 18), "Brown Noise"); StringView.new( w, Rect.newBy(10, 138, 76, 18), "White Noise"); StringView.new( w, Rect.newBy(10, 162, 76, 18), "Pink Noise"); StringView.new( w, Rect.newBy(147, 186, 17, 18), "0"); StringView.new( w, Rect.newBy(332, 186, 17, 18), "1"); StringView.new( w, Rect.newBy(145, 37, 42, 14), "0 Hz"); StringView.new( w, Rect.newBy(299, 37, 42, 14), "440 Hz"); StringView.new( w, Rect.newBy(8, 58, 128, 20), "Wave Amplitude"); StringView.new( w, Rect.newBy(144, 84, 23, 21), "-1"); StringView.new( w, Rect.newBy(331, 84, 16, 20), "1"); StringView.new( w, Rect.newBy(239, 85, 16, 18), "0"); //Create numerical views n1 = NumericalView.new( w, Rect.newBy(348, 11, 64, 20), "Wave Frequency", 220, -1e+10, 1e+10, 0, 'linear'); n2 = NumericalView.new( w, Rect.newBy(348, 111, 64, 20), "Brown Noise", 0, -1e+10, 1e+10, 0, 'linear'); n3 = NumericalView.new( w, Rect.newBy(348, 136, 64, 20), "White Noise", 0, -1e+10, 1e+10, 0, 'linear'); n4 = NumericalView.new( w, Rect.newBy(348, 162, 64, 20), "Pink Noise", 0, -1e+10, 1e+10, 0, 'linear'); n5 = NumericalView.new( w, Rect.newBy(348, 59, 64, 20), "Wave Amplitude", 0, -1e+10, 1e+10, 0, 'linear'); //Link numerical views to sliders n1.action = { s1.value = n1.value}; s1.action = { n1.value = s1.value}; n2.action = { s2.value = n2.value}; s2.action = { n2.value = s2.value}; n3.action = { s3.value = n3.value}; s3.action = { n3.value = s3.value}; n4.action = { s4.value = n4.value}; s4.action = { n4.value = s4.value}; n5.action = { s5.value = n5.value}; s5.action = { n5.value = s5.value}; //Create a synth scope that is a conjunction of the equations //for a sin wave, Brown, White, and Pink Noise. //With these sliders we can alter the frequency and amplitude of the sine wave {SinOsc.ar(ControlIn.kr(s1), 0, ControlIn.kr(s5)) + BrownNoise.ar(ControlIn.kr(s2)) + WhiteNoise.ar(ControlIn.kr(s3)) + PinkNoise.ar(ControlIn.kr(s4))}.scope; //Close the control window when the sound is stopped w.close;