Click to See Complete Forum and Search --> : ANSI Beeps


Charred_Phoenix
07-16-2003, 09:58 PM
Is there any way to do those ANSI notes (the ones you get with the "PLAY" command in QB) in C?

ricstr
07-17-2003, 09:39 PM
Are you taliking about the pc-speaker beeping?
try:
printf('\a');
If you want to control the frequency or time then i have no idea. It could be done in TurboC in DOS using the dos.h header.

salil
07-17-2003, 11:28 PM
PC speaker beep in C language can also be obtained by :

printf("%c", 7);

Charred_Phoenix
07-18-2003, 01:30 AM
I already new about the bell character, but there is a set of notes that are just simple beeps if you're not sure what I mean, and you have a DOS box, try the PLAY command in QBasic. It was used in a lot of DOS games, but I've never seen anything like it in *nix.

bwkaz
07-18-2003, 09:55 AM
The QBasic PLAY command was just a higher-level interface to the PC speaker (and it wasn't ever an ANSI standard that I know of, just a QBasic one). The actual hardware I/O ports define a couple of parameters for the speaker, like frequency and duration, that you can set with low-level BIOS functions, but I don't know if you have access to those functions in Linux. Normal userspace definitely doesn't, but I don't know if the kernel has a driver for it or not. That would be where I'd look, though.

Charred_Phoenix
07-18-2003, 09:56 PM
OK thanks. If you want to see a bit more about ANSI standards and the PLAY command just google "ANSI Music".

bwkaz
07-19-2003, 09:00 AM
There are a pair of drivers in kernel 2.6.0-test1 that might be interesting. Under "Input Device Support", turn "Misc" on, and you'll get options for "PC Speaker support" (uses the PC speaker for feedback for some things, not sure what though) and "User level driver support" -- which might be what you want. You get access through /dev/uinput, somehow (you'd have to look at the driver source to figure out how to use it, though...).

Charred_Phoenix
07-19-2003, 07:34 PM
Thanks :)