The Microphone circuit went through three stages:
The Clapper
An Enveloped Clapper
High Gain Mic
Here is the flow diagram for calculating the alert amount from the audio input thus far:
And here is the code written for the microcontroller:
/***************************************************************************/
// interpret micData function
/***************************************************************************/
void interpretMicData( UINT8 micIn) {
if(micIn >= 196) { //assumming a scream is in a relative amplitude of 200 or greater in the range: 0 - 255
micDanger++; //increment spam-like protection
if(micDanger == 255) { //wait until the spam protection has reached the limit of 255
micAlert = 1; //set high-level alert flag
}
else {
return;
}
}
else
{
micDanger = 0; //reset micDanger count
}
return;
}
If you have any microphone hardware questions, ask honcho. Ask jazzman about microphone software details.