Raspberry PI: Enable MPlayer and VLC audio on Raspbian

If mplayer is giving you an error like the following...

AO: [pulse] Init failed: Connection refused
Failed to initialize audio driver 'pulse'
[AO_ALSA] Unable to set hw-parameters: Invalid argument
Failed to initialize audio driver 'alsa'
[AO SDL] Samplerate: 44100Hz Channels: Stereo Format floatle
[AO SDL] using aalib audio driver.
[AO SDL] Unsupported audio format: 0x1d.
[AO SDL] Unable to open audio: No available audio device
Failed to initialize audio driver 'sdl:aalib'
Could not open/initialize audio device -> no sound.
Audio: no sound
Video: no video

... add the following to /etc/asound.conf (create it if it does not exist):

pcm.!default {
    type hw
    card 0

ctl.!default {
    type hw
    card 0

Then, run:

modprobe snd_bcm2835

Then add the following /etc/modules (unless it's already there):


Source - "ALSA on Raspbian".