How to make a sound effect play whenever I click?

Hm, quite a hacky solution, but it works! First of all install the following things:

sudo apt-get install xmacro expect mpg321

xmacro is the program that will detect your mouse clicks. expect is the program that will listen to the output of xmacro for your mouse clicks so as to execute mpg321, which is a command line player!

So, run this script from inside a terminal:

#!/usr/bin/expect -f
spawn xmacrorec2

while { 1 } {
   expect "ButtonRelease 1"
   system mpg321 /home/alex/Music/notification/notification.mp3&
}

When you execute the above script (I repeat, through a terminal) you will be asked for an input key. Give an unusual key (e.g. F7), this will be the key that, no matter when you press it, it will stop this process from going on.

So, just, inside the above script, set mpg321 to a valid mp3 file of yours and test it :)

It works just fine under Ubuntu 12.04 but I have used all of these 3 tools under Oneiric without a problem!

xmacrorec2 may take as argument the expected key (-k argument) as a kei code. This helps you a lot if you want to put the above script to your startup applications, because it will not ask for an input key each time. In order to find the appropriate key code that you want to use, you have to install the tiny program xbindkeys:

sudo apt-get install xbindkeys

Then do:

touch ~/.xbindkeysrc
xbindkeys -k

After the last command, a small window will appear, without doing anything to it, give it a keyboard input, let's say F7. You will see something like this:

You can use one of the two lines after "NoCommand"
in $HOME/.xbindkeysrc to bind a key.
"(Scheme function)"
m:0x0 + c:73
F7

Notice the line:

    m:0x0 + c:73

The code 73 is the one expected by xmacrorec2. So, you can add to the above script a -k argument, like this: spawn xmacrorec2 -k 73 and it will automatically start. After you have finished editing the script, save it to a stable directory (I mean a directory you will not delete/move to the close future), like ~/Documents and give it executable permissions (right click on it->Properties->Permissions->Allow executing file as program, or, through the terminal, chmod +x script_name.sh). Then, simply add your script to your Startup Applications. Of course, whenever you want this sound to stop, you will have to give the corresponding keyboard input, like F7.

PS: If you don't want to install an extra command line mp3 player (like mpg321), then you may use the pre-installed player canberra-gtk-play, which is used as

canberra-gtk-play -f music.wav

The disadvantage of it is that it can only play certain ogg and wav files.