Beep in shell script not working?Getting the PC speaker to beepTerminal bell doesn't ringHow do I enable the...

Why does Arabsat 6A need a Falcon Heavy to launch

In a Spin are Both Wings Stalled?

Why does Kotter return in Welcome Back Kotter

Arrow those variables!

Will google still index a page if I use a $_SESSION variable?

What to put in ESTA if staying in US for a few days before going on to Canada

How do I write bicross product symbols in latex?

How do conventional missiles fly?

SSH "lag" in LAN on some machines, mixed distros

Western buddy movie with a supernatural twist where a woman turns into an eagle at the end

How can I make my BBEG immortal short of making them a Lich or Vampire?

Infinite Abelian subgroup of infinite non Abelian group example

Why are electrically insulating heatsinks so rare? Is it just cost?

Took a trip to a parallel universe, need help deciphering

Is it possible to download Internet Explorer on my Mac running OS X El Capitan?

Today is the Center

UK: Is there precedent for the governments e-petition site changing the direction of a government decision?

How much of data wrangling is a data scientist's job?

Why is Collection not simply treated as Collection<?>

How to say in German "enjoying home comforts"

Is it unprofessional to ask if a job posting on GlassDoor is real?

RG-213 Cable with electric strained wire as metallic shield of Coaxial cable

How to take photos in burst mode, without vibration?

How could indestructible materials be used in power generation?



Beep in shell script not working?


Getting the PC speaker to beepTerminal bell doesn't ringHow do I enable the terminal bell?Internal speaker not workingSystem beep from rc.local-scheduled Python scriptBeep command works but the bell character doesn't(Xubuntu) how to get Terminal to beep so my IRSSI will beep on every private msg?How do I make the 'beep' command work?grant command syntax error near password in shell scriptShell script to function on subfoldersBeep on caps and num lock not workingHow to write shell script to start some programs?beep in Ubuntu 14.04Crontab not running entire script?C shell script last command not workingCan't get a script to run on starting an ec2 ubuntu serverUsing acpi_listen command in a shell script






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







83















I'd like to use a beep sound in a shell script. Unfortunately none of the methods I found via Google work for me.



I tried



echo -e 'a'

echo -ne '07'


and the command beep after I installed it via apt.



What could be the reason?










share|improve this question

























  • See this bug report: bugs.launchpad.net/ubuntu/+source/unity/+bug/769314

    – Flimm
    Dec 2 '14 at 23:58











  • superuser.com/questions/47564/… || unix.stackexchange.com/questions/1974/… || stackoverflow.com/questions/10313939/…

    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Sep 30 '15 at 14:52


















83















I'd like to use a beep sound in a shell script. Unfortunately none of the methods I found via Google work for me.



I tried



echo -e 'a'

echo -ne '07'


and the command beep after I installed it via apt.



What could be the reason?










share|improve this question

























  • See this bug report: bugs.launchpad.net/ubuntu/+source/unity/+bug/769314

    – Flimm
    Dec 2 '14 at 23:58











  • superuser.com/questions/47564/… || unix.stackexchange.com/questions/1974/… || stackoverflow.com/questions/10313939/…

    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Sep 30 '15 at 14:52














83












83








83


41






I'd like to use a beep sound in a shell script. Unfortunately none of the methods I found via Google work for me.



I tried



echo -e 'a'

echo -ne '07'


and the command beep after I installed it via apt.



What could be the reason?










share|improve this question
















I'd like to use a beep sound in a shell script. Unfortunately none of the methods I found via Google work for me.



I tried



echo -e 'a'

echo -ne '07'


and the command beep after I installed it via apt.



What could be the reason?







sound command-line scripts






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 9 '13 at 23:24









Seth

35.1k27112166




35.1k27112166










asked Jan 3 '11 at 20:37









NESNES

14.2k3591115




14.2k3591115













  • See this bug report: bugs.launchpad.net/ubuntu/+source/unity/+bug/769314

    – Flimm
    Dec 2 '14 at 23:58











  • superuser.com/questions/47564/… || unix.stackexchange.com/questions/1974/… || stackoverflow.com/questions/10313939/…

    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Sep 30 '15 at 14:52



















  • See this bug report: bugs.launchpad.net/ubuntu/+source/unity/+bug/769314

    – Flimm
    Dec 2 '14 at 23:58











  • superuser.com/questions/47564/… || unix.stackexchange.com/questions/1974/… || stackoverflow.com/questions/10313939/…

    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Sep 30 '15 at 14:52

















See this bug report: bugs.launchpad.net/ubuntu/+source/unity/+bug/769314

– Flimm
Dec 2 '14 at 23:58





See this bug report: bugs.launchpad.net/ubuntu/+source/unity/+bug/769314

– Flimm
Dec 2 '14 at 23:58













superuser.com/questions/47564/… || unix.stackexchange.com/questions/1974/… || stackoverflow.com/questions/10313939/…

– Ciro Santilli 新疆改造中心 六四事件 法轮功
Sep 30 '15 at 14:52





superuser.com/questions/47564/… || unix.stackexchange.com/questions/1974/… || stackoverflow.com/questions/10313939/…

– Ciro Santilli 新疆改造中心 六四事件 法轮功
Sep 30 '15 at 14:52










10 Answers
10






active

oldest

votes


















90














First run sudo modprobe pcspkr and then beep should work.



The reason this doesn't is because by default Ubuntu no longer loads the hardware driver that produce beeps.



If this works for you then to enable the loading of pcspkr permanently edit the /etc/modprobe.d/blacklist.conf file (using gksudo gedit perhaps) and comment out line that says blacklist pcspkr so it looks like this:



# ugly and loud noise, getting on everyone's nerves; this should be done by a
# nice pulseaudio bing (Ubuntu: #77010)
# blacklist pcspkr





share|improve this answer





















  • 3





    If I comment blacklist pcspkr I have to do modprobe -r pcspkr && modprobe pcspkr to get it to work. Also getting beep to work is not the same as getting the audible bell to work and thus askubuntu.com/questions/22168/how-do-i-enable-the-terminal-bell should still be open.

    – daithib8
    Jul 28 '11 at 11:37






  • 2





    This doesn't work for me in Ubuntu 14.

    – Cerin
    Apr 4 '16 at 23:41



















85














Not being a fan of the pcspkr beep, I use a beep from one of the system sounds with the installed pulseaudio server's paplay command.



First find a sound you like (you can browse /usr/share/sounds for some available ones for example) and create a reference to it



export BEEP=/usr/share/sounds/ubuntu/ringtones/Harmonics.ogg


Then have it available as a command



alias beep='paplay $BEEP'


Now just run beep whenever you need it. For example, to alert you when a command is finished:



find . | grep treasure ; beep





share|improve this answer





















  • 1





    Can you get it to play this sound when someone runs echo -e 'a'

    – Flimm
    Dec 2 '14 at 23:22











  • You might need some read command in a while loop or some other library that can monitore keystrokes.

    – yuvilio
    Dec 11 '14 at 1:12








  • 2





    This is a great solution! Now I can do run-my-long-test-suite.sh; beep and read stackoverflow until the system is ready.

    – jamesc
    Mar 30 '15 at 10:17






  • 3





    Nice! I use export BEEP=/usr/share/sounds/ubuntu/stereo/dialog-information.ogg and alias beep='paplay $BEEP --volume=32768' now, that works well for me. (Note that you can override the volume with the beep alias, e.g. beep --volume=15000 plays at volume of -12dB.)

    – leftaroundabout
    Dec 6 '15 at 12:57








  • 2





    Playing these ogg files can result in latency orders of magnitude greater than that of the internal PC speaker beep. Not only that the latency seems highly variable. I acknowledge that most people don't care but when you need real time or near real time responsiveness the PC speaker is probably the best option for audible feedback.

    – H2ONaCl
    Feb 21 '18 at 19:59





















21














To fix this problem persistently:




  • Run gconf-editor and if the desktop | gnome | peripherals | keyboard | bell_mode setting is present then change it from off to on

  • Run dconf-editor and if the org | gnome | settings-daemon | peripherals | keyboard | bell-mode setting is present then change it from off to on

  • Add pactl upload-sample /usr/share/sounds/gnome/default/alerts/glass.ogg bell.ogg to the file ~/.xprofile (you need gnome-control-center-data for glass.ogg)

  • Add [ "$DISPLAY" ] && xset b 100 to the file ~/.bashrc


The simplest way to activate this solution is to reboot.



Further, to implement this solution immediately for a terminal window that is already open, run the pactl command and run the xset command in the terminal window in question.






share|improve this answer


























  • I put the pactl upload-sample command in a shell script, but your method is more organized. Thanks!

    – JoBu1324
    Dec 12 '12 at 16:54











  • If you put the pactl command in ~/.xprofile it gets executed at the start of the GUI session.

    – jdthood
    Dec 12 '12 at 18:32











  • The dconf-editor version of the bell-mode setting seems to be org.gnome.settings-daemon.peripherals.keyboard.

    – lgarzo
    Jun 21 '13 at 8:59











  • @lgarzo: Thanks for the tip. I will update the answer.

    – jdthood
    Jun 21 '13 at 9:22






  • 1





    @Hibou57: Make sure you have the package containing glass.ogg installed

    – Janus Troelsen
    Nov 16 '14 at 13:44



















21














Since this is a very high rated question on google, I'll add the steps I did to re-enable beep in both console and X11:





For the Linux Console (CTRL+ALT+F1...F6):



Why it does not work by default



As already answered, the pcspkr kernel driver for the PC Speaker is blacklisted in Ubuntu.



Temporarily enable until reboot:



sudo modprobe pcspkr


Automatically enable on boot:



sudo nano /etc/modprobe.d/blacklist.conf


(delete or comment pcspkr line by prepending it with #)





For X11 terminals (such as the default gnome-terminal)



Why it does not work by default



Under X, like when using Unity, KDE, Gnome Shell, the beep events are captured by PulseAudio thanks to module-x11-bell, which is loaded by default at /usr/bin/start-pulseaudio-x11. And the sound sample PulseAudio plays on beep, bell.ogg, is blank by default. Additionally, the bell volume may be muted.



To temporarily enable for current session,



xset b 100  # perhaps not needed, on my system it was 40 by default
pactl upload-sample /usr/share/sounds/ubuntu/stereo/bell.ogg bell.ogg


There are other suitable samples you can try at /usr/share/sounds, for example check the ones at /usr/share/sounds/gnome/default/alerts/



Note that the beep program is not really necessary. But if installed, it uses the PC Speaker. It was the only way I could find to enable the buzzer under X:



sudo apt-get install beep


To automatically enable on boot, just add the above lines in your ~/.profile, or system-wide at /etc/profile





To test it:



printf 'a'


Beep!



beep


Buzz!






share|improve this answer


























  • To automatically enable a pc speaker beep on boot you have to actually comment said line in /etc/modprobe.d/blacklist.conf not uncomment it (you want to disable blacklisting, not the other way around).

    – z33k
    Sep 16 '16 at 11:18








  • 1





    both solutions work on Ubuntu 16.04 Note: pcspkr and bell.ogg are independent approaches. beep tries to beep using various approaches e.g., ioctl(console_fd, KIOCSOUND, period) use pcspkr (the sound is coming from PC speaker on the motherboard) while printf 'a' -based method may work without it using only bell.ogg (the sound is from ordinary speakers). The second method might not work until pulseaudio service is started and/or xset b on is run

    – jfs
    Oct 13 '16 at 0:43











  • The pactl upload-sample ... was golden for me. What's the way to permanently configure the sample loading again?

    – ulidtko
    Nov 29 '16 at 22:15











  • @ulidtko: Just add those lines lines in your ~/.profile, or system-wide at /etc/profile

    – MestreLion
    Feb 6 '17 at 15:40











  • @MestreLion wrong. load-sample bell.ogg /usr/share/sounds/ubuntu/stereo/bell.ogg in /etc/pulseaudio/default.pa.

    – ulidtko
    Feb 7 '17 at 10:19



















13














I've encountered this problem before. From what I remember, the problem is that the terminal bell tries to ring an internal computer speaker (as in an old-school desktop) but laptops and some newer computers are missing such a thing.



The only solution I found at the time was to sudo apt-get install sox and



play -n synth <duration in seconds> sine <freq in Hz> vol <volume (0-1)>


e.g.



 play -n synth 0.1 sine 880 vol 0.5





share|improve this answer


























  • try my solution - I'd love to know if it works for you!

    – JoBu1324
    Dec 11 '12 at 23:10











  • you may use speaker-test for this too

    – Janus Troelsen
    Jun 11 '14 at 9:05






  • 1





    You can also have a nice guitar pluck tone: play -q -n synth 2 pluck C5. C5 is the note.

    – Pablo Bianchi
    Jul 1 '18 at 5:40



















2














If you have actual speakers connected to the computer and you're not getting a beep it's likely because you are using compiz. Compiz is relying on pulseaudio catching the beeps and playing them while metacity bypasses the usual setup and uses libcanberra to play a beep sound. If it works with metacity and not compiz that is your problem, otherwise the answer htorque gave is corrent.






share|improve this answer































    2














    As far as I can tell, this is a bug: System beep broken in Karmic despite heroic efforts to fix it.






    share|improve this answer





















    • 3





      "Not enabled by default" does not mean broken, and no "heroic effort" is needed: just modprobe pcsprk (in console) or pactl upload-sample ... in X11 and the annoying beep is back :)

      – MestreLion
      Feb 19 '15 at 11:03



















    2














    I finally found a solution, which doesn't require alsamixer to have a PC Beep option. I think I remember all my changes:



    uncomment the following in /etc/pulse/default.pa:



    load-sample-lazy x11-bell /usr/share/sounds/ubuntu/stereo/bell.ogg
    load-module module-x11-bell sample=bell-windowing-system


    per this bug, run pactl upload-sample /usr/share/sounds/ubuntu/stereo/bell.ogg bell.ogg






    share|improve this answer


























    • Tried this, pactl gave me Connection failure: Connection refused pa_context_connect() failed: Connection refused.

      – YodaDaCoda
      Dec 11 '12 at 23:33













    • Maybe this thread will help - if you've ever run pulseaudio as root.

      – JoBu1324
      Dec 11 '12 at 23:49











    • I'm having a different problem, actually. Pulseaudio throws Failed to open module "module-esound-protocol-unix": file not found. Probably not worth discussing here since I'm running 13.04, though I would love to be able to verify your solution.

      – YodaDaCoda
      Dec 12 '12 at 0:05











    • Nice, just slightly different lines for 15.04.

      – VRR
      Sep 12 '15 at 11:09



















    2














    "Beep only works if your PC has a 'speaker'. Many modern laptops / small devices don't have one".



    Try playing a sound like this: play xxxxx.wav I found a nice wav file that seems to be short and sweet, but you can pick your own as well. Works for me when all else failed.





    Thanks to: tredegar & hk_centos






    share|improve this answer

































      0














      An alternative approach - set your xterm / console to "Visual Bell" so that when it would beep, the window simply inverts its colours for a short time.



      I have a bash function called beep to get my attention once a command is finished.



      beep ()  { while true; do  echo -en 'a'; sleep 1; done }


      And it is used this way



      longrun-command ; beep





      share|improve this answer
























        Your Answer








        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "89"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f19906%2fbeep-in-shell-script-not-working%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        10 Answers
        10






        active

        oldest

        votes








        10 Answers
        10






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        90














        First run sudo modprobe pcspkr and then beep should work.



        The reason this doesn't is because by default Ubuntu no longer loads the hardware driver that produce beeps.



        If this works for you then to enable the loading of pcspkr permanently edit the /etc/modprobe.d/blacklist.conf file (using gksudo gedit perhaps) and comment out line that says blacklist pcspkr so it looks like this:



        # ugly and loud noise, getting on everyone's nerves; this should be done by a
        # nice pulseaudio bing (Ubuntu: #77010)
        # blacklist pcspkr





        share|improve this answer





















        • 3





          If I comment blacklist pcspkr I have to do modprobe -r pcspkr && modprobe pcspkr to get it to work. Also getting beep to work is not the same as getting the audible bell to work and thus askubuntu.com/questions/22168/how-do-i-enable-the-terminal-bell should still be open.

          – daithib8
          Jul 28 '11 at 11:37






        • 2





          This doesn't work for me in Ubuntu 14.

          – Cerin
          Apr 4 '16 at 23:41
















        90














        First run sudo modprobe pcspkr and then beep should work.



        The reason this doesn't is because by default Ubuntu no longer loads the hardware driver that produce beeps.



        If this works for you then to enable the loading of pcspkr permanently edit the /etc/modprobe.d/blacklist.conf file (using gksudo gedit perhaps) and comment out line that says blacklist pcspkr so it looks like this:



        # ugly and loud noise, getting on everyone's nerves; this should be done by a
        # nice pulseaudio bing (Ubuntu: #77010)
        # blacklist pcspkr





        share|improve this answer





















        • 3





          If I comment blacklist pcspkr I have to do modprobe -r pcspkr && modprobe pcspkr to get it to work. Also getting beep to work is not the same as getting the audible bell to work and thus askubuntu.com/questions/22168/how-do-i-enable-the-terminal-bell should still be open.

          – daithib8
          Jul 28 '11 at 11:37






        • 2





          This doesn't work for me in Ubuntu 14.

          – Cerin
          Apr 4 '16 at 23:41














        90












        90








        90







        First run sudo modprobe pcspkr and then beep should work.



        The reason this doesn't is because by default Ubuntu no longer loads the hardware driver that produce beeps.



        If this works for you then to enable the loading of pcspkr permanently edit the /etc/modprobe.d/blacklist.conf file (using gksudo gedit perhaps) and comment out line that says blacklist pcspkr so it looks like this:



        # ugly and loud noise, getting on everyone's nerves; this should be done by a
        # nice pulseaudio bing (Ubuntu: #77010)
        # blacklist pcspkr





        share|improve this answer















        First run sudo modprobe pcspkr and then beep should work.



        The reason this doesn't is because by default Ubuntu no longer loads the hardware driver that produce beeps.



        If this works for you then to enable the loading of pcspkr permanently edit the /etc/modprobe.d/blacklist.conf file (using gksudo gedit perhaps) and comment out line that says blacklist pcspkr so it looks like this:



        # ugly and loud noise, getting on everyone's nerves; this should be done by a
        # nice pulseaudio bing (Ubuntu: #77010)
        # blacklist pcspkr






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 3 '11 at 21:06

























        answered Jan 3 '11 at 20:44









        81288128

        24.9k22101138




        24.9k22101138








        • 3





          If I comment blacklist pcspkr I have to do modprobe -r pcspkr && modprobe pcspkr to get it to work. Also getting beep to work is not the same as getting the audible bell to work and thus askubuntu.com/questions/22168/how-do-i-enable-the-terminal-bell should still be open.

          – daithib8
          Jul 28 '11 at 11:37






        • 2





          This doesn't work for me in Ubuntu 14.

          – Cerin
          Apr 4 '16 at 23:41














        • 3





          If I comment blacklist pcspkr I have to do modprobe -r pcspkr && modprobe pcspkr to get it to work. Also getting beep to work is not the same as getting the audible bell to work and thus askubuntu.com/questions/22168/how-do-i-enable-the-terminal-bell should still be open.

          – daithib8
          Jul 28 '11 at 11:37






        • 2





          This doesn't work for me in Ubuntu 14.

          – Cerin
          Apr 4 '16 at 23:41








        3




        3





        If I comment blacklist pcspkr I have to do modprobe -r pcspkr && modprobe pcspkr to get it to work. Also getting beep to work is not the same as getting the audible bell to work and thus askubuntu.com/questions/22168/how-do-i-enable-the-terminal-bell should still be open.

        – daithib8
        Jul 28 '11 at 11:37





        If I comment blacklist pcspkr I have to do modprobe -r pcspkr && modprobe pcspkr to get it to work. Also getting beep to work is not the same as getting the audible bell to work and thus askubuntu.com/questions/22168/how-do-i-enable-the-terminal-bell should still be open.

        – daithib8
        Jul 28 '11 at 11:37




        2




        2





        This doesn't work for me in Ubuntu 14.

        – Cerin
        Apr 4 '16 at 23:41





        This doesn't work for me in Ubuntu 14.

        – Cerin
        Apr 4 '16 at 23:41













        85














        Not being a fan of the pcspkr beep, I use a beep from one of the system sounds with the installed pulseaudio server's paplay command.



        First find a sound you like (you can browse /usr/share/sounds for some available ones for example) and create a reference to it



        export BEEP=/usr/share/sounds/ubuntu/ringtones/Harmonics.ogg


        Then have it available as a command



        alias beep='paplay $BEEP'


        Now just run beep whenever you need it. For example, to alert you when a command is finished:



        find . | grep treasure ; beep





        share|improve this answer





















        • 1





          Can you get it to play this sound when someone runs echo -e 'a'

          – Flimm
          Dec 2 '14 at 23:22











        • You might need some read command in a while loop or some other library that can monitore keystrokes.

          – yuvilio
          Dec 11 '14 at 1:12








        • 2





          This is a great solution! Now I can do run-my-long-test-suite.sh; beep and read stackoverflow until the system is ready.

          – jamesc
          Mar 30 '15 at 10:17






        • 3





          Nice! I use export BEEP=/usr/share/sounds/ubuntu/stereo/dialog-information.ogg and alias beep='paplay $BEEP --volume=32768' now, that works well for me. (Note that you can override the volume with the beep alias, e.g. beep --volume=15000 plays at volume of -12dB.)

          – leftaroundabout
          Dec 6 '15 at 12:57








        • 2





          Playing these ogg files can result in latency orders of magnitude greater than that of the internal PC speaker beep. Not only that the latency seems highly variable. I acknowledge that most people don't care but when you need real time or near real time responsiveness the PC speaker is probably the best option for audible feedback.

          – H2ONaCl
          Feb 21 '18 at 19:59


















        85














        Not being a fan of the pcspkr beep, I use a beep from one of the system sounds with the installed pulseaudio server's paplay command.



        First find a sound you like (you can browse /usr/share/sounds for some available ones for example) and create a reference to it



        export BEEP=/usr/share/sounds/ubuntu/ringtones/Harmonics.ogg


        Then have it available as a command



        alias beep='paplay $BEEP'


        Now just run beep whenever you need it. For example, to alert you when a command is finished:



        find . | grep treasure ; beep





        share|improve this answer





















        • 1





          Can you get it to play this sound when someone runs echo -e 'a'

          – Flimm
          Dec 2 '14 at 23:22











        • You might need some read command in a while loop or some other library that can monitore keystrokes.

          – yuvilio
          Dec 11 '14 at 1:12








        • 2





          This is a great solution! Now I can do run-my-long-test-suite.sh; beep and read stackoverflow until the system is ready.

          – jamesc
          Mar 30 '15 at 10:17






        • 3





          Nice! I use export BEEP=/usr/share/sounds/ubuntu/stereo/dialog-information.ogg and alias beep='paplay $BEEP --volume=32768' now, that works well for me. (Note that you can override the volume with the beep alias, e.g. beep --volume=15000 plays at volume of -12dB.)

          – leftaroundabout
          Dec 6 '15 at 12:57








        • 2





          Playing these ogg files can result in latency orders of magnitude greater than that of the internal PC speaker beep. Not only that the latency seems highly variable. I acknowledge that most people don't care but when you need real time or near real time responsiveness the PC speaker is probably the best option for audible feedback.

          – H2ONaCl
          Feb 21 '18 at 19:59
















        85












        85








        85







        Not being a fan of the pcspkr beep, I use a beep from one of the system sounds with the installed pulseaudio server's paplay command.



        First find a sound you like (you can browse /usr/share/sounds for some available ones for example) and create a reference to it



        export BEEP=/usr/share/sounds/ubuntu/ringtones/Harmonics.ogg


        Then have it available as a command



        alias beep='paplay $BEEP'


        Now just run beep whenever you need it. For example, to alert you when a command is finished:



        find . | grep treasure ; beep





        share|improve this answer















        Not being a fan of the pcspkr beep, I use a beep from one of the system sounds with the installed pulseaudio server's paplay command.



        First find a sound you like (you can browse /usr/share/sounds for some available ones for example) and create a reference to it



        export BEEP=/usr/share/sounds/ubuntu/ringtones/Harmonics.ogg


        Then have it available as a command



        alias beep='paplay $BEEP'


        Now just run beep whenever you need it. For example, to alert you when a command is finished:



        find . | grep treasure ; beep






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 3 '15 at 15:59

























        answered Jul 27 '12 at 0:28









        yuvilioyuvilio

        2,55611921




        2,55611921








        • 1





          Can you get it to play this sound when someone runs echo -e 'a'

          – Flimm
          Dec 2 '14 at 23:22











        • You might need some read command in a while loop or some other library that can monitore keystrokes.

          – yuvilio
          Dec 11 '14 at 1:12








        • 2





          This is a great solution! Now I can do run-my-long-test-suite.sh; beep and read stackoverflow until the system is ready.

          – jamesc
          Mar 30 '15 at 10:17






        • 3





          Nice! I use export BEEP=/usr/share/sounds/ubuntu/stereo/dialog-information.ogg and alias beep='paplay $BEEP --volume=32768' now, that works well for me. (Note that you can override the volume with the beep alias, e.g. beep --volume=15000 plays at volume of -12dB.)

          – leftaroundabout
          Dec 6 '15 at 12:57








        • 2





          Playing these ogg files can result in latency orders of magnitude greater than that of the internal PC speaker beep. Not only that the latency seems highly variable. I acknowledge that most people don't care but when you need real time or near real time responsiveness the PC speaker is probably the best option for audible feedback.

          – H2ONaCl
          Feb 21 '18 at 19:59
















        • 1





          Can you get it to play this sound when someone runs echo -e 'a'

          – Flimm
          Dec 2 '14 at 23:22











        • You might need some read command in a while loop or some other library that can monitore keystrokes.

          – yuvilio
          Dec 11 '14 at 1:12








        • 2





          This is a great solution! Now I can do run-my-long-test-suite.sh; beep and read stackoverflow until the system is ready.

          – jamesc
          Mar 30 '15 at 10:17






        • 3





          Nice! I use export BEEP=/usr/share/sounds/ubuntu/stereo/dialog-information.ogg and alias beep='paplay $BEEP --volume=32768' now, that works well for me. (Note that you can override the volume with the beep alias, e.g. beep --volume=15000 plays at volume of -12dB.)

          – leftaroundabout
          Dec 6 '15 at 12:57








        • 2





          Playing these ogg files can result in latency orders of magnitude greater than that of the internal PC speaker beep. Not only that the latency seems highly variable. I acknowledge that most people don't care but when you need real time or near real time responsiveness the PC speaker is probably the best option for audible feedback.

          – H2ONaCl
          Feb 21 '18 at 19:59










        1




        1





        Can you get it to play this sound when someone runs echo -e 'a'

        – Flimm
        Dec 2 '14 at 23:22





        Can you get it to play this sound when someone runs echo -e 'a'

        – Flimm
        Dec 2 '14 at 23:22













        You might need some read command in a while loop or some other library that can monitore keystrokes.

        – yuvilio
        Dec 11 '14 at 1:12







        You might need some read command in a while loop or some other library that can monitore keystrokes.

        – yuvilio
        Dec 11 '14 at 1:12






        2




        2





        This is a great solution! Now I can do run-my-long-test-suite.sh; beep and read stackoverflow until the system is ready.

        – jamesc
        Mar 30 '15 at 10:17





        This is a great solution! Now I can do run-my-long-test-suite.sh; beep and read stackoverflow until the system is ready.

        – jamesc
        Mar 30 '15 at 10:17




        3




        3





        Nice! I use export BEEP=/usr/share/sounds/ubuntu/stereo/dialog-information.ogg and alias beep='paplay $BEEP --volume=32768' now, that works well for me. (Note that you can override the volume with the beep alias, e.g. beep --volume=15000 plays at volume of -12dB.)

        – leftaroundabout
        Dec 6 '15 at 12:57







        Nice! I use export BEEP=/usr/share/sounds/ubuntu/stereo/dialog-information.ogg and alias beep='paplay $BEEP --volume=32768' now, that works well for me. (Note that you can override the volume with the beep alias, e.g. beep --volume=15000 plays at volume of -12dB.)

        – leftaroundabout
        Dec 6 '15 at 12:57






        2




        2





        Playing these ogg files can result in latency orders of magnitude greater than that of the internal PC speaker beep. Not only that the latency seems highly variable. I acknowledge that most people don't care but when you need real time or near real time responsiveness the PC speaker is probably the best option for audible feedback.

        – H2ONaCl
        Feb 21 '18 at 19:59







        Playing these ogg files can result in latency orders of magnitude greater than that of the internal PC speaker beep. Not only that the latency seems highly variable. I acknowledge that most people don't care but when you need real time or near real time responsiveness the PC speaker is probably the best option for audible feedback.

        – H2ONaCl
        Feb 21 '18 at 19:59













        21














        To fix this problem persistently:




        • Run gconf-editor and if the desktop | gnome | peripherals | keyboard | bell_mode setting is present then change it from off to on

        • Run dconf-editor and if the org | gnome | settings-daemon | peripherals | keyboard | bell-mode setting is present then change it from off to on

        • Add pactl upload-sample /usr/share/sounds/gnome/default/alerts/glass.ogg bell.ogg to the file ~/.xprofile (you need gnome-control-center-data for glass.ogg)

        • Add [ "$DISPLAY" ] && xset b 100 to the file ~/.bashrc


        The simplest way to activate this solution is to reboot.



        Further, to implement this solution immediately for a terminal window that is already open, run the pactl command and run the xset command in the terminal window in question.






        share|improve this answer


























        • I put the pactl upload-sample command in a shell script, but your method is more organized. Thanks!

          – JoBu1324
          Dec 12 '12 at 16:54











        • If you put the pactl command in ~/.xprofile it gets executed at the start of the GUI session.

          – jdthood
          Dec 12 '12 at 18:32











        • The dconf-editor version of the bell-mode setting seems to be org.gnome.settings-daemon.peripherals.keyboard.

          – lgarzo
          Jun 21 '13 at 8:59











        • @lgarzo: Thanks for the tip. I will update the answer.

          – jdthood
          Jun 21 '13 at 9:22






        • 1





          @Hibou57: Make sure you have the package containing glass.ogg installed

          – Janus Troelsen
          Nov 16 '14 at 13:44
















        21














        To fix this problem persistently:




        • Run gconf-editor and if the desktop | gnome | peripherals | keyboard | bell_mode setting is present then change it from off to on

        • Run dconf-editor and if the org | gnome | settings-daemon | peripherals | keyboard | bell-mode setting is present then change it from off to on

        • Add pactl upload-sample /usr/share/sounds/gnome/default/alerts/glass.ogg bell.ogg to the file ~/.xprofile (you need gnome-control-center-data for glass.ogg)

        • Add [ "$DISPLAY" ] && xset b 100 to the file ~/.bashrc


        The simplest way to activate this solution is to reboot.



        Further, to implement this solution immediately for a terminal window that is already open, run the pactl command and run the xset command in the terminal window in question.






        share|improve this answer


























        • I put the pactl upload-sample command in a shell script, but your method is more organized. Thanks!

          – JoBu1324
          Dec 12 '12 at 16:54











        • If you put the pactl command in ~/.xprofile it gets executed at the start of the GUI session.

          – jdthood
          Dec 12 '12 at 18:32











        • The dconf-editor version of the bell-mode setting seems to be org.gnome.settings-daemon.peripherals.keyboard.

          – lgarzo
          Jun 21 '13 at 8:59











        • @lgarzo: Thanks for the tip. I will update the answer.

          – jdthood
          Jun 21 '13 at 9:22






        • 1





          @Hibou57: Make sure you have the package containing glass.ogg installed

          – Janus Troelsen
          Nov 16 '14 at 13:44














        21












        21








        21







        To fix this problem persistently:




        • Run gconf-editor and if the desktop | gnome | peripherals | keyboard | bell_mode setting is present then change it from off to on

        • Run dconf-editor and if the org | gnome | settings-daemon | peripherals | keyboard | bell-mode setting is present then change it from off to on

        • Add pactl upload-sample /usr/share/sounds/gnome/default/alerts/glass.ogg bell.ogg to the file ~/.xprofile (you need gnome-control-center-data for glass.ogg)

        • Add [ "$DISPLAY" ] && xset b 100 to the file ~/.bashrc


        The simplest way to activate this solution is to reboot.



        Further, to implement this solution immediately for a terminal window that is already open, run the pactl command and run the xset command in the terminal window in question.






        share|improve this answer















        To fix this problem persistently:




        • Run gconf-editor and if the desktop | gnome | peripherals | keyboard | bell_mode setting is present then change it from off to on

        • Run dconf-editor and if the org | gnome | settings-daemon | peripherals | keyboard | bell-mode setting is present then change it from off to on

        • Add pactl upload-sample /usr/share/sounds/gnome/default/alerts/glass.ogg bell.ogg to the file ~/.xprofile (you need gnome-control-center-data for glass.ogg)

        • Add [ "$DISPLAY" ] && xset b 100 to the file ~/.bashrc


        The simplest way to activate this solution is to reboot.



        Further, to implement this solution immediately for a terminal window that is already open, run the pactl command and run the xset command in the terminal window in question.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 16 '14 at 15:29









        Janus Troelsen

        2,1731620




        2,1731620










        answered Dec 12 '12 at 12:33









        jdthoodjdthood

        10.5k24163




        10.5k24163













        • I put the pactl upload-sample command in a shell script, but your method is more organized. Thanks!

          – JoBu1324
          Dec 12 '12 at 16:54











        • If you put the pactl command in ~/.xprofile it gets executed at the start of the GUI session.

          – jdthood
          Dec 12 '12 at 18:32











        • The dconf-editor version of the bell-mode setting seems to be org.gnome.settings-daemon.peripherals.keyboard.

          – lgarzo
          Jun 21 '13 at 8:59











        • @lgarzo: Thanks for the tip. I will update the answer.

          – jdthood
          Jun 21 '13 at 9:22






        • 1





          @Hibou57: Make sure you have the package containing glass.ogg installed

          – Janus Troelsen
          Nov 16 '14 at 13:44



















        • I put the pactl upload-sample command in a shell script, but your method is more organized. Thanks!

          – JoBu1324
          Dec 12 '12 at 16:54











        • If you put the pactl command in ~/.xprofile it gets executed at the start of the GUI session.

          – jdthood
          Dec 12 '12 at 18:32











        • The dconf-editor version of the bell-mode setting seems to be org.gnome.settings-daemon.peripherals.keyboard.

          – lgarzo
          Jun 21 '13 at 8:59











        • @lgarzo: Thanks for the tip. I will update the answer.

          – jdthood
          Jun 21 '13 at 9:22






        • 1





          @Hibou57: Make sure you have the package containing glass.ogg installed

          – Janus Troelsen
          Nov 16 '14 at 13:44

















        I put the pactl upload-sample command in a shell script, but your method is more organized. Thanks!

        – JoBu1324
        Dec 12 '12 at 16:54





        I put the pactl upload-sample command in a shell script, but your method is more organized. Thanks!

        – JoBu1324
        Dec 12 '12 at 16:54













        If you put the pactl command in ~/.xprofile it gets executed at the start of the GUI session.

        – jdthood
        Dec 12 '12 at 18:32





        If you put the pactl command in ~/.xprofile it gets executed at the start of the GUI session.

        – jdthood
        Dec 12 '12 at 18:32













        The dconf-editor version of the bell-mode setting seems to be org.gnome.settings-daemon.peripherals.keyboard.

        – lgarzo
        Jun 21 '13 at 8:59





        The dconf-editor version of the bell-mode setting seems to be org.gnome.settings-daemon.peripherals.keyboard.

        – lgarzo
        Jun 21 '13 at 8:59













        @lgarzo: Thanks for the tip. I will update the answer.

        – jdthood
        Jun 21 '13 at 9:22





        @lgarzo: Thanks for the tip. I will update the answer.

        – jdthood
        Jun 21 '13 at 9:22




        1




        1





        @Hibou57: Make sure you have the package containing glass.ogg installed

        – Janus Troelsen
        Nov 16 '14 at 13:44





        @Hibou57: Make sure you have the package containing glass.ogg installed

        – Janus Troelsen
        Nov 16 '14 at 13:44











        21














        Since this is a very high rated question on google, I'll add the steps I did to re-enable beep in both console and X11:





        For the Linux Console (CTRL+ALT+F1...F6):



        Why it does not work by default



        As already answered, the pcspkr kernel driver for the PC Speaker is blacklisted in Ubuntu.



        Temporarily enable until reboot:



        sudo modprobe pcspkr


        Automatically enable on boot:



        sudo nano /etc/modprobe.d/blacklist.conf


        (delete or comment pcspkr line by prepending it with #)





        For X11 terminals (such as the default gnome-terminal)



        Why it does not work by default



        Under X, like when using Unity, KDE, Gnome Shell, the beep events are captured by PulseAudio thanks to module-x11-bell, which is loaded by default at /usr/bin/start-pulseaudio-x11. And the sound sample PulseAudio plays on beep, bell.ogg, is blank by default. Additionally, the bell volume may be muted.



        To temporarily enable for current session,



        xset b 100  # perhaps not needed, on my system it was 40 by default
        pactl upload-sample /usr/share/sounds/ubuntu/stereo/bell.ogg bell.ogg


        There are other suitable samples you can try at /usr/share/sounds, for example check the ones at /usr/share/sounds/gnome/default/alerts/



        Note that the beep program is not really necessary. But if installed, it uses the PC Speaker. It was the only way I could find to enable the buzzer under X:



        sudo apt-get install beep


        To automatically enable on boot, just add the above lines in your ~/.profile, or system-wide at /etc/profile





        To test it:



        printf 'a'


        Beep!



        beep


        Buzz!






        share|improve this answer


























        • To automatically enable a pc speaker beep on boot you have to actually comment said line in /etc/modprobe.d/blacklist.conf not uncomment it (you want to disable blacklisting, not the other way around).

          – z33k
          Sep 16 '16 at 11:18








        • 1





          both solutions work on Ubuntu 16.04 Note: pcspkr and bell.ogg are independent approaches. beep tries to beep using various approaches e.g., ioctl(console_fd, KIOCSOUND, period) use pcspkr (the sound is coming from PC speaker on the motherboard) while printf 'a' -based method may work without it using only bell.ogg (the sound is from ordinary speakers). The second method might not work until pulseaudio service is started and/or xset b on is run

          – jfs
          Oct 13 '16 at 0:43











        • The pactl upload-sample ... was golden for me. What's the way to permanently configure the sample loading again?

          – ulidtko
          Nov 29 '16 at 22:15











        • @ulidtko: Just add those lines lines in your ~/.profile, or system-wide at /etc/profile

          – MestreLion
          Feb 6 '17 at 15:40











        • @MestreLion wrong. load-sample bell.ogg /usr/share/sounds/ubuntu/stereo/bell.ogg in /etc/pulseaudio/default.pa.

          – ulidtko
          Feb 7 '17 at 10:19
















        21














        Since this is a very high rated question on google, I'll add the steps I did to re-enable beep in both console and X11:





        For the Linux Console (CTRL+ALT+F1...F6):



        Why it does not work by default



        As already answered, the pcspkr kernel driver for the PC Speaker is blacklisted in Ubuntu.



        Temporarily enable until reboot:



        sudo modprobe pcspkr


        Automatically enable on boot:



        sudo nano /etc/modprobe.d/blacklist.conf


        (delete or comment pcspkr line by prepending it with #)





        For X11 terminals (such as the default gnome-terminal)



        Why it does not work by default



        Under X, like when using Unity, KDE, Gnome Shell, the beep events are captured by PulseAudio thanks to module-x11-bell, which is loaded by default at /usr/bin/start-pulseaudio-x11. And the sound sample PulseAudio plays on beep, bell.ogg, is blank by default. Additionally, the bell volume may be muted.



        To temporarily enable for current session,



        xset b 100  # perhaps not needed, on my system it was 40 by default
        pactl upload-sample /usr/share/sounds/ubuntu/stereo/bell.ogg bell.ogg


        There are other suitable samples you can try at /usr/share/sounds, for example check the ones at /usr/share/sounds/gnome/default/alerts/



        Note that the beep program is not really necessary. But if installed, it uses the PC Speaker. It was the only way I could find to enable the buzzer under X:



        sudo apt-get install beep


        To automatically enable on boot, just add the above lines in your ~/.profile, or system-wide at /etc/profile





        To test it:



        printf 'a'


        Beep!



        beep


        Buzz!






        share|improve this answer


























        • To automatically enable a pc speaker beep on boot you have to actually comment said line in /etc/modprobe.d/blacklist.conf not uncomment it (you want to disable blacklisting, not the other way around).

          – z33k
          Sep 16 '16 at 11:18








        • 1





          both solutions work on Ubuntu 16.04 Note: pcspkr and bell.ogg are independent approaches. beep tries to beep using various approaches e.g., ioctl(console_fd, KIOCSOUND, period) use pcspkr (the sound is coming from PC speaker on the motherboard) while printf 'a' -based method may work without it using only bell.ogg (the sound is from ordinary speakers). The second method might not work until pulseaudio service is started and/or xset b on is run

          – jfs
          Oct 13 '16 at 0:43











        • The pactl upload-sample ... was golden for me. What's the way to permanently configure the sample loading again?

          – ulidtko
          Nov 29 '16 at 22:15











        • @ulidtko: Just add those lines lines in your ~/.profile, or system-wide at /etc/profile

          – MestreLion
          Feb 6 '17 at 15:40











        • @MestreLion wrong. load-sample bell.ogg /usr/share/sounds/ubuntu/stereo/bell.ogg in /etc/pulseaudio/default.pa.

          – ulidtko
          Feb 7 '17 at 10:19














        21












        21








        21







        Since this is a very high rated question on google, I'll add the steps I did to re-enable beep in both console and X11:





        For the Linux Console (CTRL+ALT+F1...F6):



        Why it does not work by default



        As already answered, the pcspkr kernel driver for the PC Speaker is blacklisted in Ubuntu.



        Temporarily enable until reboot:



        sudo modprobe pcspkr


        Automatically enable on boot:



        sudo nano /etc/modprobe.d/blacklist.conf


        (delete or comment pcspkr line by prepending it with #)





        For X11 terminals (such as the default gnome-terminal)



        Why it does not work by default



        Under X, like when using Unity, KDE, Gnome Shell, the beep events are captured by PulseAudio thanks to module-x11-bell, which is loaded by default at /usr/bin/start-pulseaudio-x11. And the sound sample PulseAudio plays on beep, bell.ogg, is blank by default. Additionally, the bell volume may be muted.



        To temporarily enable for current session,



        xset b 100  # perhaps not needed, on my system it was 40 by default
        pactl upload-sample /usr/share/sounds/ubuntu/stereo/bell.ogg bell.ogg


        There are other suitable samples you can try at /usr/share/sounds, for example check the ones at /usr/share/sounds/gnome/default/alerts/



        Note that the beep program is not really necessary. But if installed, it uses the PC Speaker. It was the only way I could find to enable the buzzer under X:



        sudo apt-get install beep


        To automatically enable on boot, just add the above lines in your ~/.profile, or system-wide at /etc/profile





        To test it:



        printf 'a'


        Beep!



        beep


        Buzz!






        share|improve this answer















        Since this is a very high rated question on google, I'll add the steps I did to re-enable beep in both console and X11:





        For the Linux Console (CTRL+ALT+F1...F6):



        Why it does not work by default



        As already answered, the pcspkr kernel driver for the PC Speaker is blacklisted in Ubuntu.



        Temporarily enable until reboot:



        sudo modprobe pcspkr


        Automatically enable on boot:



        sudo nano /etc/modprobe.d/blacklist.conf


        (delete or comment pcspkr line by prepending it with #)





        For X11 terminals (such as the default gnome-terminal)



        Why it does not work by default



        Under X, like when using Unity, KDE, Gnome Shell, the beep events are captured by PulseAudio thanks to module-x11-bell, which is loaded by default at /usr/bin/start-pulseaudio-x11. And the sound sample PulseAudio plays on beep, bell.ogg, is blank by default. Additionally, the bell volume may be muted.



        To temporarily enable for current session,



        xset b 100  # perhaps not needed, on my system it was 40 by default
        pactl upload-sample /usr/share/sounds/ubuntu/stereo/bell.ogg bell.ogg


        There are other suitable samples you can try at /usr/share/sounds, for example check the ones at /usr/share/sounds/gnome/default/alerts/



        Note that the beep program is not really necessary. But if installed, it uses the PC Speaker. It was the only way I could find to enable the buzzer under X:



        sudo apt-get install beep


        To automatically enable on boot, just add the above lines in your ~/.profile, or system-wide at /etc/profile





        To test it:



        printf 'a'


        Beep!



        beep


        Buzz!







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 9 '17 at 2:35









        muru

        1




        1










        answered Feb 19 '15 at 11:36









        MestreLionMestreLion

        13.9k116997




        13.9k116997













        • To automatically enable a pc speaker beep on boot you have to actually comment said line in /etc/modprobe.d/blacklist.conf not uncomment it (you want to disable blacklisting, not the other way around).

          – z33k
          Sep 16 '16 at 11:18








        • 1





          both solutions work on Ubuntu 16.04 Note: pcspkr and bell.ogg are independent approaches. beep tries to beep using various approaches e.g., ioctl(console_fd, KIOCSOUND, period) use pcspkr (the sound is coming from PC speaker on the motherboard) while printf 'a' -based method may work without it using only bell.ogg (the sound is from ordinary speakers). The second method might not work until pulseaudio service is started and/or xset b on is run

          – jfs
          Oct 13 '16 at 0:43











        • The pactl upload-sample ... was golden for me. What's the way to permanently configure the sample loading again?

          – ulidtko
          Nov 29 '16 at 22:15











        • @ulidtko: Just add those lines lines in your ~/.profile, or system-wide at /etc/profile

          – MestreLion
          Feb 6 '17 at 15:40











        • @MestreLion wrong. load-sample bell.ogg /usr/share/sounds/ubuntu/stereo/bell.ogg in /etc/pulseaudio/default.pa.

          – ulidtko
          Feb 7 '17 at 10:19



















        • To automatically enable a pc speaker beep on boot you have to actually comment said line in /etc/modprobe.d/blacklist.conf not uncomment it (you want to disable blacklisting, not the other way around).

          – z33k
          Sep 16 '16 at 11:18








        • 1





          both solutions work on Ubuntu 16.04 Note: pcspkr and bell.ogg are independent approaches. beep tries to beep using various approaches e.g., ioctl(console_fd, KIOCSOUND, period) use pcspkr (the sound is coming from PC speaker on the motherboard) while printf 'a' -based method may work without it using only bell.ogg (the sound is from ordinary speakers). The second method might not work until pulseaudio service is started and/or xset b on is run

          – jfs
          Oct 13 '16 at 0:43











        • The pactl upload-sample ... was golden for me. What's the way to permanently configure the sample loading again?

          – ulidtko
          Nov 29 '16 at 22:15











        • @ulidtko: Just add those lines lines in your ~/.profile, or system-wide at /etc/profile

          – MestreLion
          Feb 6 '17 at 15:40











        • @MestreLion wrong. load-sample bell.ogg /usr/share/sounds/ubuntu/stereo/bell.ogg in /etc/pulseaudio/default.pa.

          – ulidtko
          Feb 7 '17 at 10:19

















        To automatically enable a pc speaker beep on boot you have to actually comment said line in /etc/modprobe.d/blacklist.conf not uncomment it (you want to disable blacklisting, not the other way around).

        – z33k
        Sep 16 '16 at 11:18







        To automatically enable a pc speaker beep on boot you have to actually comment said line in /etc/modprobe.d/blacklist.conf not uncomment it (you want to disable blacklisting, not the other way around).

        – z33k
        Sep 16 '16 at 11:18






        1




        1





        both solutions work on Ubuntu 16.04 Note: pcspkr and bell.ogg are independent approaches. beep tries to beep using various approaches e.g., ioctl(console_fd, KIOCSOUND, period) use pcspkr (the sound is coming from PC speaker on the motherboard) while printf 'a' -based method may work without it using only bell.ogg (the sound is from ordinary speakers). The second method might not work until pulseaudio service is started and/or xset b on is run

        – jfs
        Oct 13 '16 at 0:43





        both solutions work on Ubuntu 16.04 Note: pcspkr and bell.ogg are independent approaches. beep tries to beep using various approaches e.g., ioctl(console_fd, KIOCSOUND, period) use pcspkr (the sound is coming from PC speaker on the motherboard) while printf 'a' -based method may work without it using only bell.ogg (the sound is from ordinary speakers). The second method might not work until pulseaudio service is started and/or xset b on is run

        – jfs
        Oct 13 '16 at 0:43













        The pactl upload-sample ... was golden for me. What's the way to permanently configure the sample loading again?

        – ulidtko
        Nov 29 '16 at 22:15





        The pactl upload-sample ... was golden for me. What's the way to permanently configure the sample loading again?

        – ulidtko
        Nov 29 '16 at 22:15













        @ulidtko: Just add those lines lines in your ~/.profile, or system-wide at /etc/profile

        – MestreLion
        Feb 6 '17 at 15:40





        @ulidtko: Just add those lines lines in your ~/.profile, or system-wide at /etc/profile

        – MestreLion
        Feb 6 '17 at 15:40













        @MestreLion wrong. load-sample bell.ogg /usr/share/sounds/ubuntu/stereo/bell.ogg in /etc/pulseaudio/default.pa.

        – ulidtko
        Feb 7 '17 at 10:19





        @MestreLion wrong. load-sample bell.ogg /usr/share/sounds/ubuntu/stereo/bell.ogg in /etc/pulseaudio/default.pa.

        – ulidtko
        Feb 7 '17 at 10:19











        13














        I've encountered this problem before. From what I remember, the problem is that the terminal bell tries to ring an internal computer speaker (as in an old-school desktop) but laptops and some newer computers are missing such a thing.



        The only solution I found at the time was to sudo apt-get install sox and



        play -n synth <duration in seconds> sine <freq in Hz> vol <volume (0-1)>


        e.g.



         play -n synth 0.1 sine 880 vol 0.5





        share|improve this answer


























        • try my solution - I'd love to know if it works for you!

          – JoBu1324
          Dec 11 '12 at 23:10











        • you may use speaker-test for this too

          – Janus Troelsen
          Jun 11 '14 at 9:05






        • 1





          You can also have a nice guitar pluck tone: play -q -n synth 2 pluck C5. C5 is the note.

          – Pablo Bianchi
          Jul 1 '18 at 5:40
















        13














        I've encountered this problem before. From what I remember, the problem is that the terminal bell tries to ring an internal computer speaker (as in an old-school desktop) but laptops and some newer computers are missing such a thing.



        The only solution I found at the time was to sudo apt-get install sox and



        play -n synth <duration in seconds> sine <freq in Hz> vol <volume (0-1)>


        e.g.



         play -n synth 0.1 sine 880 vol 0.5





        share|improve this answer


























        • try my solution - I'd love to know if it works for you!

          – JoBu1324
          Dec 11 '12 at 23:10











        • you may use speaker-test for this too

          – Janus Troelsen
          Jun 11 '14 at 9:05






        • 1





          You can also have a nice guitar pluck tone: play -q -n synth 2 pluck C5. C5 is the note.

          – Pablo Bianchi
          Jul 1 '18 at 5:40














        13












        13








        13







        I've encountered this problem before. From what I remember, the problem is that the terminal bell tries to ring an internal computer speaker (as in an old-school desktop) but laptops and some newer computers are missing such a thing.



        The only solution I found at the time was to sudo apt-get install sox and



        play -n synth <duration in seconds> sine <freq in Hz> vol <volume (0-1)>


        e.g.



         play -n synth 0.1 sine 880 vol 0.5





        share|improve this answer















        I've encountered this problem before. From what I remember, the problem is that the terminal bell tries to ring an internal computer speaker (as in an old-school desktop) but laptops and some newer computers are missing such a thing.



        The only solution I found at the time was to sudo apt-get install sox and



        play -n synth <duration in seconds> sine <freq in Hz> vol <volume (0-1)>


        e.g.



         play -n synth 0.1 sine 880 vol 0.5






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited May 16 '18 at 1:58









        mchid

        23.5k25286




        23.5k25286










        answered Dec 11 '12 at 23:04









        YodaDaCodaYodaDaCoda

        58745




        58745













        • try my solution - I'd love to know if it works for you!

          – JoBu1324
          Dec 11 '12 at 23:10











        • you may use speaker-test for this too

          – Janus Troelsen
          Jun 11 '14 at 9:05






        • 1





          You can also have a nice guitar pluck tone: play -q -n synth 2 pluck C5. C5 is the note.

          – Pablo Bianchi
          Jul 1 '18 at 5:40



















        • try my solution - I'd love to know if it works for you!

          – JoBu1324
          Dec 11 '12 at 23:10











        • you may use speaker-test for this too

          – Janus Troelsen
          Jun 11 '14 at 9:05






        • 1





          You can also have a nice guitar pluck tone: play -q -n synth 2 pluck C5. C5 is the note.

          – Pablo Bianchi
          Jul 1 '18 at 5:40

















        try my solution - I'd love to know if it works for you!

        – JoBu1324
        Dec 11 '12 at 23:10





        try my solution - I'd love to know if it works for you!

        – JoBu1324
        Dec 11 '12 at 23:10













        you may use speaker-test for this too

        – Janus Troelsen
        Jun 11 '14 at 9:05





        you may use speaker-test for this too

        – Janus Troelsen
        Jun 11 '14 at 9:05




        1




        1





        You can also have a nice guitar pluck tone: play -q -n synth 2 pluck C5. C5 is the note.

        – Pablo Bianchi
        Jul 1 '18 at 5:40





        You can also have a nice guitar pluck tone: play -q -n synth 2 pluck C5. C5 is the note.

        – Pablo Bianchi
        Jul 1 '18 at 5:40











        2














        If you have actual speakers connected to the computer and you're not getting a beep it's likely because you are using compiz. Compiz is relying on pulseaudio catching the beeps and playing them while metacity bypasses the usual setup and uses libcanberra to play a beep sound. If it works with metacity and not compiz that is your problem, otherwise the answer htorque gave is corrent.






        share|improve this answer




























          2














          If you have actual speakers connected to the computer and you're not getting a beep it's likely because you are using compiz. Compiz is relying on pulseaudio catching the beeps and playing them while metacity bypasses the usual setup and uses libcanberra to play a beep sound. If it works with metacity and not compiz that is your problem, otherwise the answer htorque gave is corrent.






          share|improve this answer


























            2












            2








            2







            If you have actual speakers connected to the computer and you're not getting a beep it's likely because you are using compiz. Compiz is relying on pulseaudio catching the beeps and playing them while metacity bypasses the usual setup and uses libcanberra to play a beep sound. If it works with metacity and not compiz that is your problem, otherwise the answer htorque gave is corrent.






            share|improve this answer













            If you have actual speakers connected to the computer and you're not getting a beep it's likely because you are using compiz. Compiz is relying on pulseaudio catching the beeps and playing them while metacity bypasses the usual setup and uses libcanberra to play a beep sound. If it works with metacity and not compiz that is your problem, otherwise the answer htorque gave is corrent.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 3 '11 at 20:56









            Travis WatkinsTravis Watkins

            68337




            68337























                2














                As far as I can tell, this is a bug: System beep broken in Karmic despite heroic efforts to fix it.






                share|improve this answer





















                • 3





                  "Not enabled by default" does not mean broken, and no "heroic effort" is needed: just modprobe pcsprk (in console) or pactl upload-sample ... in X11 and the annoying beep is back :)

                  – MestreLion
                  Feb 19 '15 at 11:03
















                2














                As far as I can tell, this is a bug: System beep broken in Karmic despite heroic efforts to fix it.






                share|improve this answer





















                • 3





                  "Not enabled by default" does not mean broken, and no "heroic effort" is needed: just modprobe pcsprk (in console) or pactl upload-sample ... in X11 and the annoying beep is back :)

                  – MestreLion
                  Feb 19 '15 at 11:03














                2












                2








                2







                As far as I can tell, this is a bug: System beep broken in Karmic despite heroic efforts to fix it.






                share|improve this answer















                As far as I can tell, this is a bug: System beep broken in Karmic despite heroic efforts to fix it.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Dec 3 '14 at 0:03









                Flimm

                21.9k1563123




                21.9k1563123










                answered Jan 3 '11 at 20:43









                htorquehtorque

                47.7k32175213




                47.7k32175213








                • 3





                  "Not enabled by default" does not mean broken, and no "heroic effort" is needed: just modprobe pcsprk (in console) or pactl upload-sample ... in X11 and the annoying beep is back :)

                  – MestreLion
                  Feb 19 '15 at 11:03














                • 3





                  "Not enabled by default" does not mean broken, and no "heroic effort" is needed: just modprobe pcsprk (in console) or pactl upload-sample ... in X11 and the annoying beep is back :)

                  – MestreLion
                  Feb 19 '15 at 11:03








                3




                3





                "Not enabled by default" does not mean broken, and no "heroic effort" is needed: just modprobe pcsprk (in console) or pactl upload-sample ... in X11 and the annoying beep is back :)

                – MestreLion
                Feb 19 '15 at 11:03





                "Not enabled by default" does not mean broken, and no "heroic effort" is needed: just modprobe pcsprk (in console) or pactl upload-sample ... in X11 and the annoying beep is back :)

                – MestreLion
                Feb 19 '15 at 11:03











                2














                I finally found a solution, which doesn't require alsamixer to have a PC Beep option. I think I remember all my changes:



                uncomment the following in /etc/pulse/default.pa:



                load-sample-lazy x11-bell /usr/share/sounds/ubuntu/stereo/bell.ogg
                load-module module-x11-bell sample=bell-windowing-system


                per this bug, run pactl upload-sample /usr/share/sounds/ubuntu/stereo/bell.ogg bell.ogg






                share|improve this answer


























                • Tried this, pactl gave me Connection failure: Connection refused pa_context_connect() failed: Connection refused.

                  – YodaDaCoda
                  Dec 11 '12 at 23:33













                • Maybe this thread will help - if you've ever run pulseaudio as root.

                  – JoBu1324
                  Dec 11 '12 at 23:49











                • I'm having a different problem, actually. Pulseaudio throws Failed to open module "module-esound-protocol-unix": file not found. Probably not worth discussing here since I'm running 13.04, though I would love to be able to verify your solution.

                  – YodaDaCoda
                  Dec 12 '12 at 0:05











                • Nice, just slightly different lines for 15.04.

                  – VRR
                  Sep 12 '15 at 11:09
















                2














                I finally found a solution, which doesn't require alsamixer to have a PC Beep option. I think I remember all my changes:



                uncomment the following in /etc/pulse/default.pa:



                load-sample-lazy x11-bell /usr/share/sounds/ubuntu/stereo/bell.ogg
                load-module module-x11-bell sample=bell-windowing-system


                per this bug, run pactl upload-sample /usr/share/sounds/ubuntu/stereo/bell.ogg bell.ogg






                share|improve this answer


























                • Tried this, pactl gave me Connection failure: Connection refused pa_context_connect() failed: Connection refused.

                  – YodaDaCoda
                  Dec 11 '12 at 23:33













                • Maybe this thread will help - if you've ever run pulseaudio as root.

                  – JoBu1324
                  Dec 11 '12 at 23:49











                • I'm having a different problem, actually. Pulseaudio throws Failed to open module "module-esound-protocol-unix": file not found. Probably not worth discussing here since I'm running 13.04, though I would love to be able to verify your solution.

                  – YodaDaCoda
                  Dec 12 '12 at 0:05











                • Nice, just slightly different lines for 15.04.

                  – VRR
                  Sep 12 '15 at 11:09














                2












                2








                2







                I finally found a solution, which doesn't require alsamixer to have a PC Beep option. I think I remember all my changes:



                uncomment the following in /etc/pulse/default.pa:



                load-sample-lazy x11-bell /usr/share/sounds/ubuntu/stereo/bell.ogg
                load-module module-x11-bell sample=bell-windowing-system


                per this bug, run pactl upload-sample /usr/share/sounds/ubuntu/stereo/bell.ogg bell.ogg






                share|improve this answer















                I finally found a solution, which doesn't require alsamixer to have a PC Beep option. I think I remember all my changes:



                uncomment the following in /etc/pulse/default.pa:



                load-sample-lazy x11-bell /usr/share/sounds/ubuntu/stereo/bell.ogg
                load-module module-x11-bell sample=bell-windowing-system


                per this bug, run pactl upload-sample /usr/share/sounds/ubuntu/stereo/bell.ogg bell.ogg







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jun 24 '17 at 18:04









                David Foerster

                28.6k1367113




                28.6k1367113










                answered Dec 11 '12 at 23:09









                JoBu1324JoBu1324

                3192515




                3192515













                • Tried this, pactl gave me Connection failure: Connection refused pa_context_connect() failed: Connection refused.

                  – YodaDaCoda
                  Dec 11 '12 at 23:33













                • Maybe this thread will help - if you've ever run pulseaudio as root.

                  – JoBu1324
                  Dec 11 '12 at 23:49











                • I'm having a different problem, actually. Pulseaudio throws Failed to open module "module-esound-protocol-unix": file not found. Probably not worth discussing here since I'm running 13.04, though I would love to be able to verify your solution.

                  – YodaDaCoda
                  Dec 12 '12 at 0:05











                • Nice, just slightly different lines for 15.04.

                  – VRR
                  Sep 12 '15 at 11:09



















                • Tried this, pactl gave me Connection failure: Connection refused pa_context_connect() failed: Connection refused.

                  – YodaDaCoda
                  Dec 11 '12 at 23:33













                • Maybe this thread will help - if you've ever run pulseaudio as root.

                  – JoBu1324
                  Dec 11 '12 at 23:49











                • I'm having a different problem, actually. Pulseaudio throws Failed to open module "module-esound-protocol-unix": file not found. Probably not worth discussing here since I'm running 13.04, though I would love to be able to verify your solution.

                  – YodaDaCoda
                  Dec 12 '12 at 0:05











                • Nice, just slightly different lines for 15.04.

                  – VRR
                  Sep 12 '15 at 11:09

















                Tried this, pactl gave me Connection failure: Connection refused pa_context_connect() failed: Connection refused.

                – YodaDaCoda
                Dec 11 '12 at 23:33







                Tried this, pactl gave me Connection failure: Connection refused pa_context_connect() failed: Connection refused.

                – YodaDaCoda
                Dec 11 '12 at 23:33















                Maybe this thread will help - if you've ever run pulseaudio as root.

                – JoBu1324
                Dec 11 '12 at 23:49





                Maybe this thread will help - if you've ever run pulseaudio as root.

                – JoBu1324
                Dec 11 '12 at 23:49













                I'm having a different problem, actually. Pulseaudio throws Failed to open module "module-esound-protocol-unix": file not found. Probably not worth discussing here since I'm running 13.04, though I would love to be able to verify your solution.

                – YodaDaCoda
                Dec 12 '12 at 0:05





                I'm having a different problem, actually. Pulseaudio throws Failed to open module "module-esound-protocol-unix": file not found. Probably not worth discussing here since I'm running 13.04, though I would love to be able to verify your solution.

                – YodaDaCoda
                Dec 12 '12 at 0:05













                Nice, just slightly different lines for 15.04.

                – VRR
                Sep 12 '15 at 11:09





                Nice, just slightly different lines for 15.04.

                – VRR
                Sep 12 '15 at 11:09











                2














                "Beep only works if your PC has a 'speaker'. Many modern laptops / small devices don't have one".



                Try playing a sound like this: play xxxxx.wav I found a nice wav file that seems to be short and sweet, but you can pick your own as well. Works for me when all else failed.





                Thanks to: tredegar & hk_centos






                share|improve this answer






























                  2














                  "Beep only works if your PC has a 'speaker'. Many modern laptops / small devices don't have one".



                  Try playing a sound like this: play xxxxx.wav I found a nice wav file that seems to be short and sweet, but you can pick your own as well. Works for me when all else failed.





                  Thanks to: tredegar & hk_centos






                  share|improve this answer




























                    2












                    2








                    2







                    "Beep only works if your PC has a 'speaker'. Many modern laptops / small devices don't have one".



                    Try playing a sound like this: play xxxxx.wav I found a nice wav file that seems to be short and sweet, but you can pick your own as well. Works for me when all else failed.





                    Thanks to: tredegar & hk_centos






                    share|improve this answer















                    "Beep only works if your PC has a 'speaker'. Many modern laptops / small devices don't have one".



                    Try playing a sound like this: play xxxxx.wav I found a nice wav file that seems to be short and sweet, but you can pick your own as well. Works for me when all else failed.





                    Thanks to: tredegar & hk_centos







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Mar 5 '18 at 23:11

























                    answered Mar 5 '18 at 23:00









                    Elliptical viewElliptical view

                    404312




                    404312























                        0














                        An alternative approach - set your xterm / console to "Visual Bell" so that when it would beep, the window simply inverts its colours for a short time.



                        I have a bash function called beep to get my attention once a command is finished.



                        beep ()  { while true; do  echo -en 'a'; sleep 1; done }


                        And it is used this way



                        longrun-command ; beep





                        share|improve this answer




























                          0














                          An alternative approach - set your xterm / console to "Visual Bell" so that when it would beep, the window simply inverts its colours for a short time.



                          I have a bash function called beep to get my attention once a command is finished.



                          beep ()  { while true; do  echo -en 'a'; sleep 1; done }


                          And it is used this way



                          longrun-command ; beep





                          share|improve this answer


























                            0












                            0








                            0







                            An alternative approach - set your xterm / console to "Visual Bell" so that when it would beep, the window simply inverts its colours for a short time.



                            I have a bash function called beep to get my attention once a command is finished.



                            beep ()  { while true; do  echo -en 'a'; sleep 1; done }


                            And it is used this way



                            longrun-command ; beep





                            share|improve this answer













                            An alternative approach - set your xterm / console to "Visual Bell" so that when it would beep, the window simply inverts its colours for a short time.



                            I have a bash function called beep to get my attention once a command is finished.



                            beep ()  { while true; do  echo -en 'a'; sleep 1; done }


                            And it is used this way



                            longrun-command ; beep






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered 11 mins ago









                            CriggieCriggie

                            1394




                            1394






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Ask Ubuntu!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f19906%2fbeep-in-shell-script-not-working%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Why do type traits not work with types in namespace scope?What are POD types in C++?Why can templates only be...

                                Will tsunami waves travel forever if there was no land?Why do tsunami waves begin with the water flowing away...

                                Simple Scan not detecting my scanner (Brother DCP-7055W)Brother MFC-L2700DW printer can print, can't...