How to turn off or change login sound in Ubuntu 12.04

There are many things I dont like in Ubuntu and one of them is the login sound. That's why right after I installed Ubuntu 12.04 Precise Pangolin on my laptop to test it, the very first thing I did was to try to turn off the login sound. However, things now are different from what I was accustomed to. When I opened the Startup Application Preferences to disable the login sound ( as I used to do in the old versions of Ubuntu), all I saw was a blank window. The reason for this is that the login sound option is hidden on the Startup Application Preferences by default but you can make it visible again easily. Just open the terminal and type the following command to edit the login sound script:
 sudo gedit /usr/share/gnome/autostart/libcanberra-login-sound.desktop  

You will have the script looking like this:
 [Desktop Entry]  
 Name=GNOME Login Sound  
 Comment=Plays a sound whenever you log in  
 Exec=/usr/bin/canberra-gtk-play --id="desktop-login" --description="GNOME Login"  
 AutostartCondition=GSettings org.gnome.desktop.sound event-sounds  

To make the login sound option visible on the Startup Application Preferences, just edit the last line of the above file into:

Save the file and open the Startup Application Preference again and you will see the login sound option. To turn off the login sound, just uncheck the box:

turn off log in sound ubuntu 12.04

In case you want to change the login sound instead of turning it off, you just need to edit this line of the login sound script:
 Exec=/usr/bin/canberra-gtk-play --id="desktop-login" --description="GNOME Login"  

The part "desktop-login" is the name of the login sound file desktop-login.ogg which is located in /usr/share/sounds/ubuntu/stereo. To change the login sound, you just need to move a new sound file (must be in .ogg format) to this folder and change the part "desktop-login" into the name of the new sound file.

To convert a sound file into .ogg format, you can use ffmpeg. For instance, the command to convert a .mp3 file to .ogg is:
 ffmpeg -i sound-file.mp3 sound-file.ogg  
linux tips and tricks