Your other option is to make your own tones, blink without delay style. Try this:
unsigned long note1time = 1136; // Middle A tone 440 Hz period/2, microseconds
unsigned long note2time = 1100; // do the math for other notes
unsigned long note3time = 1060;
unsigned long note4time = 1020;
unsigned long note1end; // end of period/2
unsigned long note2end;
unsigned long note3end;
unsigned long note4end;
byte note1button = 2; // keypress button, input pin with pullup resistor
byte note2button = 3;
byte note3button = 4;
byte note4button = 5;
byte note1pin = 6; //the output pin - need external mix via opamp
byte note2pin = 7;
byte note3pin = 8;
byte note4pin = 9;
byte note1state; // state of the note, 1 or 0
byte note2state;
byte note3state;
byte note4state;
byte note1playing; // flag to show if note is playing or not
byte note2playing;
byte note3playing;
byte note4playing;
void setup(){
pinMode (note1button, INPUT); // key press button
digitalWrite (note1button, HIGH); // internal pullup
pinMode (note1pin, OUTPUT); // output pin
pinMode (note2button, INPUT);
digitalWrite (note2button, HIGH);
pinMode (note2pin, OUTPUT);
pinMode (note3button, INPUT);
digitalWrite (note3button, HIGH);
pinMode (note3pin, OUTPUT);
pinMode (note4button, INPUT);
digitalWrite (note4button, HIGH);
pinMode (note4pin, OUTPUT);
}
void loop(){
if (digitalRead (note1button) == LOW) {
if (note1playing == 0) // if key is pressed and note is not started
{
note1playing = 1; // set note flag to playing
note1end = micros() + note1time; // capture time to make note change state
digitalWrite (note1pin, (1-note1state)); // start the note at high level (replace the write with something faster)
}
if (note1playing == 1){ // if key is pressed and note is already playing
if (micros()>=note1end){ // see if its time to change note state
note1end = note1end + note1time; // set time for next change
digitalWrite (note1pin, 1-note1state); // change the note state (1->0, 0->1)
}
}
}
else {
note1playing = 0; //set up for next note press
note1state = 0; // set up for next note press
digitalWrite (note1pin, LOW); // turn off output
}
// repeat for for notes 2,3,4
if (digitalRead (note2button) == LOW) {
if (note2playing == 0) // if key is pressed and note is not started
{
note2playing = 1; // set note flag to playing
note2end = micros() + note2time; // capture time to make note change state
digitalWrite (note2pin, (1-note2state)); // start the note at high level (replace the write with something faster)
}
if (note2playing == 1){ // if key is pressed and note is already playing
if (micros()>=note2end){ // see if its time to change note state
note2end = note2end + note2time; // set time for next change
digitalWrite (note2pin, 1-note2state); // change the note state (1->0, 0->1)
}
}
}
else {
note2playing = 0; //set up for next note press
note2state = 0; // set up for next note press
digitalWrite (note2pin, LOW); // turn off output
}
if (digitalRead (note3button) == LOW) {
if (note3playing == 0) // if key is pressed and note is not started
{
note3playing = 1; // set note flag to playing
note3end = micros() + note3time; // capture time to make note change state
digitalWrite (note3pin, (1-note3state)); // start the note at high level (replace the write with something faster)
}
if (note3playing == 1){ // if key is pressed and note is already playing
if (micros()>=note3end){ // see if its time to change note state
note3end = note3end + note3time; // set time for next change
digitalWrite (note3pin, 1-note3state); // change the note state (1->0, 0->1)
}
}
}
else {
note3playing = 0; //set up for next note press
note3state = 0; // set up for next note press
digitalWrite (note3pin, LOW); // turn off output
}
if (digitalRead (note4button) == LOW) {
if (note4playing == 0) // if key is pressed and note is not started
{
note4playing = 1; // set note flag to playing
note4end = micros() + note4time; // capture time to make note change state
digitalWrite (note4pin, (1-note4state)); // start the note at high level (replace the write with something faster)
}
if (note4playing == 1){ // if key is pressed and note is already playing
if (micros()>=note4end){ // see if its time to change note state
note4end = note4end + note4time; // set time for next change
digitalWrite (note4pin, 1-note4state); // change the note state (1->0, 0->1)
}
}
}
else {
note4playing = 0; //set up for next note press
note4state = 0; // set up for next note press
digitalWrite (note4pin, LOW); // turn off output
}
} // end void loop