SOund Sensor counter

hye guys. i want to create noise detector for library use... when people start to make noise.. this noise detector will on the buzzer with low lv sound for about 4 second.. then, if people start to make noise twice.. this noise detector will on the buzzer for 6 second with medium lv of sound... and for third high lv sound for about 10 second and onward.. the problem is.. i dont know how to make the coding.. so if anyone could help me with the coding would be great help...

thnks you for any help.. :slight_smile: