~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ **************************** Create Your Own Song ************************************************** Schuyler Minert and Katie Heist ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Our program allows the player to create his or her own song by modifying each of four different phrases of our repeating basic song function in the differents way. The player can change the song by changing the pitch of the melody or by changing the time interval of the beat. Our GUI Interface has 8 different control panels to change each of these parameters. The basic structure of our song is four phrases, each with a melody and a beat, which occur either simultaneously or are in sequence with one another. The whole cycle repeats itself indefinitely. Our program demonstrates the ease with which a simply song can be created and provides an excellent example of the capabilities of the cycle and spawn functions. *The general structure for our time piece was taken from the Time Structures sections of the Examples Folder in the SuperCollider Folder* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ( //Defining our Variables // Variable for the whole GUI window var w, // Variables that modify pitch of melodies v_mult1, v_mult2, v_mult3, v_mult4, // Variables that modify beat frequency, or time in between beats t_bt_beat1, t_bt_beat2, t_bt_beat3, t_bt_beat4; //GUI Window Parameters w = GUIWindow.new("Create Your Own Song", Rect.newBy(79, 96, 447, 341)).backColor_(rgb(15, 193, 113)); // Parameters for writing words in GUI window StringView.new( w, Rect.newBy(8, 86, 128, 20), "Phrase 1"); StringView.new( w, Rect.newBy(6, 121, 128, 20), "Phrase 2"); StringView.new( w, Rect.newBy(9, 159, 128, 20), "Phrase 3"); StringView.new( w, Rect.newBy(6, 195, 128, 20), "Phrase 4"); // More Parameters for writing words in GUI window StringView.new( w, Rect.newBy(112, 59, 128, 20), "Change Pitch"); StringView.new( w, Rect.newBy(275, 57, 140, 20), "Change Beat Frequency"); // The following sets the parameters of the envelope of the basic time structure that we took from the // Supercollider Examples Folder e = Env.new([0,1,0.2,0],[0.004, 0.2, 0.8], -2); // Defining a constant, e stands for envelope // The first set of values in the bracket describes the levels of the envelope // The second set of values in the bracket define attack, sustain, and decay times // The -2 descirbes the shape of the decay curve as decreasing // Defining the variable to change the pitch of melody in phrase 1 // creates the panel to control the pitch change v_mult1 = SliderView.new( w, Rect.newBy(104, 80, 137, 33), "SliderView", 100, 100, 300, 0, 'linear') .backColor_(rgb(50,250,30)).knobColor_(rgb(50,50,250)); // Defining the variable to change the pitch of melody in phrase 2 // creates the panel to control the pitch change v_mult2 = SliderView.new( w, Rect.newBy(104, 122, 137, 32), "SliderView", 50, 50, 100, 0, 'linear') .backColor_(rgb(50,250,70)).knobColor_(rgb(50,50,250)); // Defining the variable to change the pitch of melody in phrase 3 // creates the panel to control the pitch change v_mult3 = SliderView.new( w, Rect.newBy(104, 164, 137, 32), "SliderView", 100, 100, 300, 0, 'linear') .backColor_(rgb(50,250,110)).knobColor_(rgb(50,50,250)); // Defining the variable to change the pitch of melody in phrase 4 // creates the panel to control the pitch change v_mult4 = SliderView.new( w, Rect.newBy(104, 208, 137, 32), "SliderView", 100, 100, 300, 0, 'linear') .backColor_(rgb(50,250,150)).knobColor_(rgb(50,50,250)); // Defining the variable to change the beat frequency of phrase 1 (time in between beats) // creates the control panel to change beat frequency t_bt_beat1 = SliderView.new( w, Rect.newBy(274, 80, 137, 32), "SliderView", 0.05, 0.05, 0.2, 0, 'linear') .backColor_(rgb(250,50,30)).knobColor_(rgb(50,50,250)); // Defining the variable to change the beat frequency of phrase 2 (time in between beats) // creates the control panel to change beat frequency t_bt_beat2 = SliderView.new( w, Rect.newBy(274, 122, 137, 32), "SliderView", 0.05, 0.05, 0.5, 0, 'linear') .backColor_(rgb(250,50,70)).knobColor_(rgb(50,50,250)); // Defining the variable to change the beat frequency of phrase 3 (time in between beats) // creates the control panel to change beat frequency t_bt_beat3 = SliderView.new( w, Rect.newBy(274, 164, 137, 32), "SliderView", 0.05, 0.05, 0.5, 0, 'linear') .backColor_(rgb(250,50,110)).knobColor_(rgb(50,50,250)); // Defining the variable to change the beat frequency of phrase 4 (time in between beats) // creates the control panel to change beat frequency t_bt_beat4 = SliderView.new( w, Rect.newBy(274, 208, 137, 32), "SliderView", 0.05, 0.05, 0.5, 0, 'linear') .backColor_(rgb(250,50,150)).knobColor_(rgb(50,50,250)); // General Notes for Our Program // All variables are in green //Cycle is a command that cycles through whatever sequence of functions is inside its brackets with // a set time in between cycles and at a set number of repeats //Spawn is a command to repeat whatever funtion is inside its brackets with a set time // in between repeats and at a set number of repeats //EnvGen creates an envelope (the general shape) of the sound function which is played // Our envelope is defined above which is the first parameter // The second parameter is a value by which the envelope is multiplied // The third parameter is a value to which the envelope is added // The fourth parameter is the number of notes in our melody // or the number of levels in the envelope //FSinOsc is a command that creates a sound (the notes of our melody) with the frequency // generated from very quick oscillations of a sin wave // Our frequency changes by use of a function which adds a frequency to // the set frequency according to placement of a slider // The next parameter is the value by which our funtion is multiplied //LFPulse generates an oscillation that is not limited to a certain band frequency // The first parameter is the frequency which changes by use of a function which // subtracts a frequency (determined by slider position) from a set frequency // The next parameter is the length of the oscillation // the next parameter is the value by which the oscillation is multiplied //WhiteNoise - creates a noise with all frequencies present //PinkNoise - creates a noise whose power falls quickly over time //BrownNoise - creates a noise whose spectrum falls quickly over time // We automatically set each phrase starting pitch to some value. The pitch then increases //or decreases linearly according to which beat in sequence is being played, and the //placement of the knob on the control panel // We automatically set the beat frequency in the time in between repeats function // of the spawn, it changes according to placement of the knob on the control panel // the + allows us to play the melody at the same time as the beats // the , allows us to play the melody and beat in sequence //command to play our song play({ Cycle.ar([{ Spawn.ar({ Spawn.ar({ arg spawn, i, synth; EnvGen.ar(e, FSinOsc.ar((i * ControlIn.kr(v_mult1)) + 600, 0.1)); }, 1, 0.05, 8) + Spawn.ar({ arg spawn, i, synth; EnvGen.ar(e, WhiteNoise.ar(0.2)); }, 1, t_bt_beat1, 8) }, 1, nil, 2) },{ Cycle.ar([{ Spawn.ar({ arg spawn, i, synth; EnvGen.ar(e, LFPulse.ar(600 - (i * (ControlIn.kr(v_mult2))), 0.1, 0.1)); }, 1, 0.1, 12); },{ Spawn.ar({ arg spawn, i, synth; EnvGen.ar(e, PinkNoise.ar(0.2)); }, 1, t_bt_beat2, 8); }], 1, nil, 2) },{ Spawn.ar([{ Spawn.ar({ arg spawn, i, synth; EnvGen.ar(e, FSinOsc.ar((i * ControlIn.kr(v_mult3)) + 200, 0.1)); }, 1, 0.1, 10) + Spawn.ar({ arg spawn, i, synth; EnvGen.ar(e, WhiteNoise.ar(0.2)); }, 1, t_bt_beat3, 6); }], 1, nil, 2) },{ Cycle.ar([{ Spawn.ar({ arg spawn, i, synth; EnvGen.ar(e, LFPulse.ar(1000 - (i * (ControlIn.kr(v_mult4))), 0.1, 0.1)); }, 1, 0.1, 12); },{ Spawn.ar({ arg spawn, i, synth; EnvGen.ar(e, BrownNoise.ar(0.2)); }, 1, t_bt_beat4, 8); }], 1, nil, 2) }], 1, nil, nil) }); w.close; )