Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Beep() equivalent for Linux

Tags:

I am experimenting with Beep function on Windows:

#include <windows.h>
...
Beep(frequency, duration);

The computer then beeps with some frequency for some duration. How would I do this on a Linux computer?

Edit: It IS important to output different frequencies.

like image 453
supermedo Avatar asked Jan 05 '09 10:01

supermedo


People also ask

How do I make Python beep sound Linux?

Open a Python shell by typing the python command in your terminal. Import the os library using import os in your Python shell. Run the os. system() function and pass the "beep -f 2000 -l 1500" string command to run the beep command on your Linux system with 2000 Hz frequency and 1500 ms duration.

How to sound the system bell on Python?

The cross-platform way to do this is to print('\a') . This will send the ASCII Bell character to stdout, and will hopefully generate a beep (a for 'alert'). Note that many modern terminal emulators provide the option to ignore bell characters.

What is beep command used for?

This command causes the computer to generate a beep sound. It is often used to emphasize a customized message or warning dialog during data entry.


1 Answers

Check out the source code for beep available with Ubuntu (and probably other distros) or have a look at http://www.johnath.com/beep/beep.c for another source (it's the same code, I believe).

It allows you to control frequency, length and repetitions (among other things) with ease.

like image 120
paxdiablo Avatar answered Sep 22 '22 01:09

paxdiablo