Guys,
I've got this MOSFET amplifier in 3 different boxes. I've got this little tone playing a warble.
In 2 of the boxes it sounds great, like a cell phone ringing. In the third, it starts great but ends sounding like someone farted after the last note. I thought initially it was because I didn't have the series cap into the gate, so I just finished adding one - however the sound didn't change at all.
The only difference is in the size of the box - 2 are smaller, Staples Stretch pencil boxes. The farty one is a large 4L box. Both box types have holes drilled in front of the speaker.
Any ideas?
Thanks
Robert
// info on alarm sound
#include "g_pitches.h"
// notes in the melody:
int thisNote = 0;
int noteDuration = 0;
int pauseBetweenNotes = 0;
int melody[] = {
NOTE_C6, NOTE_A5, NOTE_C6, NOTE_A5, NOTE_C6, NOTE_A5, NOTE_C6};
// note durations: 4 = quarter note, 8 = eighth note, etc.:
int noteDurations[] = {
12,12,12,12,12,12,4};
// create a warble once
for (thisNote = 0; thisNote < 8; thisNote++)
{
// to calculate the note duration, take one second
// divided by the note type.
//e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
noteDuration = 1000/noteDurations[thisNote];
noTone(6); //apparent known bug - need this for the tone to play next.
tone(6, melody[thisNote],noteDuration);
// to distinguish the notes, set a minimum time between them.
// using the note's duration + 10%:
pauseBetweenNotes = noteDuration * 1.10;
delay(pauseBetweenNotes);
// stop the tone playing:
noTone(6);
}
digitalWrite (speakerOut, LOW); // turn off the amp
delay (500);