[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: [LI] How-to produce sound through PC speaker



On Wed, Jan 19, 2000 at 09:25:27AM +0530, soumya@xxxxxxxxxxx wrote:
> In good old days of DOS it was easy to produce sound of variable
> frequency and duration in Basic/Pascal/C. I have not come across any
> routine to do the same thing in gcc.

The good things are forever. In Linux, you can create sound from PC-speaker 
using ioctl() calls on your terminal.

ioctl (fd, KDMKTONE,(long) argument);
	and
ioctl(fd,KIOCSOUND,(int) tone);

	The documents are available in the Linux Programmers Guide present
in /usr/doc/LDP/lpg/lpg.html (on my RH 5.2 box here).
	The "fd" can be "0" or "1" (if you have not modified your stdin or
 stdout) or can be obtained by doing an open() on "/dev/tty".

--vml,
Model Engg. College,
Cochin
--------------------------------------------------------------------
The Linux India Mailing List Archives are now available.  Please search
the archive at http://lists.linux-india.org/ before posting your question
to avoid repetition and save bandwidth.