Ubuntu: How do I make Ubuntu sound like HAL, from the movie 2001: A Space Odyssey?



Question:

Question:

I want Ubuntu to sound like HAL 9000, from the movie 2001: A Space Odyssey, by Stanley Kubrick. At least, I would like it to play sounds on :

  1. startup: "All systems are functional"
  2. shutdown: "I'm afraid that's something I can not allow to happen" / "Goodbye"
  3. upgrade: "I feel much better now. I really do."
  4. reboot: "Just one moment please."
  5. new email: "There is a message for you"

More:

  1. play a sound on first wrong sudo password prompt: "I'm sorry Dave. I'm afraid I can't do that"
  2. play a sound on second wrong sudo password prompt: "Just what do you think your doing, Dave?"
  3. play a sound when a coreutils command (like cp, dd) is going to take a long time to complete: "Just a moment. Just a moment." Maybe, some script with progress could work?
  4. play a sound after a coreutils command (or any command) took a long time to complete: "I'm sorry for the delay."
  5. play a sound along with unknown command error message: "I'm afraid I can't do that."

Coming next:

I'm waiting for more contributions, and I'll make a single script for all changes.


Solution:1

Getting Ready

  • Download the HAL sounds and store them in a folder, let's say ~/audio/hal/
  • Sounds files come from stoutman.com, Copyright © 1996 - 2017 by Stoutman. Thank him!
  • We are going to use function.wav, cantalow.wav, 1moment.wav, better.wav goodbye.wav, and message4u.wav.
  • Of course, you can use many other sounds and customize your own HAL!
  • We will use paplay from the PulseAudio server, so there is nothing else to install.

1. Startup: "All systems are functional"

This section explains how to play a sound on session opening (source).

  • Create a .conf file in ~/.config/upstart/:

    gedit ~/.config/upstart/halsayshello.conf  
  • Copy and paste this content:

    start on startup  task  exec paplay ~/audio/hal/function.wav  
  • Save file, exit gedit, and HAL should now speak on next session opening.

2. Shutdown: " That's something I can not allow to happen..."

This section explains how to play a sound when a non-sudo user tries to use shutdown. The sudo -v command before paplay is here to ask the password prompt before playing a sound. If you don't care playing the sound before prompting for the password, you can delete it:

  • Add this line at the end of ~/.bashrc file:

    alias shutdown='paplay ~/audio/hal/cantalow.wav'  
  • Yet, if you want the user to be able to shutdown, replace it by:

    alias shutdown='sudo -v && paplay ~/audio/hal/goodbye.wav && sudo shutdown'  
  • Enable changes:

    source .bashrc  

3. Upgrade: "I feel much better now. I really do."

This section explains how to play a sound after upgrading packages with apt:

  • Add this line at the end of ~/.bashrc file :

    alias upgrade='sudo apt update && sudo apt upgrade && paplay ~/audio/hal/better.wav'  
  • Enable changes

    source .bashrc  
  • You can now execute the upgrade command in your terminal

4. Reboot: "One moment please..."

This section explains how to play a sound before reboot.

  • Add this line at the end of ~/.bashrc file:

    alias reboot='sudo -v && paplay ~/audio/hal/1moment.wav && sudo reboot'  
  • Enable changes:

    source .bashrc  
  • You can now reboot using reboot instead of sudo reboot.

5. Email notification: "There is a message for you"

  • Move to default system sound folder:

    cd /usr/share/sounds/freedesktop/stereo  
  • Backup default message notification sound:

    sudo mv message.oga message.oga.bak  
  • Copy ~/hal/mesage4u.wav to replace it:

    sudo cp ~/audio/hal/mesage4u.wav message.oga  

That's it

Well, of course these are just examples of what can be done. I wanted to share that funny configuration I set up, not on my computer, but on a home server (with speakers). Much more can be done or must be done if you want to play this sounds as root, or add others for more commands.

I'm exited about your ideas to improve it.

Enjoy your HAL and ... stay safe.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »