#include <windows.h>
#include <iostream>
#include <string>
#include <conio.h>
using namespace std;
string beep;
int i;
int duration = 100;
char some_array[] = "abcdefgp+";
bool first_time = false;
int main()
{
SetConsoleTitle("Note Beeper");
cout << "\n\n\n Possible Notes Are E G B D F A C E\n"
<< " P is a quarter secnod pause\n"
<<" + Represents a quarter second extra sustainment of the note,\n"
<<" insert the plus or\n" << " pluses before the note you wish to sustain\n"
<<" default is 100 miliseconds and every \n"
<< " + after that is 250 miliseconds over the orgional 100\n\n\n\n";
while (1) {
if (first_time != true) {
beep = "+++g+c+d+++g+c+d+++g+c+d+e+b+a+++g";
first_time = true;
}
else {
cout << "Beep Note(s): ";
cin >> beep;
}
for (i=0; i < beep.length(); i++) {
if (beep.at(i) == some_array[8]) {
duration = duration + 250;
}
if (beep.at(i) == some_array[7]){ // P For Pause 0_0
Sleep(250);
}
if (beep.at(i) == some_array[3]){ // D
Beep(293.7, duration);
}
if (beep.at(i) == some_array[4]){ // E
Beep(329.6, duration);
}
if (beep.at(i) == some_array[5]){ // F
Beep(349.2, duration);
}
if (beep.at(i) == some_array[6]){ // G
Beep(392, duration);
}
if (beep.at(i) == some_array[0]){ // A
Beep(440, duration);
}
if (beep.at(i) == some_array[1]){ // B
Beep(493.9, duration);
}
if (beep.at(i) == some_array[2]){ // C
Beep(261.6, duration);
}
if (beep.at(i) != some_array[8]) { // If the Current Charector Isn't a + then the duration should be reset....
duration = 100;
}
}
}
}