My particular sound card, HDA NVidia with chip Conexant CX20549 uses the snd-hda-intel kernel module. Unfortunately, the default setting enables a power saving feature which causes the speakers to make a popping noise before and after playing sound. The fix in the past has been to edit /etc/modprobe.d/alsa-base.conf and add the line:
options snd-hda-intel power_save=0 power_save_controller=N
To verify that this is working, you should be able to reload the driver and cat the current value of the kernel module parameter (but I could not get this live reload working):
I rebooted and sound was working. Then, I took my laptop on battery power and I experienced the popping again. Sure enough, the value of power_save had been reset. After searching Google with the right terms, I came across a post which pointed me to a script that was being run by the power management software. The script was resetting the value of power_save, making it appear as if alsa-base.conf were being ignored or that putting the computer to sleep were resetting my options. To patch the script, I set the value of a variable to false. Specifically, I edited /usr/lib/pm/power.d/intel-audio-powersave and set the line starting with "INTEL_AUDIO_POWERSAVE" to:
I hope this helps some poor soul with popping speakers. For the record, I'm running on an HP dv6636nr dv6000 series laptop with Ubuntu 11.10 32-bit.