http://mbed.org/users/shimniok/code/Beep/#3eb39e374fc3