e

How to create an ALSA modprobe file to tweak your sound hardware

Experience Level: Beginner and up

Prerequisites: hard drive install

**Pre-amble**

What is your preferred sound device?

Some people have enabled their onboard motherboard sound device or disabled it and

some use a pci card or

have an USB device.

What will a modprobe file do?

Its a modprobe options config file.

And therefore it can be used to show for some devices :

—–index and/or

—–model= and/or

—–quirk=string and/or

—–irq settings etc. irq = Interrupts and is mainly for ISA cards.

The purpose of model is to either enable surround sound or change the mixer controls to allow some other tweak to occur.

The main purpose of index is to set the preferred device to index=0 when you have 2 or more sound devices.

Index is an excellent way of setting up your hard drive install so that an onboard sound device does not grab index=0 if you want a pci card or USB device to be your preferred sound device.

Let me demonstrate some of modprobe.conf options with my cheap motherboard onboard sound.

DISCLAIMER

I take no responsibility for any damage your hardware suffers as a result of you following any information in this wiki. = Try at own risk

Watch out for modinfo section in particular.

Watch out for typos you make in your modprobe.conf file.

TIP Where possible use a terminal which you can copy and paste into a text editor to avoid typos.

**Research your device**

TIP copy and paste some commands into a terminal to see what you get.

Firstly does your kernel detect your hardware?

$ lspci | grep Audio

00:1b.0 Audio device: Intel Corporation N10/ICH 7 Family High Definition Audio Controller (rev 01)

Next, does the kernel have a module that supports your hardware?

$ lsmod | grep snd

snd_hda_codec_idt      59739  1 
snd_hda_intel          23931  1 
snd_hda_codec          91169  2 snd_hda_codec_idt,snd_hda_intel
snd_hwdep              13272  1 snd_hda_codec
snd_pcm                75935  2 snd_hda_intel,snd_hda_codec
snd_timer              24609  1 snd_pcm
snd                    55680  8 snd_hda_codec_idt,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer
soundcore              12600  1 snd
snd_page_alloc         14036  2 snd_hda_intel,snd_pcm

Next, does your model type have codec support?

$ cat /proc/asound/card0/codec#0 | grep Codec 

Codec: SigmaTel STAC9221 A2

Now for intel users we look at HD-Audio-Models.txt

and we scroll down to my model and here are the choices

STAC9220/9221

ref		Reference board
3stack	D945 3stack
5stack	D945 5stack + SPDIF
intel-mac-v1	Intel Mac Type 1
intel-mac-v2	Intel Mac Type 2
intel-mac-v3	Intel Mac Type 3
intel-mac-v4	Intel Mac Type 4
intel-mac-v5	Intel Mac Type 5
intel-mac-auto Intel Mac (detect type according to subsystem id)
macmini	Intel Mac Mini (equivalent with type 3)
macbook	Intel Mac Book (eq. type 5)
macbook-pro-v1 Intel Mac Book Pro 1st generation (eq. type 3)
macbook-pro	Intel Mac Book Pro 2nd generation (eq. type 3)
imac-intel	Intel iMac (eq. type 2)
imac-intel-20	Intel iMac (newer version) (eq. type 3)
ecs202	ECS/PC chips
dell-d81	Dell (unknown)
dell-d82	Dell (unknown)
dell-m81	Dell (unknown)
dell-m82	Dell XPS M1210
auto		BIOS setup (default)

**What is a stack**

It actually means the number of color coded sound input AND outputs.

I have 3 on motherboard but have 2 connectors to front of desktop computer, giving me 5 stacks.

** Create the modprobe file (in this example to enable surround sound)**

One way of doing it is:

sudo leafpad /etc/modprobe.d/modprobe.conf

contents are:

options snd-hda-intel model=5stack

Replace leafpad, in the command, with the name of your text editor.

** Reboot to test **

oi41.tinypic.com_qygz61.jpg

So by comparing the top image which is surround sound to the bottom image which is 2 channel sound, you decide which is best for your hardware.

If you have no 5.1 speaker system stay with 2 channel.

** Alternative to reboot **

Or install a extra package

sudo apt-get install alsa-base

(then restart alsa)

sudo alsa force-reload

Then you can swap various options into your modprobe.conf and save rebooting for testing purposes.

YMMV as I have a closed source nvidia driver for video card but there is a suggestion that some users may still lose the X windows and log you out.

** Using modprobe file to use USB device (or a second sound device) as preferred device **

If you want your USB device to be your preferred sound device then use an index value.

Index values count start from zero and not from one.

options snd-usb-audio index=0

options snd-hda-intel index=1

The formula for anyone with 4 sound devices is:

options modulename1 index=0

options modulename2 index=1

options modulename3 index=2

options modulename4 index=3

For each module, you can have another line for any tweaks.

One example is:

options modulename1 index=0

options modulename1 model=modelstring

options modulename2 index=1

options modulename2 index=2

options modulename2 index=3

** Testing an index value **

Lets pretend you don't want to do it all at once but confirm that your internal card has lost index=0

Here is one way of doing it.

Your modprobe.conf becomes (change the modulename to yours)

options snd_hda_intel index=1

reboot to test

How do we test?

$ alsamixer 
cannot open mixer: No such file or directory

Test is success …..alsamixer ALWAYS attempts to open index=0 card unless we specify the card number

so lets see if index=1 card exists?

$ alsamixer -c1

(or)

alsamixer -c 1

Note in following image, I had not set the model=string value so only a basic mixer is showing.

oi39.tinypic.com_166lq9d.jpg

** What determines index value? **

If you have no settings that interfere with Alsa, index 0 is the one “granted” to the first detected and configured device.

Normally that would be your internal device.

So by giving the internal an index NOT 0, O index value becomes available to any other device you enable or insert.

Note when you run alsamixer without any tweaks, it will always try to open the index=0 sound device.

Skype is a prime example of software that wants to use your index=0 device and does not easily accept configs where you have 2 devices and trying to use the 'wrong' one.

**HDMI**

I don't have such a device so rely on http://alsa.opensrc.org/DigitalOut

Run the command or commands

aplay -l
(or)
cat /proc/asound/devices

Find the index number which means the card number.

Create a file save as .asoundrc in your home folder

Whose contents are a fomula…in a code box for display purposes only

pcm.!default {
type hw
card <the card number you worked out above>
device <the device number you worked out above>
} 

Example

play -l 

**** List of PLAYBACK Hardware Devices **** 
card 0: Intel [HDA Intel], device 0: ALC272X Analog [ALC272X Analog] 
  Subdevices: 0/1 
  Subdevice #0: subdevice #0 
  
  ---other results for card 0 not displayed 

card 1: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI] 
  Subdevices: 1/1 
  Subdevice #0: subdevice #0
  
  --- other results for card 1 not displayed

.asoundrc contents becomes…code box used for display reasons only

pcm.!default {
type hw
card 1
device 0
}  

Alternative method

From

https://bbs.archlinux.org/viewtopic.php?pid=884344#p884344

run the command

cat /proc/asound/pcm

You are likely to see multiple hdmi outputs so create the .asoundrc and try each in turn.

See the alsamixer wiki, this wiki needs hdmi users to edit to improve it, thanks

** Alternative wiki for USB or second device users **

** What about you **

** Other examples of modprobe file contents **

Inside the same code box but each line comes from a different file.

options snd-intel8x0 ac97_quirk 
options snd-au8820 pcifix 3
options snd-azt2316 irq 9

** WARNING Using modinfo in modprobe file **

Not for beginners but may be needed depending on the feature you need.

Everyone can at least explore their sound module with command

modinfo -p modulename

My example

$ modinfo -p snd_hda_intel

power_save_controller:Reset controller in power save mode.
power_save:Automatic power-saving timeout (in second, 0 = disable).
beep_mode:Select HDA Beep registration mode (0=off, 1=on, 2=mute switch on/off) (default=1).
patch:Patch file for Intel HD audio interface.
enable_msi:Enable Message Signaled Interrupt (MSI)
single_cmd:Use single command to communicate with codecs (for debugging only).
probe_only:Only probing and no codec initialization.
probe_mask:Bitmask to probe codecs (default = -1).
bdl_pos_adj:BDL position adjustment offset.
position_fix:DMA pointer read method.(0 = auto, 1 = LPIB, 2 = POSBUF, 3 = VIACOMBO).
model:Use the given board model.
enable:Enable Intel HD audio interface.
id:ID string for Intel HD audio interface.
index:Index value for Intel HD audio interface.

Testing one of the parameters.

my modprobe.conf

options snd_hda_intel probe_only

reboot and test

alsamixer

Now fails which is expected as no codec has been enabled by my config.

Don't forget to redo all of your proper settings in modprobe.conf

Good luck

** credits **

Add yourself if you have modified wiki please

The alsa-base suggestion comes from Bodhi forum and am waiting to see if I can name the sweet delightful person.

Naturally I thank all the alsa people and the package maintainers who provide documents.

** Feedback or having trouble?**

If you like, feel free to edit this wiki for any detected errors.

Trouble?

Start a new thread here http://forums.bodhilinux.com/index.php?/forum/8-request-support/

lspci | grep Audio

lsusb.......if you have an USB device

aplay -l

cat /proc/asound/devices

cat /proc/asound/pcm

aplay -L

lsmod | grep snd

cat /proc/asound/card0/codec#0 | grep Codec 

now run

 alsamixer -V all 

and take a screenshot of the settings.

I prefer mtpaint application for taking screenshots. It can take a full screen then you can select a part of the shot to save. But I save as…and select jpeg and boost quality to 100% and name file….something.jpg

If you happen to know that you have 2 devices and the trouble is with the second card then run

 alsamixer -c1 -V all 

Now upload that image so we can see in the post….or start a new thread.

If you want to control your image , try

http://tinypic.com/

Otherwise try

http://ompldr.org/

To embed the image into the forum posting try this – It does not have to end in jpg….its just an example

[img] www.something.jpg [/img]

good luck



User Feedback

alsa_index
Did you find this article helpful?
Yes, right on the money!
 
22%(4)
Somewhat. Needs work.
 
39%(7)
Not really
0%(0)
Not at all.
 
39%(7)

If you would like to comment or make further suggestions, please leave a note on our Comments page (you will have to Create an Account if you haven't already).


Original wiki by aus9

 
alsa_index.txt · Last modified: 2012/01/16 17:06 by aus9 · [Old revisions]


© Copyright Bodhi Linux 2012. All Rights Reserved - Hosted by vaultnetworks