How to know which program has just played sound? At times, my computer suddenly played some annoying short sound (sounds like darrrt, seems not from the system), and it's so short that I have no idea where it comes from (and cannot capture it).

Is there any ways to find which program/process did that? (I really want to kill it!)

I am using OS X Mavericks.
Sounds like the iMessage logged in notification.

Try this command in terminal to verify:

afplay "/Applications/Messages.app/Contents/Resources/Logged In.aiff"


To turn if off you can turn off "Play sound effects" in the iMessage preferences.