Changes

7,736 bytes added ,  09:44, 5 August 2013
Added Linux "Default Sound Card" page
Welcome to Simone Giustetti's wiki pages.


Languages: '''English''' - [http://www.giustetti.net/wiki/index.php?title=scheda_sonora_di_default Italiano]

----


I recently upgraded my "work" machine to Slackware 14.0 from a previously in use 13.37 release, that started to be too old for my needs. The upgrade procedure was easy and straightforward: in a couple of hours I could reboot to the new system. Unfortunately I noticed some annoying issues with the sound card later while configuring it. In the following article I'll discuss the issues and the corresponding solution.


While configuring the audio subsystem, the 3.2.29 kernel detected two sound cards instead of the only one the previously in use 2.6.37 kernel did. The newly detected card was set as default for the operating system but did not seem to work. Some annoying issues with the installed multimedia applications arose:
* It was difficult / nearly impossible to set a decent volume level for some programs.
* The mixer volume controlling device needed to be selected after each reboot.
* '''No more than one multimedia application at a time seemed able to access the mixer'''. The earlier run one exclusively seized mixers and sound cards preventing others from reproducing any sound.
* Sound related error messages appeared uninterruptedly.
* It was '''impossible to reproduce sound files or clips with Wine'''.
The situation was unbearable. Reverting to Slackware 13.37 was not an option so I decided to try and solve the configuration issues.


== Problem-solving ==
My first goal consisted in understanding why the 3.2.29 kernel was detecting two sound cards in a machine with only one. I started by reading the pseudo-file '''/proc/asound/cards''':
root@darkstar_5:~# '''cat''' /proc/asound/cards
0 [Generic ]: HDA-Intel - HD-Audio Generic
HD-Audio Generic at 0xfeb44000 irq 42
1 [Generic_1 ]: HDA-Intel - HD-Audio Generic
HD-Audio Generic at 0xfeb40000 irq 16
Then I read the device configuration for both cards from the output produced by command '''amixer'''. Each card was selected using the '''-c''' option:
root@darkstar_5:~# '''amixer info''' ''-c'' 0
Card default 'Generic'/'HD-Audio Generic at 0xfeb44000 irq 42'
Mixer name : 'ATI R6xx HDMI'
Components : 'HDA:1002aa01,00aa0100,00100200'
Controls : 5
Simple ctrls : 1
root@darkstar_5:~# '''amixer info''' ''-c'' 1
Card hw:1 'Generic_1'/'HD-Audio Generic at 0xfeb40000 irq 16'
Mixer name : 'Realtek ALC269VB'
Components : 'HDA:10ec0269,144dc608,00100100'
Controls : 17
Simple ctrls : 11
I thus learned that the second detected sound card was not a real device but the '''ATI video card [http://en.wikipedia.org/wiki/Hdmi HDMI] output device''' instead. Support for HDMI was introduced in kernel release 3.2 that explained why Slackware 13.37 had no issue with the ATI card: The 2.6 kernel could not manage the hardware anyhow.


== Solutions ==
With the problem cause discovered two tentative solutions were possible:
# Disable the HDMI device in order for the operating system to ignore it.
# Set the Realtek card as the default one for the system.

I chose the former path given that I do not usually connect external devices to the video card anyway. The idea consisted in disabling the HDMI related kernel module by adding a '''blacklist''' entry in the '''/etc/modprobe.d/alsa-base.conf''' file. I needed the module name and in order to obtain it run command '''lspci''' using option '''-v'''. A synthesis of the output I got follows:
root@darkstar_5:~# lspci -v
...
00:01.1 Audio device: Advanced Micro Devices [AMD] nee ATI BeaverCreek HDMI Audio [Radeon HD 6500D and 6400G-6600G series]
Subsystem: Advanced Micro Devices [AMD] nee ATI BeaverCreek HDMI Audio [Radeon HD 6500D and 6400G-6600G series]
Flags: bus master, fast devsel, latency 0, IRQ 42
Memory at feb44000 (32-bit, non-prefetchable) [size=16K]
Capabilities: [50] Power Management version 3
Capabilities: [58] Express Root Complex Integrated Endpoint, MSI 00
Capabilities: [a0] MSI: Enable+ Count=1/1 Maskable- 64bit+
Capabilities: [100] Vendor Specific Information: ID=0001 Rev=1 Len=010 <?>
'''Kernel driver in use: snd_hda_intel'''
...
00:14.2 Audio device: Advanced Micro Devices [AMD] Hudson Azalia Controller (rev 01)
Subsystem: Samsung Electronics Co Ltd Device c608
Flags: bus master, slow devsel, latency 32, IRQ 16
Memory at feb40000 (64-bit, non-prefetchable) [size=16K]
Capabilities: [50] Power Management version 2
'''Kernel driver in use: snd_hda_intel'''
Both cards needed the same module. Blacklisting snd_hda_intel module was impossible: the latter solution, '''configuring the Realtek card as default''', seemed the only feasible one.


The installed [http://www.alsa-project.org/main/index.php/Main_Page ALSA] library version, 1.0.26, can work without any configuration files, by directly interfacing to the system. To bypass the system configuration and impose a customized one the configuration files are needed. For this particular case I created file '''/etc/asound.conf''' aimed at configuring sound cards for the whole system. The file affects audio subsystem configuration for all users. The following entries were added to the file:
root@darkstar_5:~# '''cat''' /etc/asound.conf
# Set the realtek sound card as the default one
defaults.ctl.card 1
defaults.pcm.card 1
defaults.pcm.device 0
To check the configuration update I restarted ALSA:
root@darkstar_5:~# '''/etc/rc.d/rc.alsa restart'''
Loading ALSA mixer settings: /usr/sbin/alsactl restore
Found hardware: "HDA-Intel" "Realtek ALC269VB" "HDA:10ec0269,144dc608,00100100" "0x144d" "0xc608"
Hardware is initialized using a generic method
And was immediately able to verify it complied with my wishes:
root@darkstar_5:~# '''amixer info''' ''-c'' 0
Card hw:0 'Generic'/'HD-Audio Generic at 0xfeb44000 irq 42'
Mixer name : 'ATI R6xx HDMI'
Components : 'HDA:1002aa01,00aa0100,00100200'
Controls : 5
Simple ctrls : 1
root@darkstar_5:~# '''amixer info''' ''-c'' 1
Card hw:1 'Generic_1'/'HD-Audio Generic at 0xfeb40000 irq 16'
Mixer name : 'Realtek ALC269VB'
Components : 'HDA:10ec0269,144dc608,00100100'
Controls : 17
Simple ctrls : 11
root@darkstar_5:~# '''amixer info''' ''-d'' default
Card default 'Generic_1'/'HD-Audio Generic at 0xfeb40000 irq 16'
Mixer name : 'Realtek ALC269VB'
Components : 'HDA:10ec0269,144dc608,00100100'
Controls : 17
Simple ctrls : 11
To double check I started a test sound file reproduction by running the '''aplay''' command. The "default" output card was selected using the '''-D''' option:
root@darkstar_5:~# '''aplay''' ''-D'' default /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
Both speakers reproduced the "front center" words sequence when previously I managed to get only an annoying silence.


For any feedback, questions, errors and such, please e-mail me at ''studiosg [at] giustetti [dot] net''


External links

----

* [http://www.alsa-project.org/main/index.php/Documentation La documentazione del progetto ALSA]
* [https://wiki.archlinux.org/index.php/Advanced_Linux_Sound_Architecture La pagina dedicata ad ALSA del WIKI di ArchLinux]

----

Languages: '''English''' - [http://www.giustetti.net/wiki/index.php?title=scheda_sonora_di_default Italiano]