This tutorial shows how to fix speakers not working in Ubuntu 10.04.If you have an Analog Devices AD1986A Audio card on your laptop,and get this sound problem.You can try following steps:

1.First,open up a terminal window (Applications->Accessories->Terminal) and run this command:

sudo head -1 /proc/asound/card0/codec#0

it outputs your audio card type.

2.Edit the configuration file by this command:

sudo gedit /etc/modprobe.d/alsa-base.conf

find out this section:

# Keep snd-pcsp from being loaded as first soundcard

options snd-pcsp index=-2

change it into:

# Keep snd-pcsp from being loaded as first soundcard
#options snd-pcsp index=-2
options snd-hda-intel model=laptop-eapd

3.Reboot,and the speaker should working now!

BTW:If get the problem: sound coming out from both headphones and speakers,read this post