Ok pretty simple: How to make internal speaker beep on Linux. For personal use does not need to be portable. I know I have an internal speaker... BIOS loves that thing...

Recommended Answers

All 2 Replies

On most distros you should be able to just use the "alarm" character (0x07, or "\a" as an escaped sequence). In other words, this should work:

#include <iostream>

int main() {
  std::cout << "\a";
  return 0;
};

If not, you can use the "beep" program (install it with "sudo apt-get install beep", and check the manual).

But, before you try too many things, verify that you have a PC Speaker and that it is enabled, use the command amixer scontents and you should see an entry called "PC Speaker" and its playback should be enabled (i.e. Linux distros often disable the PC speaker after startup).

Why do they disable the internal speaker? It seems as if my copy of Kubuntu is very louse about restrictions... It even let's me use Linix's experimental NTFS editor:-)
Edit: I don't have internet SUDO apt-get is outside of my ability (this is why I'm considering solaris)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.