// Assigning the two Oscillators PulseOsc p => dac.left; PulseOsc g => dac.right; // int for 'while' loop 0 => int z; // On and Off gain floats 0.7 => float onGain; 0.0 => float offGain; // Root notes on the melody [59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59] @=> int Root[]; // Root notes for the last part of the melody [59, 59, 59, 59, 59, 59, 59, 57, 57, 57, 57, 57, 57, 57, 57] @=> int altRoot[]; // Melody notes [64, 64, 64, 62, 62, 62, 62, 61, 61, 61, 61, 62, 62, 61, 62] @=> int Notes[]; // Alternate melody notes [64, 64, 64, 66, 66, 66, 66, 61, 61, 61, 61, 62, 62, 61, 62] @=> int altNotes[]; // Float array for the gain of the melody [0.7, 0.7, 0.3, 0.7, 0.7, 0.7, 0.3, 0.7, 0.7, 0.7, 0.3, 0.7, 0.7, 0.7, 0.7] @=> float aGain[]; // Variable for the duration (q = quarter, h = half, e = eighth) 0.15::second => dur q; 0.3::second => dur h; 0.05::second => dur e; // Array for the duration of the notes [q, q, e, h, q, q, e, h, q, q, e, h, q, q, q] @=> dur myDurs[]; // 'While' loop to make the first 4 bars while (z < 2) { // 'For' loop to make the melody notes play for (0 => int i; i < Root.cap(); i++) { // Converting the notes of the 'Root' array from MIDI to Frequency and assigning it to the frequency of the first oscillator Std.mtof(Root[i]) => p.freq; // Converting the notes of the 'Notes' array (melody) from MIDI to Frequency and assigning it to the frequency of the second oscillator Std.mtof(Notes[i]) => g.freq; // Assigning the 'aGain' array to the gain of both oscillators aGain[i] => p.gain; aGain[i] => g.gain; // Assigning the 'myDurs' araay to the duration of both oscillators myDurs[i] => now; // Turning both oscillators off so I can create a pause between the notes offGain => p.gain; offGain => g.gain; // Duration of pause 0.075::second => now; } // Pause inbetween each phrase offGain => p.gain; offGain => g.gain; 0.22 ::second => now; // Getting the loop to repeat itself z++;} // Repeating the process but for the last 2 phrases which have different melodies/root notes for (0 => int q; q < Root.cap(); q++) { Std.mtof(Root[q]) => p.freq; Std.mtof(altNotes[q]) => g.freq; aGain[q] => p.gain; aGain[q] => g.gain; myDurs[q] => now; offGain => p.gain; offGain => g.gain; 0.075::second => now; } offGain => p.gain; offGain => g.gain; 0.22 ::second => now; for (0 => int w; w < Root.cap(); w++) { Std.mtof(altRoot[w]) => p.freq; Std.mtof(altNotes[w]) => g.freq; aGain[w] => p.gain; aGain[w] => g.gain; myDurs[w] => now; offGain => p.gain; offGain => g.gain; 0.075::second => now; }