import RPi.GPIO as GPIO
channel = 18
print "A loud sound was detected!!"
print "A sound was detected!"
GPIO.add_event_detect(channel, GPIO.BOTH, bouncetime=300) # let us know when the pin goes HIGH or LOW
GPIO.add_event_callback(channel, callback) # assign function to GPIO PIN, Run function on change
# infinite loop