/***************************************************************************************************** /* James E. McHugh and Allison M. LaFleur, Assignment 3 */ /**************************************************************************************************** /* Our patch is named "HeartBeat" and it allows the user to control the frequency, the pulse frequecy, the pulse width, and the pulse amplitude of a sine wave. Thus, the user of our program can control these aformentioned variables by moving the slider either left or right. If the slider is moved left, the intensity, speed, and amplitude of the sine wave decreases. If the slider is moved to the right, the intensity, speed, and amplitude of the sine wave increases. The variables here are self-explanatory; the variable declared has the same name as the variable defined. Our basic plan was to create a SuperCollider patch in which the amplitude of a sine wave could be modulated by a pulse in three ways: pulse frequency, pulse width, and pulse amplitude. */ /**************************************************************************************************** ( // First declare all variables and window. var window, freqSlider, pulseFreqSlider, pulseWidthSlider, pulseAmpSlider; window = GUIWindow.new("HeartBeat", Rect.newBy( 189, 87, 300, 200 )); // Slider Views: what the user can vary on the sine wave. freqSlider = SliderView.new( window, Rect.newBy( 23, 23, 128, 20 ), "SliderView", 200, 100, 500, 1, 'linear'); // The following three are variables which vary the speed, width, and amplitude of the PULSE, thus modulating // the amplitude of the sine wave. pulseFreqSlider = SliderView.new( window, Rect.newBy( 23, 47, 128, 20 ), "SliderView", 10, 1, 10, 0.5, 'linear'); pulseWidthSlider = SliderView.new( window, Rect.newBy( 23, 71, 128, 20 ), "SliderView", 0.7, 0.1, 0.7, 0.05, 'linear'); pulseAmpSlider = SliderView.new( window, Rect.newBy( 23, 95,128, 20 ), "SliderView", 0.07, 0, 1, 0.05, 'linear'); //Stringviews: naming the sliders. StringView.new( window, Rect.newBy( 170, 23, 128, 20 ), "Frequency"); StringView.new( window, Rect.newBy( 170, 47, 128, 20 ), "Pulse Frequency"); StringView.new( window, Rect.newBy( 170, 71, 128, 20 ), "Pulse Width"); StringView.new( window, Rect.newBy( 170, 95, 128, 20 ), "Pulse Amplitude"); // The Synth.scope is a container for one or more unit generators that execute as a group. Defined inside the Pan2 // is my input signal, pan position, and control rate level input. The input signal is the FSinOsc with its // arguments of freq, mul, and add. The values for freq, mul, and add of the FSinOsc are listed after the "SliderViews" // in lines 8-10. The pos, or pan position, for the Panner is 1.0.rand2. And the control rate level input was kept at default, or 1. // The LFPulse is defined by freq(pulseFreqSlider.kr), width (pulseWidthSlider.kr), mul (pulseAmpSlider.kr), // and add, the dc offset, was not used. Synth.scope({ Pan2.ar( FSinOsc.ar(freqSlider.kr, LFPulse.kr(pulseFreqSlider.kr, pulseWidthSlider.kr, pulseAmpSlider.kr)), 1.0.rand2)}); window.close; )