[Tutor] Beep sound for Linux

Marc marcolinux@linuxbr.com.br
Sat, 8 Jun 2002 17:41:26 -0300


Dimitrije Nikic (donni@melwestmarket.com) wrote:

> I heard of beep sounds for Windows only, but is there a function for beep sounds in Linux?

Some time ago I was playing with a nice beep program: beep.
You can control the freq and duration of a beep.The only
problem: it must run suid root :/
You can get it at http://johnath.com/beep/beep-1.2.2.tar.gz

Test with:

$ beep -n -f 1500 -l 2000 -n 200 -l 3000

Should beep three times: a default,1500Hz for 2 seconds, 200Hz for 3
seconds.

Then I made  script to play with it. Feel free to improve it :)

#############################################################
#############################################################
#!/usr/bin/env python

import os

#tunes for beeporama: (frequence,duration)
tune1=[(1000,320),(900,10),(500,410),(400,10),(340,410),(300,10)]
tune2=[(1000,10),(500,10),(440,20),(340,2),(720,4),(880,40)]

tune=tune2

cmd='beep -f100 -l1 '

for i,j in tune: 
	cmd=cmd + ' -n -f '+ str(i) + ' -l'+str(j)

os.system(cmd)

#############################################################
#############################################################


Lame, but I was able to play some sounds for different situations like
incoming mail, ppp up/down, firewall alerts, etc.

Does any one know if is possible to find a way to get some "tunes" ?
Maybe extract from MIDI files or something like that.
It would be very nice to play some real music :)

Hope it helps.
Good luck.