1

I use Debian and Mate, also I use vim a lot. There are a lot of answers about how to disable that loud beeping sound, it is called "terminal bell" in mate-terminal settings, but actually the sound alert has some good use in vim. My typical workflow is to work with a silent music and I need the alert to be quieter. It sounds like a drip of water and not like system beep.

An example of possible solution: if I figure up where the sound file is located, I would like to edit it with an audio editor.

1 Answer 1

2

It seems you're new to Unix & Linux StackExchange. Welcome!

Right now, my MATE Desktop (which I'm using as a desktop manager for Ubuntu) is in a Virtual Machine without sound enabled, but I can give you some ideas which I think will get you where you need to be.

A quick note that, if I remember right, VIM has its own internal sound stuff. If none of the stuff I mention ends up working, look up some stuff about VIM sound. Some places to start - not solutions, but places to start - are A, B, and C.

In case on link rot: (archived A, search for "echoerr" ; archived B, search for "errorbells" ; archived C, search for "beep", which should be under "visualbell")

Searching for Ideas

My first step was to look through settings for something that might help.

Not official needed, but I run a backup of my settings: gsettings list-recursively > ~/.gsettings_list-recursively.$(date +'%s').bak

Now, for the settings.

bballdave025@DWBMACHINE:~$ gsettings list-recursively | \
  grep "bell\|pitch\|freq\|duration\|audible\|volume" | \
  grep mate | grep -v plugins
org.mate.engrampa.dialogs.batch-add volume-size 0
org.mate.peripherals-keyboard bell-pitch 400
org.mate.peripherals-keyboard bell-custom-file ''
org.mate.peripherals-keyboard bell-mode 'on'
org.mate.peripherals-keyboard click-volume 0
org.mate.peripherals-keyboard bell-duration 100
org.mate.caja.desktop volumes-visible true
org.mate.Marco.general audible-bell true
org.mate.Marco.general visual-bell-type 'fullscreen'
org.mate.Marco.general visual-bell false
bballdave025@DWBMACHINE:~$

Idea To Try 1

Already there, you have a possibility of trying something like the following.

gsettings set org.mate.peripherals-keyboard bell-custom-file \ 
  "/path/to/quieter/file"

(Note: I very quickly tried the method above - Idea To Try 1 - but I couldn't get it to work.)

Idea To Try 2

You might try a volume thing, though. Here's some stuff from the manual page for xset (a way of changing your X Window System preferences/configuration).

bballdave025@DWBMACHINE:~$ man xset | grep -B1 -A16 "^OPTIONS"

OPTIONS
       -display display
               This option specifies the server to use; see X(7).

       b       The b option controls bell volume, pitch  and  duration.   This
               option  accepts  up  to three numerical parameters, a preceding
               dash(-), or a 'on/off' flag.  If no parameters  are  given,  or
               the  'on'  flag  is used, the system defaults will be used.  If
               the dash or 'off' are given, the bell will be turned  off.   If
               only  one numerical parameter is given, the bell volume will be
               set to that value, as a percentage of its  maximum.   Likewise,
               the  second  numerical  parameter  specifies the bell pitch, in
               hertz, and the third numerical parameter specifies the duration
               in  milliseconds.  Note that not all hardware can vary the bell
               characteristics.  The X server will set the characteristics  of
               the bell as closely as it can to the user's specifications.

bballdave025@DWBMACHINE4UB20KDX:~$

Let's make a backup of the original settings (of a sort), which are as if you used the parameters 50 400 100

xset q b > ~/.xset_q_b.$(date +'%s').bak

However, if I recall, the bell from the xset refers to an [old desktop's] internal bell. I seem to remember running something like

xset b 10 400 1000 

but not having anything change, even after logouts and resets.

I guess that's why they have

Note that not all hardware can vary the bell characteristics

(Note: I very quickly tried the method above - Idea To Try 2 - but I couldn't get it to work.)

Idea To Try 3

In my setup, the "terminal bell" seems to point to a file. I'll find that file with a few commands.

bballdave025@DWBMACHINE:~$ gsettings list-recursively | grep -i theme | grep -i sound
org.gnome.desktop.sound theme-name 'Yaru'
org.mate.sound theme-name 'Yaru'
org.gnome.evolution.plugin.mail-notification notify-sound-use-theme true
bballdave025@DWBMACHINE:~$ 
bballdave025@DWBMACHINE:~$ #  Oh, yeah, I should have done another
bballdave025@DWBMACHINE:~$ #+ `grep mate`, but this might help
bballdave025@DWBMACHINE:~$ #+ others with different desktop managers

It's time to find the bell file.

bballdave025@DWBMACHINE:~$ find /usr/share -type f -iname "*bell*" | grep Yaru
/usr/share/sounds/Yaru/stereo/bell.oga
bballdave025@DWBMACHINE:~$

A quick and dirty thing to do here (I don't suggest this!) would be

sudo mv /usr/share/sounds/Yaru/stereo/bell.oga \
  /usr/share/sounds/Yaru/stereo/bell.oga.disabled
sudo cp /path/to/your/nicer/file.ogg /usr/share/sounds/Yaru/stereo/bell.oga

but I think you'd be better to follow the instructions for making a new profile from @elmato at EOS StackEchange (I DO suggest this!). Briefly.

sudo mkdir -p /usr/share/sounds/mytheme/stereo
sudo touch /usr/share/sounds/mytheme/index.theme

Get your sound file, or make one. I'll do something with sox

# get into your home directory, then install sox
cd
sudo apt-get install -y sox

# 1.5 seconds of an A3 plucked on a guitar at 0.1 of max volume
sox -n bell.ogg synth 1.5 pluck A3 vol 0.1

# write the `index.theme` file
sudo nano /usr/share/sounds/myprofile/index.theme

Your file should end up looking like what is visible from the cat command, below.

$ cat /usr/share/sounds/myprofile/index.theme 
[Sound Theme]
Name=myprofile
Directories=stereo

[stereo]
OutputProfile=stereo
$ 

Now copy in the file you want. I'll use my bell.ogg, but note the change in file extension from .ogg to .oga. I'm in my home directory, which is where I created my guitar-pluck file. I'll then run the command to change my settings to have my new sound profile. (Note that anything besides bell.oga will revert back to the default.)

sudo cp bell.ogg /usr/share/sounds/mytheme/stereo/bell.oga

gsettings set org.mate.sound theme-name mytheme

If you want to revert back to the defaults, simply use

gsettings reset org.mate.sound theme-name

(Note: I very quickly tried the method above - Idea To Try 3 - and it worked beautifully.)

Try that whole default-theme thing. If it doesn't work, try the gsettings set org.mate.peripherals-keyboard bell-custom-file "/path/to/quieter/file". Let me know if either work.

Edit: I enabled sound on my VM, and I was able to get Idea To Try 3 to work. When I backspaced too many times in the terminal, I got the guitar-pluck sound. When I did something that vim didn't like, I also got the guitar-pluck sound.

With quick and definitely-not-comprehensive testing, neither Idea To Try 1 nor Idea To Try 2 gave me the desired results.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .