# No sound output in VLC

I installed VLC, but I can't hear anything through the analog output (jack output) when I play a MP3 file or a video.

I'm using Debian Wheezy.

I already did some steps to test alsa sound, like this:

sudo aplay /usr/share/sounds/alsa/Front_Center.wav


But that only plays from command-line, (before running X).

• Could you please run vlc from terminal and paste all the messages it writes? Does playing this wav file from VLC work? Do you mean that aplay is not able to play this wav after you run X? Do you have pulseaudio installed? – Krzysztof Adamski Aug 16 '12 at 11:18

I will make this answer more general. There are couple of things that one should check if having problems with audio. In no particular order:

# Check if it's not PCM sample rate/format problem

Currently RPi ALSA driver has no nmap support. This makes plug ALSA plugin behave badly. This plugin should let you play any PCM format you like converting it if needed. But it is not on RPi. Instead it does report to applications that the format is supported but it fails when it starts playback. One way to fix this is to turn on mmap emulation using .asoundrc file in your home directory or /etc/asound.conf:

pcm.mmap0 {
type mmap_emul;
slave {
pcm "hw:0,0";
}
}

pcm.!default {
type plug;
slave {
pcm mmap0;
}
}


This one may be your actual problem since some mp3 codecs (for example default on raspbian) produce flating point PCM which is not directly supported by the hardware and has to be changed.

# Check if pulseaudio is installed

Pulseaudio is problematic on RPi so I would suggest to deinstall it if you are having sound issues, unless you know what you are doing. This is the only way I could explain why sound was working before running X but not after.

# Check if proper audio output is selected

You can choose one of two audio outputs on RaspberryPi using amixer command. You can use one of three modes: 0=auto, 1=analog, 2=hdmi, like this:

sudo amixer cset numid=3 <n>


where is one of 0,1,2. It defaults to auto which may not actually be what we really want.

NOTE: This one is probably not your case as you did get some sound from aplay. It's just for reference to other having similar problems.

# Check if audio module is loaded

Using lsmod command, you should check if snd-bcm2835 is loaded.

NOTE: This one is probably not your case as you did get some sound from aplay. It's just for reference to other having similar problems.

• I figure out that only wav files can be heard in vlc (obviously X started), playback in mp3 or some video formats have no sound. I made a quick conversion of my mp3 in vlc to "Audio CD" preset, and i played that file. Maybe the codec have a different sample format, so that's could be the reason i can't hear any mp3. Your first proposed solution will help me to workaround this issue? – Mr_LinDowsMac Aug 18 '12 at 11:13
• Yes, it seems that the first solution is exactly what you need. – Krzysztof Adamski Aug 20 '12 at 5:08

LogiTechUSB Headset worked for me with VLC Media, even when I could not get the Analog Headphones to work! I can get sound on the Analog headphones using the RPi test program:

user:    pi@raspberrypi
path:    /opt/vc/src/hello_pi/hello_audio
command: ./hello_audio.bin


But the ALSA "default" failed to activate the Analog Headphones!

I discovered that PulseAudio may have problems with the default sample-rate conversion. The default is speex-float-3 which results in no sound for me if it is used, i.e. sample rate conversion is necessary which depends on the input your player program provides.

If I change the resample method to speex-fixed-3 sound works reliably for all inputs.

You can change the resample method, for example, in the file /etc/pulse/daemon.conf. Use a line like:

resample-method = speex-fixed-3