If you want some scripts to emit beeps, e.g. because you don't always have your headphones on, you first have to enable
pcspkr module. This is per default disabled in Ubuntu. To enable it again, do the following:
/etc/modprobe.d/blacklist.confin your favorite editor (using
find these lines:
# ugly and loud noise, getting on everyone's nerves; this should be done by a # nice pulseaudio bing (Ubuntu: #77010) blacklist pcspkr
sudo modprobe pcspkr
After that, you can play around with the beep program.