Debugging sound on ubuntu

From Finninday
Revision as of 03:24, 24 November 2010 by Ezekypy (Talk | contribs)

Jump to: navigation, search

Sound was working fine on my Ubuntu Dapper desktop until the update-manager suggested I update the kernel to linux-image-2.6.15-29-amd64-generic 2.6.15-29.60. Now I get this error when trying to start an application that tries to play sounds: <pre> There was an error initializing the audio i/o layer. You will not be able to play or record audio.

Error: Host error. </pre>

I found a very promising web page here to help me figure it out: https://help.ubuntu.com/community/DebuggingSoundProblems

Gathering info from there, I found this:

<pre> root@weasel:~# aplay --list-devices

        • List of PLAYBACK Hardware Devices ****

card 0: CK804 [NVidia CK804], device 0: Intel ICH [NVidia CK804]

 Subdevices: 0/1
 Subdevice #0: subdevice #0

card 0: CK804 [NVidia CK804], device 2: Intel ICH - IEC958 [NVidia CK804 - IEC958]

 Subdevices: 1/1
 Subdevice #0: subdevice #0

root@weasel:~# lspci -v <snip> 0000:00:04.0 Multimedia audio controller: nVidia Corporation CK804 AC'97 Audio Controller (rev a2)

       Subsystem: Micro-Star International Co., Ltd.: Unknown device 7585
       Flags: bus master, 66MHz, fast devsel, latency 0, IRQ 225
       I/O ports at f000 [size=256]
       I/O ports at ec00 [size=256]
       Memory at fe02d000 (32-bit, non-prefetchable) [size=4K]
       Capabilities: [44] Power Management version 2

<snip> root@weasel:~# tail -2 /proc/asound/oss/sndstat Mixers: 0: Realtek ALC850 rev 0

root@weasel:~# amixer Simple mixer control 'Master',0

 Capabilities: pvolume pswitch pswitch-joined
 Playback channels: Front Left - Front Right
 Limits: Playback 0 - 31
 Mono:
 Front Left: Playback 8 [26%] [on]
 Front Right: Playback 8 [26%] [on]

Simple mixer control 'Master Mono',0

 Capabilities: pvolume pvolume-joined pswitch pswitch-joined
 Playback channels: Mono
 Limits: Playback 0 - 31
 Mono: Playback 0 [0%] [off]

Simple mixer control 'PCM',0

 Capabilities: pvolume pswitch pswitch-joined
 Playback channels: Front Left - Front Right
 Limits: Playback 0 - 31
 Mono:
 Front Left: Playback 29 [94%] [on]
 Front Right: Playback 29 [94%] [on]

Simple mixer control 'Surround',0

 Capabilities: pvolume pswitch
 Playback channels: Front Left - Front Right
 Limits: Playback 0 - 31
 Mono:
 Front Left: Playback 0 [0%] [off]
 Front Right: Playback 0 [0%] [off]

Simple mixer control 'Surround Jack Mode',0

 Capabilities: enum
 Items: 'Shared' 'Independent'
 Item0: 'Shared'

Simple mixer control 'Center',0

 Capabilities: pvolume pvolume-joined pswitch pswitch-joined
 Playback channels: Mono
 Limits: Playback 0 - 31
 Mono: Playback 22 [71%] [off]

Simple mixer control 'LFE',0

 Capabilities: pvolume pvolume-joined pswitch pswitch-joined
 Playback channels: Mono
 Limits: Playback 0 - 31
 Mono: Playback 0 [0%] [off]

Simple mixer control 'Line',0

 Capabilities: pvolume pswitch pswitch-joined cswitch cswitch-joined cswitch-exclusive
 Capture exclusive group: 0
 Playback channels: Front Left - Front Right
 Capture channels: Front Left - Front Right
 Limits: Playback 0 - 31
 Front Left: Playback 0 [0%] [off] Capture [off]
 Front Right: Playback 0 [0%] [off] Capture [off]

Simple mixer control 'CD',0

 Capabilities: pvolume pswitch pswitch-joined cswitch cswitch-joined cswitch-exclusive
 Capture exclusive group: 0
 Playback channels: Front Left - Front Right
 Capture channels: Front Left - Front Right
 Limits: Playback 0 - 31
 Front Left: Playback 25 [81%] [on] Capture [off]
 Front Right: Playback 25 [81%] [on] Capture [off]

Simple mixer control 'Mic',0

 Capabilities: pvolume pvolume-joined pswitch pswitch-joined cswitch cswitch-joined cswitch-exclusive
 Capture exclusive group: 0
 Playback channels: Mono
 Capture channels: Front Left - Front Right
 Limits: Playback 0 - 31
 Mono: Playback 12 [39%] [on]
 Front Left: Capture [on]
 Front Right: Capture [on]

Simple mixer control 'Mic Boost (+20dB)',0

 Capabilities: pswitch pswitch-joined
 Playback channels: Mono
 Mono: Playback [on]

Simple mixer control 'Mic Front Input',0

 Capabilities: pswitch pswitch-joined
 Playback channels: Mono
 Mono: Playback [off]

Simple mixer control 'Mic Select',0

 Capabilities: enum
 Items: 'Mic1' 'Mic2'
 Item0: 'Mic1'

Simple mixer control 'Video',0

 Capabilities: cswitch cswitch-joined cswitch-exclusive
 Capture exclusive group: 0
 Capture channels: Front Left - Front Right
 Front Left: Capture [off]
 Front Right: Capture [off]

Simple mixer control 'Phone',0

 Capabilities: pvolume pvolume-joined pswitch pswitch-joined cswitch cswitch-joined cswitch-exclusive
 Capture exclusive group: 0
 Playback channels: Mono
 Capture channels: Front Left - Front Right
 Limits: Playback 0 - 31
 Mono: Playback 0 [0%] [off]
 Front Left: Capture [off]
 Front Right: Capture [off]

Simple mixer control 'IEC958',0

 Capabilities: pswitch pswitch-joined cswitch cswitch-joined enum
 Items: 'PCM' 'Analog In' 'IEC958 In'
 Item0: 'PCM'

Simple mixer control 'IEC958 Playback AC97-SPSA',0

 Capabilities: volume volume-joined
 Playback channels: Mono
 Capture channels: Mono
 Limits: 0 - 3
 Mono: 2 [67%]

Simple mixer control 'PC Speaker',0

 Capabilities: pvolume pvolume-joined pswitch pswitch-joined
 Playback channels: Mono
 Limits: Playback 0 - 15
 Mono: Playback 9 [60%] [on]

Simple mixer control 'Aux',0

 Capabilities: pvolume pswitch pswitch-joined cswitch cswitch-joined cswitch-exclusive
 Capture exclusive group: 0
 Playback channels: Front Left - Front Right
 Capture channels: Front Left - Front Right
 Limits: Playback 0 - 31
 Front Left: Playback 0 [0%] [off] Capture [off]
 Front Right: Playback 0 [0%] [off] Capture [off]

Simple mixer control 'Mono Output Select',0

 Capabilities: enum
 Items: 'Mix' 'Mic'
 Item0: 'Mix'

Simple mixer control 'Capture',0

 Capabilities: cvolume cswitch cswitch-joined
 Capture channels: Front Left - Front Right
 Limits: Capture 0 - 15
 Front Left: Capture 0 [0%] [off]
 Front Right: Capture 0 [0%] [off]

Simple mixer control 'Mix',0

 Capabilities: cswitch cswitch-joined cswitch-exclusive
 Capture exclusive group: 0
 Capture channels: Front Left - Front Right
 Front Left: Capture [off]
 Front Right: Capture [off]

Simple mixer control 'Mix Mono',0

 Capabilities: cswitch cswitch-joined cswitch-exclusive
 Capture exclusive group: 0
 Capture channels: Front Left - Front Right
 Front Left: Capture [off]
 Front Right: Capture [off]

Simple mixer control 'Channel Mode',0

 Capabilities: enum
 Items: '2ch' '4ch' '6ch'
 Item0: '2ch'

Simple mixer control 'Duplicate Front',0

 Capabilities: pswitch pswitch-joined
 Playback channels: Mono
 Mono: Playback [off]

Simple mixer control 'External Amplifier',0

 Capabilities: pswitch pswitch-joined
 Playback channels: Mono
 Mono: Playback [on]

root@weasel:~# asoundconf list Names of available sound cards: CK804

root@weasel:~# cat /proc/asound/cards 0 [CK804 ]: NFORCE - NVidia CK804

                    NVidia CK804 with ALC850 at 0xfe02d000, irq 225

root@weasel:~# cat /proc/interrupts

          CPU0       CPU1
 0:    7854348     166799          XT-PIC  timer
 1:         38          0    IO-APIC-edge  i8042
 7:     166811    7854164    IO-APIC-edge  parport0
 8:          0          0    IO-APIC-edge  rtc
 9:          0          0   IO-APIC-level  acpi
14:     287405          0    IO-APIC-edge  ide0
50:       3933          0   IO-APIC-level  ehci_hcd:usb2
58:    2061813          0   IO-APIC-level  eth1
66:    2449317          0   IO-APIC-level  nvidia

217: 8743036 0 IO-APIC-level libata, eth0 225: 1504797 0 IO-APIC-level libata, NVidia CK804 233: 181 0 IO-APIC-level ohci_hcd:usb1 NMI: 1 0 LOC: 8021326 8021315 ERR: 0 MIS: 0</pre>


Furthermore, I can see a few other things that might be relevant:

<pre> root@weasel:~# lsmod Module Size Used by

<snip>

lp 14464 0 snd_intel8x0 37928 3 snd_ac97_codec 109820 1 snd_intel8x0 snd_ac97_bus 3456 1 snd_ac97_codec snd_pcm_oss 58784 0 snd_mixer_oss 19968 1 snd_pcm_oss snd_pcm 104008 4 snd_intel8x0,snd_ac97_codec,snd_pcm_oss snd_timer 28424 2 snd_pcm parport_pc 40176 1 parport 43532 3 ppdev,lp,parport_pc nvidia 5433176 12 snd 68000 10 snd_intel8x0,snd_ac97_codec,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_timer usblp 15488 0 soundcore 12640 1 snd floppy 73544 0 snd_page_alloc 13328 2 snd_intel8x0,snd_pcm pcspkr 3016 0

<snip>

</pre> And it should probably be noted that this results in no audible sound: <pre> root@weasel:~# speaker-test

speaker-test 0.0.8

Playback device is plughw:0,0 Stream parameters are 48000Hz, S16_LE, 1 channels Using 16 octaves of pink noise </pre>

Solution

Googling for "ubuntu error intializing audio layer" got me to a page that had lots of possible solutions, one of which was "killall esd". I found that two esds were running. I did the killall and now audacity starts without error. And speaker-test emits pink noise now.

However that didn't fully solve the problem for audacity. It now is necessary to disable ESD mixing in Preferences to allow Audacity to work. Not sure what else that makes me give up, but things generally seem to work again.

Sound problem on Acer Aspire 6920

This new laptop came with Vista and the first thing we did was install the newly minted Intrepid Ibex. On first install, Alsa wasn't producing any sound. Found a web page that told me how to rip out Alsa and install OSS. That got sound working for most apps. Some things, like Skype, seem to demand Alsa and so still didn't work.

Now I'm trying to re-install Alsa and use a USB audio dongle for sound until there is better support for the on-board chipset.

http://alsa.opensrc.org/index.php/FAQ#How_can_I_check_whether_ALSA_works.3F

Here's what I get for troubleshooting:

<pre> root@stinkerbelle:~# aplay -l

        • List of PLAYBACK Hardware Devices ****

card 0: Intel [HDA Intel], device 0: ALC883 Analog [ALC883 Analog]

 Subdevices: 1/1
 Subdevice #0: subdevice #0

root@stinkerbelle:~# lspci -v | grep -i audio 00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 03) </pre>

After upgrading to the latest kernel in Ubuntu Intrepid Ibex, I get new results from aplay: <pre> root@stinkerbelle:~# aplay -l

        • List of PLAYBACK Hardware Devices ****

card 0: Intel [HDA Intel], device 0: ALC889 Analog [ALC889 Analog]

 Subdevices: 1/1
 Subdevice #0: subdevice #0

</pre> Does that mean that the hardware is being more accurately detected? Hope springs eternal. Another hopeful thing is that after the kernel upgrade, the weird Acer touch pad for volume control now is affecting the volume control widget in gnome. I don't think that was true before the upgrade, but I can't remember for sure.


Here is the latest output from lspci: <pre> 00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 03)

       Subsystem: Acer Incorporated [ALI] Device 0146
       Flags: bus master, fast devsel, latency 0, IRQ 22
       Memory at fc300000 (64-bit, non-prefetchable) [size=16K]
       Capabilities: [50] Power Management version 2
       Capabilities: [60] Message Signalled Interrupts: Mask- 64bit+ Queue=0/0 Enable-
       Capabilities: [70] Express Root Complex Integrated Endpoint, MSI 00
       Capabilities: [100] Virtual Channel <?>
       Capabilities: [130] Root Complex Link <?>
       Kernel driver in use: HDA Intel
       Kernel modules: snd-hda-intel

</pre> speaker-test runs without error (as long as I kill esd first) but it generates no sound. And YES, I have checked alsamixer to make sure that it isn't muted.

<pre> root@stinkerbelle:~# cat /proc/asound/version Advanced Linux Sound Architecture Driver Version 1.0.16. Compiled on Jun 18 2008 for kernel 2.6.24-19-generic (SMP). </pre> After the upgrade to Intrepid, I get this result: <pre> root@stinkerbelle:~# cat /proc/asound/version Advanced Linux Sound Architecture Driver Version 1.0.17. </pre>


It looks like the right alsa driver for my chipset is snd-hda-intel

Here is the USB audio device as reported by lsusb -v: <pre> Bus 004 Device 003: ID 0d8c:0008 C-Media Electronics, Inc. Device Descriptor:

 bLength                18
 bDescriptorType         1
 bcdUSB               1.10
 bDeviceClass            0 (Defined at Interface level)
 bDeviceSubClass         0 
 bDeviceProtocol         0 
 bMaxPacketSize0        64
 idVendor           0x0d8c C-Media Electronics, Inc.
 idProduct          0x0008 
 bcdDevice            1.00
 iManufacturer           0 
 iProduct                1 C-Media USB Audio Device   

</pre>

Solution for Aspire 6920 sound

  • buy a $7 usb audio dongle
  • modprobe snd-usb-audio
  • System > Preferences > Sound
set the default device to be usb audio

The main goal was to get skype working and it does now. Another main goal is to have sound in wine apps like WoW. That is still untested. May have to change a setting in winecfg.

Sound in firefox

Generally sound is working through the usb audio device, but there is still no sound from firefox when it is playing flash videos.

This recipe is supposed to help:

  • install alsa-oss (already done)
  • edit /etc/firefox/firefoxrc
set FIREFOX_DSP="aoss" (it was set to "none")
  • restart firefox and sound should work

Better solution for sound after kernel upgrade

Went through the steps for troubleshooting sound on Ubuntu again and still was unable to get sound to work. But another google search for my sound card model turned up the solution:

  • Add "options snd-hda-intel model=auto" to the end of /etc/modprobe.d/alsa-base
  • reboot
  • sound works through built-in speakers and through headphone jack