8

I've tried the below shell, but nothing happened.

#! /bin/sh 

beep -f 500 -l 700 
beep -f 480 -l 400 
beep -f 470 -l 250 
beep -f 530 -l 300 -D 100 
beep -f 500 -l 300 -D 100 
beep -f 500 -l 300 
beep -f 400 -l 600 
beep -f 300 -l 500 
beep -f 350 -l 700 
beep -f 250  -l 600 

I issued the beep command in terminal, but again nothing happened. What am I doing wrong? Is there something here that I'm missing?


EDIT: Here's the output of sudo modprobe pcspkr -vvv

libkmod: DEBUG ../libkmod/libkmod-module.c:519 kmod_module_new_from_lookup: input alias=pcspkr, normalized=pcspkr
libkmod: DEBUG ../libkmod/libkmod-module.c:525 kmod_module_new_from_lookup: lookup modules.dep pcspkr
libkmod: DEBUG ../libkmod/libkmod.c:542 kmod_search_moddep: use mmaped index 'modules.dep' modname=pcspkr
libkmod: DEBUG ../libkmod/libkmod.c:390 kmod_pool_get_module: get module name='pcspkr' found=(nil)
libkmod: DEBUG ../libkmod/libkmod.c:398 kmod_pool_add_module: add 0xb8adf2b8 key='pcspkr'
libkmod: DEBUG ../libkmod/libkmod-module.c:184 kmod_module_parse_depline: 0 dependencies for pcspkr
libkmod: DEBUG ../libkmod/libkmod-module.c:546 kmod_module_new_from_lookup: lookup pcspkr=0, list=0xb8adf340
libkmod: DEBUG ../libkmod/libkmod-module.c:435 kmod_module_unref: kmod_module 0xb8adf2b8 released
libkmod: DEBUG ../libkmod/libkmod.c:406 kmod_pool_del_module: del 0xb8adf2b8 key='pcspkr'
libkmod: INFO ../libkmod/libkmod.c:319 kmod_unref: context 0xb8adf140 released
5
  • 1
    Well, it might be a number of things. First you should make sure that your computer does indeed have a system speaker, as many modern computers don't have one any more.
    – arnefm
    Jun 11, 2014 at 11:06
  • @arnefm I've attached a headphone to my PC and I can hear music from it. The problem is not from sound card or speaker.
    – Alireza
    Jun 11, 2014 at 11:12
  • 1
    The pc speaker is not your headphone or sound card. It's a little beeper on the motherboard.
    – Leiaz
    Jun 11, 2014 at 12:18
  • @Leiaz, thanks for the input. I cannot hear any beep from motherboard.
    – Alireza
    Jun 11, 2014 at 12:26
  • See askubuntu.com/q/19906/367990 Jan 6, 2017 at 18:19

1 Answer 1

11

The likeliest reason is that the module that manages your motherboard speakers is not loaded. Blacklisting this module is one of the first things I do on a new install and I wouldn't be surprised if you've either done so yourself and forgot about it or if your distribution does it automatically. Anyway, chances are that you can get your beep working if you run

sudo modprobe pcspkr

And then try the beep again.

7
  • No beep sound from speaker.
    – Alireza
    Jun 11, 2014 at 11:45
  • @phpGeek hmm. And the module was loaded correctly? Perhaps it has a different name on your machine.
    – terdon
    Jun 11, 2014 at 11:49
  • I ran it with verbose, you can see the output in the EDIT part.
    – Alireza
    Jun 11, 2014 at 11:55
  • After a while though in another machine it worked as expected by using modprobe pcspkr
    – Alireza
    Oct 13, 2014 at 5:51
  • 1
    @RTF because having my computer beep at me is extremely annoying. Especially when I have speakers connected and the beep can be very loud.
    – terdon
    Jul 13, 2016 at 14:57

You must log in to answer this question.

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