There are 4/5 nice sketches bundled with arduino: -> Digital : tone* -> Sensors: knock