[fpc-pascal]Beep in Linux

A.J. Venter ddt at vukanet.co.za
Wed Jul 3 11:21:03 CEST 2002

I wrote a small proggie quickly that used the ncurses wrapper and called the beep routine from curses (man beep)
program beeptest;
USes NCurses;


It compiled fine, but throws an error 216 (General Protection Fault) when I tried to run it (I tried it as root as well so it isn't permissions)

This seems to mean one of three things:
A> There is a catch to using the beep from ncurses - anybody know how it is used in C ?
B> There is a bug in the latest version of ncurses
C> There is a bug in the ncurses wrapper unit

In case of option C, my guess is it probably has to do with changes in the newer versions of ncurses.

All that said there is another option - asuming you do not considder the use of the speaker vital, but can settle on a soundcard.
Almost every distribution includes a commandline mp3 and wav player and most also include oggvorbis support.

THen you could use the shell procedure from the Linux unit to run such a commandline tool and play an audible warning from a sound file, perhaps
one  more userfriendly than a beep.

For example for Ogg Vorbis with your warning stored in warning.ogg the command is:
shell ('ogg123 warning.ogg');  

If you wish to be able to play the sound without waiting for it to finished (e.g. in the background such as for games)
the easiest way (since it requires no library imports) is to use a player command and run it through assignstream.


On Wednesday 03 July 2002 11:22, Aitor SantamarĂ­a Merino wrote:
> Hi,
> Does anyone know how to use the PC speaker to produce a beep in Linux,
> just as
> write (#7);
> will work under DOS and Win32?
> Aitor
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal

More information about the fpc-pascal mailing list