g3vbv
Posts: 15
Joined: Tue Jul 17, 2012 2:01 pm

No sound from on-board card

Thu Aug 09, 2012 7:50 pm

I have one application that plays sound only in short bursts from the HMDI but I have not been able to get sound from the 3.5 mm socket. Details of what I have tried below. Help appreciated.
root@raspberrypi:~# lsmod|grep snd
snd_bcm2835 15388 1
snd_pcm 49240 1 snd_bcm2835
snd_seq 35080 0
snd_timer 13560 2 snd_pcm,snd_seq
snd_seq_device 3684 1 snd_seq
snd 31624 7 snd_bcm2835,snd_pcm,snd_seq,snd_timer,snd_seq_device
snd_page_alloc 2660 1 snd_pcm
root@raspberrypi:~# fuser -v /dev/snd/*
USER PID ACCESS COMMAND
/dev/snd/controlC0: pulse 1302 F.... pulseaudio

root@raspberrypi:~# cat /proc/asound/cards
0 [ALSA ]: BRCM bcm2835 ALSbcm2835 ALSA - bcm2835 ALSA
bcm2835 ALSA
root@raspberrypi:~# cat /etc/asound.conf
pcm.mmap0 {
type mmap_emul;
slave {
pcm "hw:0,0";
}
}

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


root@raspberrypi:~# aplay /jet.wav
ALSA lib conf.c:1661:(snd_config_load1) _toplevel_:13:0:Unexpected char
ALSA lib conf.c:3441:(snd_config_hook_load) /etc/asound.conf may be old or corrupted: consider to remove or fix it
ALSA lib conf.c:3302:(snd_config_hooks_call) function snd_config_hook_load returned error: Invalid argument
ALSA lib conf.c:3687:(snd_config_update_r) hooks failed, removing configuration
aplay: main:654: audio open error: Invalid argument

root@raspberrypi:~# cat /etc/asound.conf
pcm.!default {
type hw
card 0
}

ctl.!default {
type hw
card 0
}


root@raspberrypi:~# aplay /jet.wav
Playing WAVE '/jet.wav' : Unsigned 8 bit, Rate 11025 Hz, Mono
aplay: pcm_write:1603: write error: Input/output error

root@raspberrypi:~# cat /etc/modprobe.d/alsa-base.conf
# autoloader aliases
install sound-slot-0 /sbin/modprobe snd-card-0
install sound-slot-1 /sbin/modprobe snd-card-1
install sound-slot-2 /sbin/modprobe snd-card-2
install sound-slot-3 /sbin/modprobe snd-card-3
install sound-slot-4 /sbin/modprobe snd-card-4
install sound-slot-5 /sbin/modprobe snd-card-5
install sound-slot-6 /sbin/modprobe snd-card-6
install sound-slot-7 /sbin/modprobe snd-card-7
# Cause optional modules to be loaded above generic modules
install snd /sbin/modprobe --ignore-install snd && { /sbin/modprobe --quiet snd-ioctl32 ; /sbin/modprobe --quiet snd-seq ; }
install snd-rawmidi /sbin/modprobe --ignore-install snd-rawmidi && { /sbin/modprobe --quiet snd-seq-midi ; : ; }
install snd-emu10k1 /sbin/modprobe --ignore-install snd-emu10k1 && { /sbin/modprobe --quiet snd-emu10k1-synth ; : ; }

# Prevent abnormal drivers from grabbing index 0
options bt87x index=-2
options cx88_alsa index=-2
options snd-atiixp-modem index=-2
options snd-intel8x0m index=-2
options snd-via82xx-modem index=-2
# Keep snd-pcsp from beeing loaded as first soundcard
options snd-pcsp index=-2
# Keep snd-usb-audio from beeing loaded as first soundcard
options snd-usb-audio index=-2

root@raspberrypi:~# aplay /jet.wav
Playing WAVE '/jet.wav' : Unsigned 8 bit, Rate 11025 Hz, Mono
aplay: pcm_write:1603: write error: Input/output error

kadamski
Posts: 187
Joined: Fri Jun 08, 2012 10:56 pm

Re: No sound from on-board card

Fri Aug 10, 2012 1:36 pm

You can choose where sound should be outputed (HDMI or analog) using amixer command, see http://elinux.org/R-Pi_Troubleshooting# ... plications.
Note that you have some problems with your /etc/asound.conf as it can't be parsed, it's probably some problem with whitespaces caused by copy/pasting from forum. You could rewrite it by hand or remove the file as it is not used. And if I understand correctly, you are using pulseaudio which isn't working too good on RPi, consider deinstalling it.

g3vbv
Posts: 15
Joined: Tue Jul 17, 2012 2:01 pm

Re: No sound from on-board card

Fri Aug 10, 2012 3:40 pm

I edited /etc/asound.conf replacing the spaces with tabs.
"aplay /jet.wav" still gives write errors.

root@raspberrypi:~# amixer cset numid=3 0
numid=3,iface=MIXER,name='PCM Playback Route'
; type=INTEGER,access=rw------,values=1,min=0,max=3,step=0
: values=0
root@raspberrypi:~# aplay /usr/share/sounds/alsa/Front_Center.wav
Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
*********NO SOUND ****************
root@raspberrypi:~# amixer cset numid=3 1
numid=3,iface=MIXER,name='PCM Playback Route'
; type=INTEGER,access=rw------,values=1,min=0,max=3,step=0
: values=1
root@raspberrypi:~# aplay /usr/share/sounds/alsa/Front_Center.wav
Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono

********* Plays just "Center" in headset, file on a x86_64 box plays "Front Center" ***********

root@raspberrypi:~# amixer cset numid=3 2
numid=3,iface=MIXER,name='PCM Playback Route'
; type=INTEGER,access=rw------,values=1,min=0,max=3,step=0
: values=2
root@raspberrypi:~# aplay /usr/share/sounds/alsa/Front_Center.wav
******************** NO SOUND ***************************************

g3vbv
Posts: 15
Joined: Tue Jul 17, 2012 2:01 pm

Re: No sound from on-board card

Fri Aug 10, 2012 3:59 pm

There is just a buzz where Front should sound so only Center, Left or Right in each case is played.

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: No sound from on-board card

Fri Aug 10, 2012 4:27 pm

You could try OpenELEC or Raspbmc both run XBMC and can be configured to play via the crap on-board audio.
Alternative there is qmmp for X-Windows however under Raspian wheezy the ALSA drivers are faulty (hence pops and skips in the audio).
Also make sure your voltage at TP1 / TP2 is at least 4.8v or higher anything lower and the hardware may fail to function as expected.

Richard S.

pholy
Posts: 46
Joined: Sun Jun 24, 2012 11:29 pm

Re: No sound from on-board card

Sat Aug 11, 2012 1:21 am

The missing 1.5 seconds of sound was fixed in a kernel update, I believe. If you are still with one of the Raspbian hosted downloads, use rpi-update to get new kernel and modules and video core firmware. I think this is fixed in the 'official' RPF Raspian distribution, but I should double check.

pholy
Posts: 46
Joined: Sun Jun 24, 2012 11:29 pm

Re: No sound from on-board card

Sat Aug 11, 2012 2:28 am

A quick update - The official RPF raspbian distribution does not contain the alsa fix. I then added a new line to the file /etc/apt/sources.list.d/raspi.list
'deb http://archive.raspberrypi.org/debian wheezy untested'
which is the existing line with 'main' changed to 'untested'. This will pull in a new kernel and stuff, but not, unfortunately, Dom's latest and greatest efforts.

After doing that, I now get the last syllable of Front_Center.wav instead of the buzz or burp reported earlier for hdmi output, and it works correctly for the analogue output.

I hope his latest improvements will make it to the 'untested' repository soon.

g3vbv
Posts: 15
Joined: Tue Jul 17, 2012 2:01 pm

Re: No sound from on-board card

Mon Aug 13, 2012 8:10 pm

root@raspberrypi:~# apt-cache search qmmp
root@raspberrypi:~#
I also removed pulseaudio and friends but find my application needs pulseaudio which is no longer available from the repo.

SuperObComMan
Posts: 10
Joined: Fri Aug 03, 2012 4:36 pm

Not an answer but possibly relevant...

Tue Aug 14, 2012 1:26 pm

I have the Pi hooked up to a Chimei CMV222H monitor via HDMI.
As far as I'm aware, I have the stock, current build of Raspian. I haven't tweaked anything, reset memory allocation, etc.

My experience to date trying to get audio to work, beginning with 'stock' Raspbian:

1. No audio on HDMI, regardless of setting amixer to 3 2. The test track mp3 (Nine Inch Nails' "Echoplex" - a free download) runs fine under Audacity via analog sound port... just have to give the Pi a minute to produce the waveform that Audacity builds :)
I tried VLC also and could not get audio from either port regardless of leaving defaults or setting to ALSA.

2. Raspbmc Distro installed on another SD card, otherwise exactly the same physical connections, HDMI sound works perfectly (for as 'perfect' as the montor's crappy speakers are :) ) as does video playback and internet video streaming - TED works quite well but one of the Retro gaming sites that you can get to via the menu pixellated badly, so I suspect server bandwidth being the issue there (I am in an outer southern suburb of Perth, Australia, sitting on a crappy ADSL1 connection).

3. 'Discover' the hdmi_drive=2 line for config.txt via the elinux link above. This line is already in the current release of the Raspbian distro, needing only to be 'uncommented'.

4. Pi rebooted (not power-cycled). X started, green speckling appears as X fires up. Is perceptible on desktop, more noticeable on any black-background window (e.g. LXTerminal). I had to set amixer to to the =3 2 setting to get audio.
Playback of mp3 through Audacity is intermittent but when I say intermittent it's not stop-go; the track continues to play but the audio cycles on and off in roughly 3 second bursts.
Video speckling is more pronounced during audio playback.
VLC still a dead-duck audio-wise.

With respect to the video speckling, I could also have uncommented the HDMI_boost line but the video works fine without the HDMI_drive=2 switch as it does in Raspbmc and I'm loathed to potentially set up the chip to overheat on a typical Australian summer day (35 to 42 deg C) no matter how cheap the device is :)

I don 't have the skill (or the patience & time to acquire the skill) to go any deeper into this myself but hopefully this report might be of some use to whoever is looking at audio under Raspbian.

I reiterate that Raspbmc doesn't seem to have any issue with the same HDMI setup and audio so I wonder whether there's an an issue with overheads in Raspbian that aren't there in Raspbmc.

The only thing I haven't tried yet is starting a command line media player... I forgot to mention that I did try omxplayer, thinking it would be like VLC and 'just play' the mp3 but it didn't like it spitting out some typical command-linese error :) ; consequently I didn't try omxplayer with the hdmi_drive=2 switch.

g3vbv
Posts: 15
Joined: Tue Jul 17, 2012 2:01 pm

Re: No sound from on-board card

Tue Aug 14, 2012 8:14 pm

I had some debian wheezy repos commented out in /etc/apt/sources.list. After restoring them I was able to reinstall pulseaudio and friends.
I'd still like qt5 qmake as my application needs qt5 so it can be built to use the GPU for the math intensive bits. Qt4 has issues with sound.

g3vbv
Posts: 15
Joined: Tue Jul 17, 2012 2:01 pm

Re: No sound from on-board card

Tue Aug 14, 2012 8:29 pm

paplay /usr/share/sounds/alsa/Front_Center now plays the full " Front Center" while aplay only plays "<buzz> Center".

Return to “Raspberry Pi OS”