How to know which program has just played sound?
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.