( // ZEN MEDITATION GENERATOR // Welcome to Barabara and Kim's Zen Meditation World. You are about to embark on a journey into the // sensory realm of meditation. The diversity of the sounds we have generated are meant to create a // harmonic world that can be manipulated to the user's own aesthetic tastes. // This code generates a GUI that creates and controls Zen sounds, specifically a wave, hum, //bells and chime sounds. Different aspects of each sound can be controlled as labelled on // the GUI window. We tried to pick "descriptive" titles for these controls on our GUI window //to reflect the meditative mood of Zen sounds. For the more //technical definition of our controls see plugin names in the code. // Define GUIWindow variable var w, //define global volume variable global_volume, //define wave sound variables vol_wave, wavelength, wave_freq, //define hum sound variables vol_hum, freq_hum, beats_hum, // define bells variables vol_bells, delay_bells, freq_bells, //define chime variable vol_chimes; //GUI Window parameters and color w = GUIWindow.new("panel", Rect.newBy(165, 110, 725, 445)) .backColor_(rgb(29,58,135)); //StringViews for all labels. StringView.new( w, Rect.newBy(250, 34, 162, 17), "ZEN MEDITATION GENERATOR") .backColor_(rgb(28,57,135)).labelColor_(rgb(225,228,255)); StringView.new( w, Rect.newBy(280, 77, 128, 20), "Global Volume") .backColor_(rgb(28,57,135)).labelColor_(rgb(225,228,255)); StringView.new( w, Rect.newBy(50, 170, 128, 20), "Wave") .backColor_(rgb(28,57,135)).labelColor_(rgb(225,228,255)); StringView.new( w, Rect.newBy(140, 210, 128, 20), "Volume") .backColor_(rgb(28,57,135)).labelColor_(rgb(225,228,255)); StringView.new( w, Rect.newBy(140, 250, 128, 20), "Intensity") .backColor_(rgb(28,57,135)).labelColor_(rgb(225,228,255)); StringView.new( w, Rect.newBy(140, 290, 128, 20), "Storm") .backColor_(rgb(28,57,135)).labelColor_(rgb(225,228,255)); StringView.new( w, Rect.newBy(310, 170, 128, 20), "Hum") .backColor_(rgb(28,57,135)).labelColor_(rgb(225,228,255)); StringView.new( w, Rect.newBy(400, 210, 128, 20), "Volume") .backColor_(rgb(28,57,135)).labelColor_(rgb(225,228,255)); StringView.new( w, Rect.newBy(400, 250, 128, 20), "Tone") .backColor_(rgb(28,57,135)).labelColor_(rgb(225,228,255)); StringView.new( w, Rect.newBy(400, 290, 128, 20), "Oscillation") .backColor_(rgb(28,57,135)).labelColor_(rgb(225,228,255)); StringView.new( w, Rect.newBy(575, 170, 128, 20), "Bells") .backColor_(rgb(28,57,135)).labelColor_(rgb(225,228,255)); StringView.new( w, Rect.newBy(665, 210, 128, 20), "Volume") .backColor_(rgb(28,57,135)).labelColor_(rgb(225,228,255)); StringView.new( w, Rect.newBy(665, 250, 128, 20), "Tone") .backColor_(rgb(28,57,135)).labelColor_(rgb(225,228,255)); StringView.new( w, Rect.newBy(665, 290, 128, 20), "Breeze") .backColor_(rgb(28,57,135)).labelColor_(rgb(225,228,255)); StringView.new( w, Rect.newBy(300, 345, 128, 20), "Chimes") .backColor_(rgb(28,57,135)).labelColor_(rgb(225,228,255)); StringView.new( w, Rect.newBy(400, 383, 128, 20), "Volume") .backColor_(rgb(28,57,135)).labelColor_(rgb(225,228,255)); //Global Volume Control Slider global_volume = SliderView.new( w, Rect.newBy(50, 109, 562, 26), "SliderView", 0.1, 0,0.71, 0.001, 'linear') .backColor_(rgb(123,93,135)).knobColor_(rgb(57,68,92)); //Wave Sound Control Sliders vol_wave = SliderView.new( w, Rect.newBy(5, 210, 128, 20), "SliderView", 0.1, 0, 1, 0.001, 'linear') .backColor_(rgb(87,133,174)).labelColor_(rgb(225,228,255)).knobColor_(rgb(123,93,135)); wave_freq = SliderView.new( w, Rect.newBy(5, 250, 128, 20), "SliderView", 400, 200, 3000, 1, 'linear') .backColor_(rgb(87,133,174)).labelColor_(rgb(225,228,255)).knobColor_(rgb(123,93,135)); wavelength = SliderView.new( w, Rect.newBy(5, 290, 128, 20), "SliderView", 0.1, 0.05, 0.3, 0.001, 'linear') .backColor_(rgb(87,133,174)).labelColor_(rgb(225,228,255)).knobColor_(rgb(123,93,135)); //Hum Sound Control Sliders vol_hum = SliderView.new( w, Rect.newBy(265, 210, 128, 20), "SliderView", 0.1, 0, 0.25, 0.01, 'linear') .backColor_(rgb(87,133,174)).labelColor_(rgb(225,228,255)).knobColor_(rgb(123,93,135)); freq_hum = SliderView.new( w, Rect.newBy(265, 250, 128, 20), "SliderView", 30, 0, 150, 1, 'linear') .backColor_(rgb(87,133,174)).labelColor_(rgb(225,228,255)).knobColor_(rgb(123,93,135)); beats_hum = SliderView.new( w, Rect.newBy(265, 290, 128, 20), "SliderView", 1, 0, 2.5, 0.1, 'linear') .backColor_(rgb(87,133,174)).labelColor_(rgb(225,228,255)).knobColor_(rgb(123,93,135)); //Bells Control Sliders vol_bells = SliderView.new( w, Rect.newBy(530, 210, 128, 20), "SliderView", 0.2, 0, 0.7, 0, 'linear') .backColor_(rgb(87,133,174)).labelColor_(rgb(225,228,255)).knobColor_(rgb(123,93,135)); freq_bells = SliderView.new( w, Rect.newBy(530, 250, 128, 20), "SliderView", 500, 500, 2000, 1, 'linear') .backColor_(rgb(87,133,174)).labelColor_(rgb(225,228,255)).knobColor_(rgb(123,93,135)); delay_bells = SliderView.new( w, Rect.newBy(530, 290, 128, 20), "SliderView", 0.05, 0.05, 1, 0.01, 'linear') .backColor_(rgb(87,133,174)).labelColor_(rgb(225,228,255)).knobColor_(rgb(123,93,135)); //Chimes Control Slider vol_chimes = SliderView.new( w, Rect.newBy(265, 378, 128, 20), "SliderView", 0.05, 0.01, 0.1, 0.01, 'linear') .backColor_(rgb(87,133,174)).labelColor_(rgb(225,228,255)).knobColor_(rgb(123,93,135)); { // Function for wave sound. // We first use the plug wave_freq to control the quadratic noise's (LFNoise2) approximate frequency on a slider. // We then multiply the function by a sine wave and use the plugin wavelength to control the frequency of // that sine wave. // We then multiply the entire argument by the plug vol_wave that controls the volume of the entire sound. // The result is an ocean wave sound in which we can control the pitch, periodic frequency and volume. p = (LFNoise2.ar(Plug.kr(wave_freq), SinOsc.kr(Plug.kr(wavelength)))) * Plug.kr(vol_wave); // Function for Hum sound. // We have a wavetable of 10 harmonics including the fundamental. // We use a chorusing wavetable oscillator to sum the harmonics which we are able modulate. // We then have the plug freq_hum to control the frequency of the harmonics as a whole and // the plug beats_hum to control the beats of the harmonics. // We then multiply by the plug vol_hum to control the volume of the entire oscillator. m = Wavetable.sineFill(512, 1.0/[1,2,3,4,5,6,7,8,9,10]); n = COsc.ar(m, Plug.kr(freq_hum), Plug.kr(beats_hum), Plug.kr(vol_hum)); // Function for Bells. // We first create a Decay sound with "Dust" noise multiplying the sound by a sine wave that's frequency is // controlled by the plug freq_bells. // We then use the decay sound as an input function in a delay generator. // We control the delay time with the plug delay_bells. // We then multiply the whole function by the plug vol_bells to control the volume of the sound. q = Decay.ar(Dust.ar(1,0.5), 0.3, SinOsc.ar(Plug.kr(freq_bells))); r = (DelayN.ar(q, 0.1, Plug.kr(delay_bells), 1, q)) * Plug.kr(vol_bells); // Function for Chimes. // We first set an 8 second trapezoid envelope specification that works within an envelope generator. // We use the Spawn UGen to create overlaying sounds created by a FSinOsc that is multiplied by our envelope. // We multiply the entire function by a the plug vol_chimes to control the overall volume of the chimes. s = Env.linen(2,4,2); o = Spawn.ar({ FSinOsc.ar(1000.0.rand, EnvGen.kr(s)) }, 2, 0.5, nil, Plug.kr(vol_chimes)); // We then add our four sounds together and multiply them all by the plug global_volume to control the // overall volume of the zen sounds. (p + n + o + r) * Plug.kr(global_volume) }.play; w.close; )