Bell sound in TCL/TK and terminal

I have developed some TCL/TK programs under Windows 7.
As I have installed Manjaro on one of my notebooks (duel booting with Windows 7), I would like to run those programs in Manjaro as well.

I have them working except for the Bell function. It works fine in Windows but I am unable find out how to make the bell sound from either TCL/TK or the terminal.

The manual for the bell function in tcl/tk states that the bell related setting may be modified by the ‘xset’ command. I looked into this and there is a command ‘xset b on’ that should turn the bell on when required. This didn’t work. The command being used in tcl/tk is ‘bell -nice’ that works fine in windows…

In terminal I tried:
tput bel
echo -e “\07”
echo -e “\a”
None of these work.

For me the bell function in tcl/tk is more important than in terminal.
Does anyone know how to make this work.

You may need to install package beep for this

pamac install beep

PC speaker - Beep - ArchWiki

Just done that.
No difference - does nothing.

Did you checked if the necessary Kernel module(s) are loaded. They are often blacklisted, because most user find the bell anayoing.

xabbu, how do I do that?

I just want it working in tcl/tk and terminal.

PC speaker - ArchWiki

The ‘PC speaker - ArchWiki’ link is mainly for how to turn the speaker off not on. But it can still be used. Some of those I already have ON and others cannot be set. These setting are not in the kernel module that xabbu suggested.
It is still the same. No bell sound from tcl/tk or the terminal.

Why is there no checkbox in one of the GUIs?
Why do 10 or more different things need to be setup to do something as simple as to make the bell sound to work (and still not working)?
Is this supposed to be easy for people to setup?

I tested it myself:

  1. I unmute beep in alsamixer and keep sure, that the module pcspkr is loaded.
lsmod | grep pcspkr 
  1. I switched to another TTY. For example CTRL + ALT + F3. There it works, and that is intended in a non-graphical environment.
  2. In a Terminal-Emulator, it needs to enabled and is rather optional and depends highly on the ability of the terminal.
  3. I would suggest that you use beep. The linked wiki article explains what to do. Then you can play tetris sound track in your pc-speaker:
bash <(curl -s "https://raw.githubusercontent.com/ShaneMcC/beeps/master/tetris.sh")

When I key in ‘lsmod | grep pcspkr’
I get '‘pcspkr 16384 0’

I don’t know what that means. Does the zero mean zero volume?
I keyed in ‘alsamixer’.

I get:
speaker
There appears to be no Beep column.

Select the sound card: F6

Yes, I selected the Default:0 HDA Intel MID and there it was, similar to yours with multiple columns including the Beep. I also set that to 100.
But how do I make it stick. The next time I try ‘alsamixer’ I receive the original single column and with F6 also the previously selected Default: 0 is not the one selected.

Sorry, no idea :man_shrugging: When I set it and type ESC and run it again, it stays the same. So it is saved.

Yes, if I select the Default: 0 again, the setting I made are saved.
Just the F6 selection does not stick.

You can select it like this:

alsamixer --card=0

That launched card=0 but doesn’t stick.
If I launch just alsmixer it opens with the other card with the single column.
Also there is no bell sound.

If I launch just alsmixer it opens with the other card with the single column

If alsamixer is used without specifying a card number It will show the ALSA default output from PulseAudio or PipeWire rather than mixer controls for hardware devices

But how do I make it stick

Changes in ALSA settings are usually saved to a system file /var/lib/alsa/asound.state
If alsamixer is run as a normal user without permission to write to this file, changes to ALSA settings will not survive system reboot

To change ALSA settings permanently:

  1. Run alsamixer with root privileges so it has write access to the system file
    sudo alsamixer --card=0
    

OR

  1. Use this command after using alsamixer to save ALSA settings for card 0
    sudo alsactl store 0
    

OR

  1. Use amixer to get ALSA settings in text format
    amixer --card=0
    
    and formulate a command to change a specific mixer control:
    (e.g. for ALSA settings shown in post#9)
    amixer --card=0 sset 'Beep' 100% unmute
    

I would suggest posting response to amixer --card=0 to show ALSA controls

There may or may not be a mixer control for setting ‘Beep’ level on the audio codec

So there is also no bell sound in another non-graphical TTY? On a graphical environment it is a emulation, which means it mostly doesn’t use the pc-speaker anymore, but instead play a sound file.

So if you really need such a direct beep like on a non-graphical environment, then use beep.

It could be also possible that you run wayland with xwayland (not pure xorg, but a legacy xorg for programs which still uses xorg). It seems not to be implemented there, and I guess it will not ever be implemented. I tested it on xfce (which is xorg only) with the xfce-terminal and when I type tput bel I get a beep sound.

I have no idea, why you even need this, but if it should be just a warning sound, then use a sound file, because the beep sound is going to be obsolete and there was much effort to disable it and make it not necessary.

I have tried all the suggestions without success.
In a root terminal entering alsamixer brings up my card 0, but only in root.
But even in the root terminal there is no bell sound with tput bel or any of the echo inputs.

I agree that there must have been a lot of effort to disable beeps. I believe that this is going backwards.
The output from ’ amixer --card=0’ is very long. I don’t know how to post it.
I have used a sound file before and played it with ‘mpg123 -q $snd’ but that needs a extra file for running my program.

It looks like I have no choice here.