I hacked a little sound trapping setup with a spark fun microphone and a LED on the Arduino Uno.
Connect the LED to GND and Pin 13. And the microphone VCC to 5V, GND and the AUD to A0.

The program triggers when a +/- threshold from the average is peaking.

Audio Peaks in Arduino seral plotter

Audio Peaks in Arduino seral plotter

Have fun,
-mat-


// Peakfinder for clap action etc.
// 2016 Copyright -mat- filid brandy, brandy@klammeraffe.org
//
// Setup the pins
const int micPin=0; // Read the microphone sound level on analog pin A0
const int ledPin=13; // Flash LED at pin 13 to show the peak hit

// Setting up the averaging array
const int maxSamples=10;
int sample[maxSamples];
int current=0;
int average=0;

// Setting up the threshold of change +/- from the average
const int threshold= 150;

// Show some light on startup
int LEDstillOn = 500;
const int timeslot = 10;

void setup() {
pinMode (ledPin, OUTPUT); //sets digital PIN 13 to output
Serial.begin(9600); //sets the baud rate at 9600
digitalWrite( ledPin, HIGH);
}

void loop(){
// Read the next sound level sample into the round robin array
current = (current < maxSamples) ? current : 0;
sample[current]= analogRead(micPin);

// Calculate the average of the last maxSamples
average = 0;
for (int i=0; i < maxSamples; i++) { average += sample[i]; } average /= maxSamples; // Print the current diff from the avarage, this can be easily plotted on the Serial Plotter Serial.println(abs(sample[current] - average)); if (abs(sample[current] - average) > threshold) {
// when ever we hit an low or high peak, make some light
digitalWrite (ledPin, HIGH);
LEDstillOn += 10*timeslot;
}

// Neat litte scheduler to show light and still be able to sample audio at the same time
if (LEDstillOn > 0) {
LEDstillOn -= timeslot;
Serial.println(LEDstillOn);
} else {
digitalWrite(ledPin, LOW);
}

delay(timeslot);
current++;
}