**************************************************************** James Hanna, Assignment 3 **************************************************************** Back in the day, I used to make noise using graphing calculators to interfere with AM radio waves. This patch is an attempt to duplicate such sounds on the computer, without having to amplify them by successive rerecordings (which is what I had to do when I was using tapes). The patch is simple, and allows the user to create a wide range of sounds in the mid-to-high frequency range. Nearly all of these sounds are very similar to what I used to make with calculators-- beats, hisses, and squeals, with an omnipresent underlay of static. Two frequencies are combined, each modulated by two different sliders which control frequency and amplitude, respectively, of the modulating sounds. The first frequency (s) is a simple sine wave to which saw-wave and pink noise components can be added. The second (q) is a triangular wave to which the user can add sine and brown noise components. The mixture of sharp and smooth waveforms is imitative of the different tones that may emanate from a crappy hand-held radio and graphing calculator. The added noise is kept at a much lower amplitude than the added waves so that these tones can be heard. The two double-spawned events of the sine wave sound like the noise made when a calculator is turned on in the presence of a radio. They signal the beginning of whatever sounds are to follow, and do not reappear anytime later. The user is encouraged to keep at least one of the sliders in a dynamic state, to simulate running the dial on an analog radio. w is the main GUI window. s1 (frequency) and s2 (amplitude) modulate the (spawned) sine wave (s, first frequency 230 Hz) with l (pink noise) and n (saw wave). q1 (frequency) and q2 (amplitude) modulate the triangular wave (q, 6000 Hz) with r (sine wave) and t (brown noise). The sine waves of s are spawned at slightly different times. The coefficients on l and n in s and on r and t in q keep the waves at a much higher amplitude than the noise. l and n cannot be regulated separately, nor can r and t. This keeps things realistic; no sounds can be made that don't sound like radio interference. ***************************************************************** ( var w, s1, s2, q1, q2; w = GUIWindow.new("i can't program worth a damn", Rect.newBy( 100, 70, 600, 400 )); s1 = SliderView.new( w, Rect.newBy( 20, 30, 250, 99), "SliderView", 0, 0, 2300, 0, 'linear'); s2 = SliderView.new( w, Rect.newBy( 300, 30, 250, 99), "SliderView", 0, 0, 100, 0, 'linear'); q1 = SliderView.new( w, Rect.newBy( 20, 160, 250, 99), "SliderView", 0, 0, 2300, 0, 'linear'); q2 = SliderView.new( w, Rect.newBy( 300, 160, 250, 99), "SliderView", 0, 0, 100, 0, 'linear'); StringView.new( w, Rect.newBy( 20, 135, 250, 20 ), "(freqpinknoisaw) i better get a"); StringView.new( w, Rect.newBy( 300, 135, 250, 20 ), "good grade on this (ampinknoisaw)"); StringView.new( w, Rect.newBy( 20, 265, 250, 20), "(freqbrownoisin) believe me it took"); StringView.new( w, Rect.newBy(300, 265, 250, 20), "a long time to do (ampbrownoisin)"); { l = PinkNoise.ar( ControlIn.kr(s1), ControlIn.kr(s2) ); n = LFSaw.ar( ControlIn.kr(s1), ControlIn.kr(s2) ); s = Spawn.ar({Spawn.ar({SinOsc.ar( 230, 0, 0.03 * l + 2 * n + 0.5 )}, 1, 2, 2)}, 1, 2.1, 2); r = SinOsc.ar( ControlIn.kr(q1), 0, ControlIn.kr(q2) ); t = BrownNoise.ar( ControlIn.kr(q1), ControlIn.kr(q2) ); // I changed the following line of code, LP q = LFSaw.ar(6000, 0.03 * t + 2 * r + 0.5); s + q }.scope; w.close; )