Beeps and bells

We’ve had a thread about using the PC speaker recently, and David posted a
"speaker emulator".

But what my users want is a simple beep when using a machine without a
soundcard. I might be able to get X to give me beeps, but is there some
simple way to get Windows to generate them (cross-compiled in Linux)?

Ta.

  • Deth -

printf("\a"); ?

Julian.On 11 Mar 2001 16:17:53 +0000, Lee Haywood wrote:

We’ve had a thread about using the PC speaker recently, and David posted a
"speaker emulator".

But what my users want is a simple beep when using a machine without a
soundcard. I might be able to get X to give me beeps, but is there some
simple way to get Windows to generate them (cross-compiled in Linux)?

We’ve had a thread about using the PC speaker recently, and David posted a
"speaker emulator".

But what my users want is a simple beep when using a machine without a
soundcard. I might be able to get X to give me beeps, but is there some
simple way to get Windows to generate them (cross-compiled in Linux)?

Julian Peterson wrote:

printf("\a"); ?

Funny, but I asked for something that would work in Windows - if you do
that you’d get an entry in ‘stdout.txt’, not to a terminal.

Even in Linux it would only work if a terminal (e.g. xterm) was available
and remained available.

Ta.

  • Deth -> On 11 Mar 2001 16:17:53 +0000, Lee Haywood wrote:

We’ve had a thread about using the PC speaker recently, and David
posted a “speaker emulator”.

But what my users want is a simple beep when using a machine without a
soundcard. I might be able to get X to give me beeps, but is there
some simple way to get Windows to generate them (cross-compiled in
Linux)?

Julian Peterson wrote:

printf("\a"); ?

Funny, but I asked for something that would work in Windows - if you do
that you’d get an entry in ‘stdout.txt’, not to a terminal.

MessageBeep() or something… No control, but it does produce a beep if
there’s no sound card. (There are two API calls, IIRC; one of them always
produces a speaker beep, it seems.)

Even in Linux it would only work if a terminal (e.g. xterm) was available
and remained available.

But how does the XTerm do it, then…? I’m assuming the X server has some
kind of API for it - and as some desktop environments allow tuning the beep,
it might even be a sound(freq, duration) or even a sound(freq)/nosound()
style API.

I’ve not managed to find it, though. Don’t know what to look for it seems…
(Guess I’ll just have to look for the console ioctls in the KFree86 source.)

For the console, there are the KIOCSOUND(freq/0=stop) and
KDMKTONE(freq/0=stop, duration/o=forever) ioctls. They represent both of the
API styles I’m talking about, so they should work great.

//David

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------> http://www.linuxaudiodev.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |--------------------------------------> david at linuxdj.com -'On Sunday 11 March 2001 21:30, Lee Haywood wrote:

On 11 Mar 2001 16:17:53 +0000, Lee Haywood wrote:

But how does the XTerm do it, then…? I’m assuming the X server has some
kind of API for it

Yes, it has. See “man XBell” and “man XChangeKeyboardControl” (same page
actually) for more info.On Mon, 12 Mar 2001, David Olofson wrote:

Ville Hallik +372-52-77891

Yep, found that after some digging in various applications. :slight_smile: Using
XChangeKeyboardControl() all the time looks like a nasty hack, but probably
works.

However, what about the X server and heavy graphics rendering? I’m not
expecting to be able to pump beeps out at 60 Hz through X, like the speaker
emulator (and the original DOS code) does…

//David

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------> http://www.linuxaudiodev.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |--------------------------------------> david at linuxdj.com -'On Monday 12 March 2001 17:25, Ville Hallik wrote:

On Mon, 12 Mar 2001, David Olofson wrote:

But how does the XTerm do it, then…? I’m assuming the X server has some
kind of API for it

Yes, it has. See “man XBell” and “man XChangeKeyboardControl” (same page
actually) for more info.

Yes, it has. See “man XBell” and “man XChangeKeyboardControl” (same page
actually) for more info.

note that X11 server support for XBell() has traditionally been very poor.
for example this XSun uses the keyboard beeper, which can emit beeps of
varying duration at a fixed frequency carefully adjusted to be as
annoying to the human ear as possible

in other words, don’t trust XBell and the less it is used the better

Yes, it has. See “man XBell” and “man XChangeKeyboardControl” (same page
actually) for more info.

note that X11 server support for XBell() has traditionally been very poor.
for example this XSun uses the keyboard beeper, which can emit beeps of
varying duration at a fixed frequency carefully adjusted to be as
annoying to the human ear as possible

How nice! :wink:

in other words, don’t trust XBell and the less it is used the better

Well, that’s kind of what I suspected…

Minimalistic speaker daemon with root privileges, or other means of getting
access to the relevant console ioctls? (It’s supposed to work for any local
user on a “real” console, but that doesn’t seem to be the case here…
Strange.)

//David

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------> http://www.linuxaudiodev.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |--------------------------------------> david at linuxdj.com -'On Monday 12 March 2001 18:05, Mattias Engdeg?rd wrote:

Minimalistic speaker daemon with root privileges, or other means of getting
access to the relevant console ioctls? (It’s supposed to work for any local
user on a “real” console, but that doesn’t seem to be the case here…
Strange.)

Is there any particular reason this is important? I’m not planning to add
anything like this to the SDL API, so I declare this officially off-topic. :slight_smile:

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

Actually, for embedded stuff something like this may be kewl. (Really depends)

So if there were ever an embedded SDL type dealy, it may be needed.On Mon, 12 Mar 2001, you wrote:

Minimalistic speaker daemon with root privileges, or other means of getting
access to the relevant console ioctls? (It’s supposed to work for any local
user on a “real” console, but that doesn’t seem to be the case here…
Strange.)

Is there any particular reason this is important? I’m not planning to add
anything like this to the SDL API, so I declare this officially off-topic. :slight_smile:


Sam “Criswell” Hart <@Sam_Hart> AIM, Yahoo!:
Homepage: < http://www.geekcomix.com/snh/ >
PGP Info: < http://www.geekcomix.com/snh/contact/ >
Advogato: < http://advogato.org/person/criswell/ >

Minimalistic speaker daemon with root privileges, or other means of
getting access to the relevant console ioctls? (It’s supposed to work for
any local user on a “real” console, but that doesn’t seem to be the case
here… Strange.)

Is there any particular reason this is important?

I don’t know about “important”, but IIRC, someone asked about speaker support
in relation to SDL, and I just thought it would be a good idea to do it in
some portable way, if possible.

OTOH, I wouldn’t exactly be looking forward to seeing (hearing) games that
support speaker sound only! :wink: A real sound FX engine + FX library would be
a nicer temporary solution for game developers who aren’t into audio.

I’m not planning to add
anything like this to the SDL API, so I declare this officially off-topic.
:slight_smile:

Well, I don’t blame you. hehe Besides, it doesn’t seem to be possible to
get at the real speaker in any reliable and/or useful way, even on the “IBM
PC” hardware based platforms.

Anyway, I’ll upload the new speaker driver with emulator (audio), Linux
console and XBell() output to the usual place in a moment (I think…), in
case anyone would be interested.

//David

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------> http://www.linuxaudiodev.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |--------------------------------------> david at linuxdj.com -'On Monday 12 March 2001 19:07, Sam Lantinga wrote:

Sam, your funny. I wonder how many people break down Loki’s door and are
like “I demand that Heretic II be able to play sounds out of the PC speaker.
In addition, I also want it to have a super-high thread priority so I have
less stability in the OS for a very minor if at all noticable performance
gain!”

Matt

Is there any particular reason this is important? I’m not planning to add
anything like this to the SDL API, so I declare this officially off-topic.
:)>
See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software