I am trying to enable an audible terminal bell/beep through the 1/8" mini-rca audio out (headphone jack) on debian wheezy with the rapsberry pi model b. Normal audio works as expected, when playing a shockwave file in Midori with gnash for example.

I turned the Audible bell setting in LXTerminal preferences ON, and tried the following:

$ xkbbell (no sound)

$ xkbbell -dev 0 (X Error of failed request: 146)

$ beep and $ beep -f 500 -l 700 after installing it with apt (no sound)

That said, this is all in an attempt to hear the bell sound triggered by PuTTY, when Action to happen when a bell occurs is set to Make default system alert sound. There is no option, like in the Windows version of PuTTY, to play a custom sound file when a bell occurs.

I've read that running # modprobe snd_hda_intel on other linux machines can redirect sound output intended for the PC speaker (which the raspberry lacks) to ALSA. Running that command tells me that this module is not found. I don't know how to acquire it with apt.

I'm really hoping someone has some insight...I'm dizzy from Googling!

  • Just to clarify, you want to hear the bell emitted from the Raspberry Pi on it's own, or when you SSH into it?
    – syb0rg
    Aug 9 '13 at 15:32
  • I want to hear the bell emitted from the Raspberry Pi on it's own. I thought that might be confusing.
    – humbolight
    Aug 9 '13 at 15:34

I found that you could load the sound drivers and stuff on Raspbian with:

sudo modprobe snd_bcm2835 && sudo amixer cset numid=3 1

The first command loads the sound driver module, the second I think sets the sound output to the 3.5mm socket.

You can then use alsamixer to adjust the volume, and speaker-test -c2 -t sine to test the speakers

You can also use the speaker-test util to produce different sounds, using -c1 for mono, c2 to switch between each channel of stereo, and -f to do different frequencies of noise - speaker-test --help gives alot more options:

speaker-test 1.0.25

Usage: speaker-test [OPTION]... 
-h,--help   help
-D,--device playback device
-r,--rate   stream rate in Hz
-c,--channels   count of channels in stream
-f,--frequency  sine wave frequency in Hz
-F,--format sample format
-b,--buffer ring buffer size in us
-p,--period period size in us
-P,--nperiods   number of periods
-t,--test   pink=use pink noise, sine=use sine wave, wav=WAV file
-l,--nloops specify number of loops to test, 0 = infinite
-s,--speaker    single speaker test. Values 1=Left, 2=right, etc
-w,--wavfile    Use the given WAV file as a test sound
-W,--wavdir Specify the directory containing WAV files

Recognized sample formats are: S8 S16_LE S16_BE FLOAT_LE S32_LE S32_BE

So to generate a 2 second beep, this worked fine:

speaker-test -c1 -t sine -f 800 -P 2 -p 0.4 -l 1

For a better beep, I generated a 0.25 second beep file in Audacity (Created new audio track, generated 440 Hz tone, amplified it by 11), then copied it onto my Pi - I could then play it with aplay beep.wav. This I then copied to ~/.local, and created this bash script at ~/.local/bin/beep (I ran mkdir ~/.local/bin first):

aplay -q $HOME/.local/beep.wav

I then created these lines in ~/.bash_profile:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc


export PATH

and then I ran the following

chmod +x ~/.local/bin/beep
source ~/.bash_profile

and then I could simply run beep to make a beep noise

  • +1 for the paste and go code sample for a 2 seconds beep with speaker-test speaker-test -c1 -t sine -f 800 -P 2 -p 0.4 -l 1
    – domih
    Sep 11 '17 at 18:45

I was able to get the desired results using a program called softbeep.


I needed to obtain the libncurses5 and libX11 development packages to compile it.

sudo apt-get update
sudo apt-get install libncurses5-dev libX11-dev

After compiling (make), I needed to edit the sb-beep file to (1) point to an available sound file on the pi and (2) play the sound with aplay as opposed to esdplay before installing (make install).

Worked like a charm! Thank you Lennart Poettering (softbeep author).


It's possible to make a shorter sound using:

( speaker-test -t sine -c 2 -s 2 -f 800 & TASK_PID=$! ; sleep 0.09 ; kill -s SIGKILL $TASK_PID ) > /dev/null

This sends a signal after 0.09 s (but longer due to overhead) to stop. The shortest time that gave a sound on my system (Raspbian Stretch on Raspberry Pi 3) was 0.06 s. I redirect all output to /dev/null so it looks like a normal command. See man speaker-test for explanation of the options.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.