Hey all,
So for my midterm I decided to make a cover for one of my favorite songs, Pumped Up Kicks.
DRUM & BASS
First things first, I needed a drum or a bass sound that would imitate the original low pitch sounds of the song itself. What I built was a drum kit of three Servos, with different sizes of foam balls and spoon heads attached to each. In order to amplify the sound, I built structures around the tapping so that the sound waves would flow through one direction that was not blocked and the spoon heads also increased the noise of tapping as inside was hollow. Below is a picture of the drum kit. The one on the middle has the top opened because I constantly need to fix the Servo as it was harder to reach than other Servos and it had some initial malfunctions. Lastly, the Servos, or bass drums, were hitting through a function called Bass() which matched the actual beat of the song.
ACOUSTIC (VERSE & CHORUS)
For the sound inside, I used a Piezo Buzzer but mask-taped the buzzer so that I could amplify the sound. Most of my acoustic part was coded. Basically I had a BassHelper() function which would match with Bass() [Servo Drums] and also provide an intro to the Verse() function, which was the tone for the first verse. Then came the Chorus() function, and the song ended there. In order to run all of this together, I had to use millis() instead of delay as well as create the song from scratch by myself. Here is the whole code: It may be hard to read, but it is an easy concept: just using millis() to code every tone for each function.
#include <Servo.h> //#ifndef _Tone_h #define _Tone_h #include <stdint.h> /* || Public Constants */ #define NOTE_B0 31 #define NOTE_C1 33 #define NOTE_CS1 35 #define NOTE_D1 37 #define NOTE_DS1 39 #define NOTE_E1 41 #define NOTE_F1 44 #define NOTE_FS1 46 #define NOTE_G1 49 #define NOTE_GS1 52 #define NOTE_A1 55 #define NOTE_AS1 58 #define NOTE_B1 62 #define NOTE_C2 65 #define NOTE_CS2 69 #define NOTE_D2 73 #define NOTE_DS2 78 #define NOTE_E2 82 #define NOTE_F2 87 #define NOTE_FS2 93 #define NOTE_G2 98 #define NOTE_GS2 104 #define NOTE_A2 110 #define NOTE_AS2 117 #define NOTE_B2 123 #define NOTE_C3 131 #define NOTE_CS3 139 #define NOTE_D3 147 #define NOTE_DS3 156 #define NOTE_E3 165 #define NOTE_F3 175 #define NOTE_FS3 185 #define NOTE_G3 196 #define NOTE_GS3 208 #define NOTE_A3 220 #define NOTE_AS3 233 #define NOTE_B3 247 #define NOTE_C4 262 #define NOTE_CS4 277 #define NOTE_D4 294 #define NOTE_DS4 311 #define NOTE_E4 330 #define NOTE_F4 349 #define NOTE_FS4 370 #define NOTE_G4 392 #define NOTE_GS4 415 #define NOTE_A4 440 #define NOTE_AS4 466 #define NOTE_B4 494 #define NOTE_C5 523 #define NOTE_CS5 554 #define NOTE_D5 587 #define NOTE_DS5 622 #define NOTE_E5 659 #define NOTE_F5 698 #define NOTE_FS5 740 #define NOTE_G5 784 #define NOTE_GS5 831 #define NOTE_A5 880 #define NOTE_AS5 932 #define NOTE_B5 988 #define NOTE_C6 1047 #define NOTE_CS6 1109 #define NOTE_D6 1175 #define NOTE_DS6 1245 #define NOTE_E6 1319 #define NOTE_F6 1397 #define NOTE_FS6 1480 #define NOTE_G6 1568 #define NOTE_GS6 1661 #define NOTE_A6 1760 #define NOTE_AS6 1865 #define NOTE_B6 1976 #define NOTE_C7 2093 #define NOTE_CS7 2217 #define NOTE_D7 2349 #define NOTE_DS7 2489 #define NOTE_E7 2637 #define NOTE_F7 2794 #define NOTE_FS7 2960 #define NOTE_G7 3136 #define NOTE_GS7 3322 #define NOTE_A7 3520 #define NOTE_AS7 3729 #define NOTE_B7 3951 #define NOTE_C8 4186 #define NOTE_CS8 4435 #define NOTE_D8 4699 #define NOTE_DS8 4978 int button = 8; int PBuzz = 7; int PBuzz1 = 5; Servo hello; Servo hello1; Servo hello2; int angle = 0; //For Bass Support unsigned long previousMillis = 0; int intervala[] = {750,550,300}; int currentNote = 0; //For Chorus unsigned long previousMillis1 = 0; int intervalb[] = {250,300,400,500,600,450,350}; int currentNote1 = 0; //For Verse unsigned long previousMillis2 = 0; int intervalc[] = {250,500,700}; int currentNote2 = 0; //For Bass Servo unsigned long previousMillis3 = 0; int intervald[] = {50,250,300,450}; int currentState = 0; //For Main unsigned long previousMillis4 = 0; int counter = 0; const int ledPin = 4; void setup() { // put your setup code here, to run once: hello.attach(6); hello1.attach(9); hello2.attach(10); pinMode(PBuzz,OUTPUT); pinMode(PBuzz1,OUTPUT); pinMode(button,INPUT); pinMode(ledPin,OUTPUT); Serial.begin(9600); } void loop() { int knobValue = analogRead(A0); Serial.println(knobValue); if(knobValue >= 1000){ unsigned long currentMillis4 = millis(); digitalWrite(ledPin,HIGH); Bass(); if(currentMillis4 - previousMillis4 >= 10 && counter == 0){ previousMillis4 = currentMillis4; BassHelper(); } if (currentMillis4-previousMillis4 >= 95 && counter == 1){ previousMillis4 = currentMillis4; Verse(); } if(currentMillis4-previousMillis4 >= 20 && counter ==2){ previousMillis4 = currentMillis4; Chorus(); } } digitalWrite(ledPin,LOW); } void Bass(){ unsigned long currentMillis3 = millis(); //hello2 here if(currentMillis3 - previousMillis3 >= intervald[0] && currentState ==0){ previousMillis3 = currentMillis3; hello2.write(280); currentState += 1; } if(currentMillis3 - previousMillis3 >= intervald[2] && currentState ==1){ previousMillis3 = currentMillis3; hello2.write(90); currentState += 1; } if(currentMillis3 - previousMillis3 >= intervald[3] && currentState ==2){ previousMillis3 = currentMillis3; hello2.write(180); currentState += 1; } if(currentMillis3 - previousMillis3 >= intervald[2] && currentState ==3){ previousMillis3 = currentMillis3; hello2.write(90); currentState += 1; } if(currentMillis3 - previousMillis3 >= intervald[1] && currentState ==4){ previousMillis3 = currentMillis3; hello2.write(180); currentState += 1; } if(currentMillis3 - previousMillis3 >= intervald[2] && currentState ==5){ previousMillis3 = currentMillis3; hello2.write(90); currentState += 1; } if(currentMillis3 - previousMillis3 >= 100 && currentState ==6){ previousMillis3 = currentMillis3; hello2.write(180); currentState += 1; } if(currentMillis3 - previousMillis3 >= intervald[2] && currentState ==7){ previousMillis3 = currentMillis3; hello2.write(90); currentState += 1; } //hello1 here if(currentMillis3 - previousMillis3 >= intervald[0] && currentState ==8){ previousMillis3 = currentMillis3; hello1.write(180); currentState += 1; } if(currentMillis3 - previousMillis3 >= intervald[2] && currentState ==9){ previousMillis3 = currentMillis3; hello1.write(90); currentState += 1; } if(currentMillis3 - previousMillis3 >= intervald[3] && currentState ==10){ previousMillis3 = currentMillis3; hello1.write(180); currentState += 1; } if(currentMillis3 - previousMillis3 >= intervald[2] && currentState ==11){ previousMillis3 = currentMillis3; hello1.write(90); currentState += 1; } if(currentMillis3 - previousMillis3 >= intervald[1] && currentState ==12){ previousMillis3 = currentMillis3; hello1.write(180); currentState += 1; } if(currentMillis3 - previousMillis3 >= intervald[2] && currentState ==13){ previousMillis3 = currentMillis3; hello1.write(90); currentState += 1; } if(currentMillis3 - previousMillis3 >= 100 && currentState ==14){ previousMillis3 = currentMillis3; hello1.write(180); currentState += 1; } if(currentMillis3 - previousMillis3 >= intervald[2] && currentState ==15){ previousMillis3 = currentMillis3; hello1.write(90); currentState += 1; } //hello here if(currentMillis3 - previousMillis3 >= intervald[0] && currentState ==16){ previousMillis3 = currentMillis3; hello.write(180); currentState += 1; } if(currentMillis3 - previousMillis3 >= intervald[2] && currentState ==17){ previousMillis3 = currentMillis3; hello.write(90); currentState += 1; } if(currentMillis3 - previousMillis3 >= intervald[3] && currentState ==18){ previousMillis3 = currentMillis3; hello.write(180); currentState += 1; } if(currentMillis3 - previousMillis3 >= intervald[2] && currentState ==19){ previousMillis3 = currentMillis3; hello.write(90); currentState += 1; } if(currentMillis3 - previousMillis3 >= intervald[1] && currentState ==20){ previousMillis3 = currentMillis3; hello.write(180); currentState += 1; } if(currentMillis3 - previousMillis3 >= intervald[2] && currentState ==21){ previousMillis3 = currentMillis3; hello.write(90); currentState += 1; } if(currentMillis3 - previousMillis3 >= 100 && currentState ==22){ previousMillis3 = currentMillis3; hello.write(180); currentState += 1; } if(currentMillis3 - previousMillis3 >= intervald[2] && currentState ==23){ previousMillis3 = currentMillis3; hello.write(90); currentState += 1; } //hello1 here if(currentMillis3 - previousMillis3 >= intervald[0] && currentState ==24){ previousMillis3 = currentMillis3; hello1.write(180); currentState += 1; } if(currentMillis3 - previousMillis3 >= intervald[2] && currentState ==25){ previousMillis3 = currentMillis3; hello1.write(90); currentState += 1; } if(currentMillis3 - previousMillis3 >= intervald[3] && currentState ==26){ previousMillis3 = currentMillis3; hello1.write(180); currentState += 1; } if(currentMillis3 - previousMillis3 >= intervald[2] && currentState ==27){ previousMillis3 = currentMillis3; hello1.write(90); currentState += 1; } if(currentMillis3 - previousMillis3 >= intervald[1] && currentState ==28){ previousMillis3 = currentMillis3; hello1.write(180); currentState += 1; } if(currentMillis3 - previousMillis3 >= intervald[2] && currentState ==29){ previousMillis3 = currentMillis3; hello1.write(90); currentState += 1; } if(currentMillis3 - previousMillis3 >= 100 && currentState ==30){ previousMillis3 = currentMillis3; hello1.write(180); currentState += 1; } if(currentMillis3 - previousMillis3 >= intervald[2] && currentState ==31){ previousMillis3 = currentMillis3; hello1.write(90); currentState = 0; } // hello1.write(90); // delay(300); // hello.write(90); // delay(300); // hello2.write(90); // delay(300); } void Verse(){ unsigned long currentMillis2 = millis(); if(currentMillis2- previousMillis2 >= 700 && currentNote2 == 0){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_C4,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 1){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 2){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 3){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_GS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 4){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[1] && currentNote2 == 5){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_C4,600); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[1] && currentNote2 == 6){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_GS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= 250 && currentNote2 == 7){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_C4,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= 250 && currentNote2 == 8){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_DS4,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= 250 && currentNote2 == 9){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_C5,300); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[2] && currentNote2 == 10){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_C4,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 11){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2>= intervalc[0] && currentNote2 == 12){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_C4,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 13){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 14){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 15){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 16){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[1] && currentNote2 == 17){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 18){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_C4,400); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[1] && currentNote2 == 19){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 20){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[1] && currentNote2 == 21){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= 800 && currentNote2 == 22){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_C4,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 23){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 24){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 25){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_GS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 26){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 27){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_DS4,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 28){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_C4,600); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[1] && currentNote2 == 29){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_DS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 30){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_G3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 31){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 32){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_G4,300); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[2] && currentNote2 == 33){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 34){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 35){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 36){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 37){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,300); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= 450 && currentNote2 == 38){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_G3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 39){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 40){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_C4,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 41){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,300); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= 400 && currentNote2 == 42){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= 400 && currentNote2 == 43){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } //NEW LOOP! if(currentMillis2- previousMillis2 >= 700 && currentNote2 == 44){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_C4,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 45){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 46){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 47){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_GS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 48){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[1] && currentNote2 == 49){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_C4,600); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[1] && currentNote2 == 50){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_GS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= 250 && currentNote2 == 51){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_C4,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= 250 && currentNote2 == 52){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_DS4,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= 250 && currentNote2 == 53){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_C5,300); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[2] && currentNote2 == 54){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_C4,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 55){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2>= intervalc[0] && currentNote2 == 56){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_C4,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 57){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 58){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 59){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 60){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[1] && currentNote2 == 61){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 62){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_C4,400); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[1] && currentNote2 == 63){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 64){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[1] && currentNote2 == 65){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= 800 && currentNote2 == 66){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_C4,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 67){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 68){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 69){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_GS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 70){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 71){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_DS4,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 72){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_C4,600); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[1] && currentNote2 == 73){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_DS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= 250 && currentNote2 == 74){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_G3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= 250 && currentNote2 == 75){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= 250 && currentNote2 == 76){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_G4,300); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[2] && currentNote2 == 77){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 78){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 79){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 80){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 81){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,300); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= 450 && currentNote2 == 82){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_G3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 83){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 84){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_C4,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= intervalc[0] && currentNote2 == 85){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,300); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= 400 && currentNote2 == 86){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= 400 && currentNote2 == 87){ previousMillis2 = currentMillis2; tone(PBuzz,NOTE_AS3,200); currentNote2 += 1; } if(currentMillis2- previousMillis2 >= 800 && currentNote2 == 88){ previousMillis2 = currentMillis2; currentNote2 += 1; counter += 1; } } void BassHelper(){ //int intervala[] = {900,900,600}; unsigned long currentMillis = millis(); //Function 1:Bass Helper if(currentMillis - previousMillis >= 500 && currentNote ==0){ previousMillis = currentMillis; tone(PBuzz,NOTE_F2,300); currentNote += 1; } //delay(700); if (currentMillis - previousMillis >= intervala[0] && currentNote == 1) { previousMillis = currentMillis; tone(PBuzz,NOTE_F2,200); currentNote += 1; } //delay(500); if (currentMillis - previousMillis >= intervala[1] && currentNote == 2) { previousMillis = currentMillis; tone(PBuzz,NOTE_F2,200); currentNote +=1; } //delay(200); if (currentMillis - previousMillis >= intervala[2] && currentNote == 3) { previousMillis = currentMillis; tone(PBuzz,NOTE_G2,200); currentNote +=1 ; } //delay(500); if (currentMillis - previousMillis >= intervala[1] && currentNote == 4) { previousMillis = currentMillis; tone(PBuzz,NOTE_GS2,300); currentNote += 1; } //delay(700); if (currentMillis - previousMillis >= intervala[0] && currentNote == 5) { previousMillis = currentMillis; tone(PBuzz,NOTE_GS2,150); currentNote += 1; } //delay(500); if (currentMillis - previousMillis >= intervala[1] && currentNote == 6) { previousMillis = currentMillis; tone(PBuzz,NOTE_AS2,200); currentNote += 1; } //delay(200); if (currentMillis - previousMillis >= intervala[2] && currentNote == 7) { previousMillis = currentMillis; tone(PBuzz,NOTE_C3,100); currentNote += 1; } //delay(500); if (currentMillis - previousMillis >= intervala[1] && currentNote == 8) { previousMillis = currentMillis; tone(PBuzz,NOTE_DS3,300); currentNote += 1; } //delay(700); if (currentMillis - previousMillis >= intervala[0] && currentNote == 9) { previousMillis = currentMillis; tone(PBuzz,NOTE_DS3,150); currentNote += 1; } //delay(500); if (currentMillis - previousMillis >= intervala[1] && currentNote == 10) { previousMillis = currentMillis; tone(PBuzz,NOTE_DS3,200); currentNote += 1; } //delay(200); if (currentMillis - previousMillis >= intervala[2] && currentNote == 11) { previousMillis = currentMillis; tone(PBuzz,NOTE_C3,100); currentNote += 1; } //delay(500); if (currentMillis - previousMillis >= intervala[1] && currentNote == 12) { previousMillis = currentMillis; tone(PBuzz,NOTE_AS2,300); currentNote += 1; } //delay(700); if (currentMillis - previousMillis >= 700 && currentNote == 13) { previousMillis = currentMillis; tone(PBuzz,NOTE_AS2,150); currentNote += 1; } //delay(500); if (currentMillis - previousMillis >= 450 && currentNote == 14) { previousMillis = currentMillis; tone(PBuzz,NOTE_AS2,200); currentNote += 1; } //delay(200); if (currentMillis - previousMillis >= intervala[2] && currentNote == 15) { previousMillis = currentMillis; tone(PBuzz,NOTE_G2,200); currentNote += 1; } //delay(200); if (currentMillis - previousMillis >= intervala[2] && currentNote == 16) { previousMillis = currentMillis; tone(PBuzz,NOTE_GS2,200); currentNote += 1; } //Loop One more time if(currentMillis - previousMillis >= 300 && currentNote ==17){ previousMillis = currentMillis; tone(PBuzz,NOTE_F2,300); currentNote += 1; } //delay(700); if (currentMillis - previousMillis >= intervala[0] && currentNote == 18) { previousMillis = currentMillis; tone(PBuzz,NOTE_F2,200); currentNote += 1; } //delay(500); if (currentMillis - previousMillis >= intervala[1] && currentNote == 19) { previousMillis = currentMillis; tone(PBuzz,NOTE_F2,200); currentNote +=1; } //delay(200); if (currentMillis - previousMillis >= intervala[2] && currentNote == 20) { previousMillis = currentMillis; tone(PBuzz,NOTE_G2,200); currentNote +=1 ; } //delay(500); if (currentMillis - previousMillis >= intervala[1] && currentNote == 21) { previousMillis = currentMillis; tone(PBuzz,NOTE_GS2,300); currentNote += 1; } //delay(700); if (currentMillis - previousMillis >= intervala[0] && currentNote == 22) { previousMillis = currentMillis; tone(PBuzz,NOTE_GS2,150); currentNote += 1; } //delay(500); if (currentMillis - previousMillis >= intervala[1] && currentNote == 23) { previousMillis = currentMillis; tone(PBuzz,NOTE_AS2,200); currentNote += 1; } //delay(200); if (currentMillis - previousMillis >= intervala[2] && currentNote == 24) { previousMillis = currentMillis; tone(PBuzz,NOTE_C3,100); currentNote += 1; } //delay(500); if (currentMillis - previousMillis >= intervala[1] && currentNote == 25) { previousMillis = currentMillis; tone(PBuzz,NOTE_DS3,300); currentNote += 1; } //delay(700); if (currentMillis - previousMillis >= intervala[0] && currentNote == 26) { previousMillis = currentMillis; tone(PBuzz,NOTE_DS3,150); currentNote += 1; } //delay(500); if (currentMillis - previousMillis >= intervala[1] && currentNote == 27) { previousMillis = currentMillis; tone(PBuzz,NOTE_DS3,200); currentNote += 1; } //delay(200); if (currentMillis - previousMillis >= intervala[2] && currentNote == 28) { previousMillis = currentMillis; tone(PBuzz,NOTE_C3,100); currentNote += 1; } //delay(500); if (currentMillis - previousMillis >= intervala[1] && currentNote == 29) { previousMillis = currentMillis; tone(PBuzz,NOTE_AS2,300); currentNote += 1; } //delay(700); if (currentMillis - previousMillis >= 700 && currentNote == 30) { previousMillis = currentMillis; tone(PBuzz,NOTE_AS2,150); currentNote += 1; } //delay(500); if (currentMillis - previousMillis >= 450 && currentNote == 31) { previousMillis = currentMillis; tone(PBuzz,NOTE_AS2,200); currentNote += 1; } //delay(200); if (currentMillis - previousMillis >= intervala[2] && currentNote == 32) { previousMillis = currentMillis; tone(PBuzz,NOTE_G2,200); currentNote += 1; } //delay(200); if (currentMillis - previousMillis >= intervala[2] && currentNote == 33) { previousMillis = currentMillis; tone(PBuzz,NOTE_GS2,200); currentNote += 1; } //ADD INTRO HERE if (currentMillis - previousMillis >= 500 && currentNote == 34) { previousMillis = currentMillis; tone(PBuzz,NOTE_GS4,400); currentNote += 1; } if (currentMillis - previousMillis >= 500 && currentNote == 35) { previousMillis = currentMillis; tone(PBuzz,NOTE_C5,400); currentNote += 1; } if (currentMillis - previousMillis >= 500 && currentNote == 36) { previousMillis = currentMillis; tone(PBuzz,NOTE_DS5,400); currentNote += 1; } if (currentMillis - previousMillis >= 1050 && currentNote == 37) { previousMillis = currentMillis; tone(PBuzz,NOTE_C5,400); currentNote += 1; } if (currentMillis - previousMillis >= 500 && currentNote == 38) { previousMillis = currentMillis; tone(PBuzz,NOTE_DS5,400); currentNote += 1; } if (currentMillis - previousMillis >= 500 && currentNote == 39) { previousMillis = currentMillis; tone(PBuzz,NOTE_G5,400); currentNote += 1; } if (currentMillis - previousMillis >= 1050 && currentNote == 40) { previousMillis = currentMillis; tone(PBuzz,NOTE_AS4,400); currentNote += 1; } if (currentMillis - previousMillis >= 500 && currentNote == 41) { previousMillis = currentMillis; tone(PBuzz,NOTE_DS5,400); currentNote += 1; } if (currentMillis - previousMillis >= 500 && currentNote == 42) { previousMillis = currentMillis; tone(PBuzz,NOTE_G5,400); currentNote += 1; } if (currentMillis - previousMillis >= 1050 && currentNote == 43) { previousMillis = currentMillis; tone(PBuzz,NOTE_AS4,400); currentNote += 1; } if (currentMillis - previousMillis >= 500 && currentNote == 44) { previousMillis = currentMillis; tone(PBuzz,NOTE_C5,400); currentNote += 1; } if (currentMillis - previousMillis >= 500 && currentNote == 45) { previousMillis = currentMillis; tone(PBuzz,NOTE_DS5,400); currentNote += 1; } if (currentMillis - previousMillis >= 500 && currentNote == 46) { previousMillis = currentMillis; tone(PBuzz,NOTE_DS5,400); currentNote += 1; counter += 1; } } void Chorus(){ //Function 2: //int intervalb[] = {250,300,400,500,600,450,350,700}; unsigned long currentMillis1 = millis(); if(currentMillis1 - previousMillis1 >= 600 && currentNote1 == 0){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_G5,300); currentNote1 += 1; } if(currentMillis1 - previousMillis1 >= intervalb[2] && currentNote1 == 1){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_F5,150); currentNote1 += 1; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 2){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_F5,200); currentNote1 += 1; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 3){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 4){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,300); currentNote1 += 1; } if(currentMillis1 - previousMillis1 >= intervalb[5] && currentNote1 == 5){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_C5,300); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 6){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_AS4,300); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 7){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= 500 && currentNote1 == 8){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= 500 && currentNote1 == 9){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= 500 && currentNote1 == 10){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_C5,300); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 11){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_AS4,300); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 12){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,300); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= 400 && currentNote1 == 13){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 14){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 15){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= 750 && currentNote1 == 16){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_F5,300); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[3] && currentNote1 == 17){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_F5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= 450 && currentNote1 == 18){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_G5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= 300 && currentNote1 == 19){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_F5,250); currentNote1 += 1 ; } //New loop, with added if(currentMillis1 - previousMillis1 >= 700 && currentNote1 == 20){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_G5,300); currentNote1 += 1; } if(currentMillis1 - previousMillis1 >= intervalb[2] && currentNote1 == 21){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_F5,150); currentNote1 += 1; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 22){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_F5,200); currentNote1 += 1; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 23){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 24){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,300); currentNote1 += 1; } if(currentMillis1 - previousMillis1 >= intervalb[5] && currentNote1 == 25){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_C5,300); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 26){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_AS4,300); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 27){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[5] && currentNote1 == 28){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[5] && currentNote1 == 29){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[5] && currentNote1 == 30){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_C5,300); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 31){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_AS4,300); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 32){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,300); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= 400 && currentNote1 == 33){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 34){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 35){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= 750 && currentNote1 == 36){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_F5,300); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[3] && currentNote1 == 37){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_F5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= 450 && currentNote1 == 38){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_G5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= 300 && currentNote1 == 39){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_F5,250); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= 300 && currentNote1 == 40){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,250); currentNote1 += 1 ; } //NEW LOOP if(currentMillis1 - previousMillis1 >= 600 && currentNote1 == 41){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_G5,300); currentNote1 += 1; } if(currentMillis1 - previousMillis1 >= intervalb[2] && currentNote1 == 42){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_F5,150); currentNote1 += 1; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 43){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_F5,200); currentNote1 += 1; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 44){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 45){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,300); currentNote1 += 1; } if(currentMillis1 - previousMillis1 >= intervalb[5] && currentNote1 == 46){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_C5,300); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 47){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_AS4,300); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 48){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= 500 && currentNote1 == 49){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= 500 && currentNote1 == 50){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= 500 && currentNote1 == 51){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_C5,300); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 52){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_AS4,300); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 53){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,300); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= 400 && currentNote1 == 54){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 55){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 56){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= 750 && currentNote1 == 57){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_F5,300); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[3] && currentNote1 == 58){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_F5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= 450 && currentNote1 == 59){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_G5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= 300 && currentNote1 == 60){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_F5,250); currentNote1 += 1 ; } //New loop, with added if(currentMillis1 - previousMillis1 >= 700 && currentNote1 == 61){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_G5,300); currentNote1 += 1; } if(currentMillis1 - previousMillis1 >= intervalb[2] && currentNote1 == 62){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_F5,150); currentNote1 += 1; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 63){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_F5,200); currentNote1 += 1; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 64){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 65){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,300); currentNote1 += 1; } if(currentMillis1 - previousMillis1 >= intervalb[5] && currentNote1 == 66){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_C5,300); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 67){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_AS4,300); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 68){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[5] && currentNote1 == 69){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[5] && currentNote1 == 70){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[5] && currentNote1 == 71){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_C5,300); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 72){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_AS4,300); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 73){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,300); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= 400 && currentNote1 == 74){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 75){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[1] && currentNote1 == 76){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= 750 && currentNote1 == 77){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_F5,300); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= intervalb[3] && currentNote1 == 78){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_F5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= 450 && currentNote1 == 79){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_G5,200); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= 300 && currentNote1 == 80){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_F5,250); currentNote1 += 1 ; } if(currentMillis1 - previousMillis1 >= 300 && currentNote1 == 81){ previousMillis1 = currentMillis1; tone(PBuzz,NOTE_DS5,250); currentNote1 += 1 ; } }
INPUT
For the input, I used a potentiometer to crank up, and if the meter reached at least a value of 1000, then the bass and basshelper() would start playing. Then, I had a counter to say that when basshelper() ended, add a count and if that counter matched the number with the next function then the next function would play. Like that, I was able to play the Tone functions one at a time while having the Bass() on for the whole time. Also, I could check if my potentiometer was on by connecting the value to an ledPin and seeing if the light lit up as I cranked the value past 1000. Here is the picture of the board below.
FINAL PRODUCT
Here is a video of a demonstration of the final product. There are also audio explanation of the features as well.
Enjoy!