/**************************************************************** * Ocean Patch * * by Kurt Peters * ****************************************************************/ /* Last Updated 5-3-00 The three essential sounds of the ocean -- waves, wind, and gulls. Each sound has one controllable filter hooked up to a slider: you can change the cutoff frequency of the lowpass filter on the waves, which is sort of like listening in a shell; the resonant frequency of the wind, which makes it sound faster; and the number of gulls, which can be anywhere from very few birds to a huge mass of them. */ ( //Declare variables var w, waves, waveEnvelope, waveCutOff, wind, windSpeed, gulls, gullFreq; //Construct GUI w = GUIWindow.new("panel", Rect.newBy(196, 75, 252, 124)); w.backColor = Color.new(0, 100, 200); StringView.new( w, Rect.newBy(23, 16, 93, 24), "Waves"); StringView.new( w, Rect.newBy(23, 44, 93, 24), "Gulls"); StringView.new( w, Rect.newBy(23, 72, 93, 24), "Wind"); waveCutOff = SliderView.new( w, Rect.newBy(120, 18, 94, 22), "SliderWaves", 500, 100, 800, 50, 'linear'); gullFreq = SliderView.new( w, Rect.newBy(120, 44, 94, 22), "SliderGulls", 0.20, 0.01, 0.50, 0.05, 'linear'); windSpeed = SliderView.new( w, Rect.newBy(120, 70, 94, 22), "SliderWind", 1500, 1000, 3000, 10, 'linear'); //Synth ocean { //setup envelope for waves -- attack, sustain, release, level waveEnvelope = Env.linen(0.005, 2, 3, 1); //waves are lowpassed, slightly overlapped and enveloped pink noise //modulate cutoff frequency of RLPF waves = RLPF.ar( OverlapTexture.ar({ PinkNoise.ar(EnvGen.kr(waveEnvelope, 1, 0, 0.8)) }, 5, 3, 2, 1), Plug.kr(waveCutOff), 0.5); //wind is white noise with resonant and lowpass filters //modulate frequency of resonance wind = LPF.ar(Resonz.ar( WhiteNoise.ar(0.75), Plug.kr(windSpeed) + SinOsc.ar(3, 0, 150), //add SinOsc to freq to make wind whip a little 0.08), 800); //gulls are sine bits generated very rapidly //modulate delay between spawns -- watch the number of UGens... gulls = Spawn.ar({ PSinGrain.ar( 1000.0 + 1000.0.rand, Plug.kr(gullFreq), 0.015 )}, 1, 0.008); (waves + wind + gulls) }.play )