You are not logged in.

#1 2011-11-01 08:53:46

dwidmann
Member
From: Gordonsville, Virginia, US
Registered: 2009-05-27
Posts: 60

[Solved] Need a hand with alsa configuration

Configuring ALSA has always been a little over my head, but I try never-the-less. It would seem I've yet to get it quite right, and I could use a bit of help.

Objectives:
- For things to "just work"

Current Issues:
- No sound from Flash
- Can't open alsamixer "cannot open mixer: Invalid argument"

Current Non-Issues:
- I have sound in other things I use (KDE, Pidgin, Clementine, MPlayer, VLC, Xine...)
- Mixing seems to be working fine (for example: I can play something with Clementine and VLC at the same time, even if one is stereo and the other is surround)
- "both" seems to be functioning as intended (things are output through my computer speakers and stereo at the same time)

My asound.conf

pcm.!default plug:both
pcm.!surround51 plug:both
pcm.!surround40 plug:both

defaults.pcm.rate_converter "samplerate_best"

pcm.intel {
  type dmix
  ipc_key 456479
  ipc_key_add_uid true
  slave {
    pcm "hw:0,0"
    period_time 0
    buffer_size 65536
    buffer_time 0
    periods 128
    rate 48000
    channels 6
  }
  bindings {
    0 0
    1 1
    2 2 
    3 3
    4 4
    5 5
  }
}
pcm.nvidia {
  type dmix
  ipc_key 78632
  ipc_key_add_uid true
  slave {
    pcm "hw:2,7"
    period_time 0
    buffer_size 65536
    buffer_time 0
    periods 128
    rate 48000
    channels 6
  }
  bindings {
    0 0
    1 1
    2 2 
    3 3
    4 4
    5 5
  }
}


pcm.both {
  type route;
  slave.pcm {
    type multi;
    slaves.a.pcm "intel";
    slaves.b.pcm "nvidia";
    slaves.a.channels 6;
    slaves.b.channels 6;
    bindings.0.slave a;
    bindings.0.channel 0;
    bindings.1.slave a;
    bindings.1.channel 1;
    bindings.2.slave a;
    bindings.2.channel 2;
    bindings.3.slave a;
    bindings.3.channel 3;
    bindings.4.slave a;
    bindings.4.channel 4;
    bindings.5.slave a;
    bindings.5.channel 5;

    bindings.6.slave b;
    bindings.6.channel 0;
    bindings.7.slave b;
    bindings.7.channel 1;
    bindings.8.slave b;
    bindings.8.channel 2;
    bindings.9.slave b;
    bindings.9.channel 3;
    bindings.10.slave b;
    bindings.10.channel 4;
    bindings.11.slave b;
    bindings.11.channel 5;
  }
  ttable.0.0 1;
  ttable.1.1 1;
  ttable.2.2 1;
  ttable.3.3 1;
  ttable.4.4 1;
  ttable.5.5 1;
  ttable.0.6 1;
  ttable.1.7 1;
  ttable.2.8 1;
  ttable.3.9 1;
  ttable.4.10 1;
  ttable.5.11 1;
}

ctl.both {
  type hw;
  card 2;
  device 7;
}

ctl.!default {
  type hw;
  card 2;
  device 7;
}

ctl.nvidia {
  type hw;
  card 2;
  device 7;
}

ctl.intel {
  type hw;
  card 0;
  device 0;
}

For posterity, my revised asound.conf

pcm.!default plug:both
pcm.!surround51 plug:both
pcm.!surround40 plug:both
pcm.!dmix plug:both

defaults.pcm.rate_converter "samplerate_best"

pcm.intel {
  type dmix
  ipc_key 456479
  ipc_key_add_uid true
  slave {
    pcm "hw:0,0"
    buffer_size 5440
    period_size 1088
    rate 48000
    channels 6
  }
  bindings {
    0 0
    1 1
    2 2 
    3 3
    4 4
    5 5
  }
}
pcm.nvidia {
  type dmix
  ipc_key 78632
  ipc_key_add_uid true
  slave {
    pcm "hw:2,7"
    buffer_size 5440
    period_size 1088
    rate 48000
    channels 6
  }
  bindings {
    0 0
    1 1
    2 2 
    3 3
    4 4
    5 5
  }
}


pcm.both {
  type route;
  slave.pcm {
    type multi;
    slaves.a.pcm "intel";
    slaves.b.pcm "nvidia";
    slaves.a.channels 6;
    slaves.b.channels 6;
    bindings.0.slave a;
    bindings.0.channel 0;
    bindings.1.slave a;
    bindings.1.channel 1;
    bindings.2.slave a;
    bindings.2.channel 2;
    bindings.3.slave a;
    bindings.3.channel 3;
    bindings.4.slave a;
    bindings.4.channel 4;
    bindings.5.slave a;
    bindings.5.channel 5;

    bindings.6.slave b;
    bindings.6.channel 0;
    bindings.7.slave b;
    bindings.7.channel 1;
    bindings.8.slave b;
    bindings.8.channel 2;
    bindings.9.slave b;
    bindings.9.channel 3;
    bindings.10.slave b;
    bindings.10.channel 4;
    bindings.11.slave b;
    bindings.11.channel 5;
  }
  ttable.0.0 1;
  ttable.1.1 1;
  ttable.2.2 1;
  ttable.3.3 1;
  ttable.4.4 1;
  ttable.5.5 1;
  ttable.0.6 1;
  ttable.1.7 1;
  ttable.2.8 1;
  ttable.3.9 1;
  ttable.4.10 1;
  ttable.5.11 1;
}

#ctl.both {
#  type hw;
#  card 2;
#  device 7;
#}

#ctl.!default {
#  type hw;
#  card 2;
#  device 7;
#}

ctl.nvidia {
  type hw;
  card 2;
  device 7;
}

ctl.intel {
  type hw;
  card 0;
  device 0;
}

Last edited by dwidmann (2011-11-03 15:18:46)


"I refuse to be part of a society that encourages the rampant abuse of its own language." ~ BM

Offline

#2 2011-11-01 09:41:15

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

Re: [Solved] Need a hand with alsa configuration

I'm not aware of all the config fragments, but as for ipc_key we have:

ipc_key specfies the unique IPC key in integer. This number must be unique for each different dmix definition

here: http://www.alsa-project.org/alsa-doc/al … ugins.html

Probably you need "ipc_key 1025" for nvidia.

Last edited by student975 (2011-11-01 09:41:37)


"I exist" is the best myth I know..

Offline

#3 2011-11-01 11:22:51

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [Solved] Need a hand with alsa configuration

You have "card 2" - that equals 3 cards, starting from zero. So what's the 3rd card that you haven't mentioned?

Better to show a decent amount of info:

wget -O alsa-info.sh http://www.alsa-project.org/alsa-info.sh
bash alsa-info.sh --upload

Then show us the URL that the script shows at the end.

Offline

#4 2011-11-01 11:33:40

dwidmann
Member
From: Gordonsville, Virginia, US
Registered: 2009-05-27
Posts: 60

Re: [Solved] Need a hand with alsa configuration

The third card is my first video card's HDMI, but that isn't used.

http://www.alsa-project.org/db/?f=fdcfb … 94a376e683


"I refuse to be part of a society that encourages the rampant abuse of its own language." ~ BM

Offline

#5 2011-11-01 11:48:00

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

Re: [Solved] Need a hand with alsa configuration

Another multicard configuration thing is to be sure the order cards are numbered. Use slot option. For example, my /etc/modprobe.d/alsa.conf contains:

options snd slots=snd-hda-intel,snd-hdsp

"I exist" is the best myth I know..

Offline

#6 2011-11-01 13:40:30

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [Solved] Need a hand with alsa configuration

You have what looks like a strange mix of buffer_* and period_* settings. But anyway, what matters is what's really being used:

Play some sound, then run e.g.:

cat /proc/asound/card0/pcm0p/sub0/hw_params

Flash might not like the real buffer/period settings.

Offline

#7 2011-11-01 14:49:36

dwidmann
Member
From: Gordonsville, Virginia, US
Registered: 2009-05-27
Posts: 60

Re: [Solved] Need a hand with alsa configuration

I wrote very little of this, there was considerable copying and pasting involved.

$ cat /proc/asound/card0/pcm0p/sub0/hw_params
access: MMAP_INTERLEAVED
format: S16_LE
subformat: STD
channels: 6
rate: 48000 (48000/1)
period_size: 320
buffer_size: 5440

"I refuse to be part of a society that encourages the rampant abuse of its own language." ~ BM

Offline

#8 2011-11-03 11:14:16

rwd
Member
Registered: 2009-02-08
Posts: 664

Re: [Solved] Need a hand with alsa configuration

What happens with no asound.conf? I have never needed an asound.conf for alsamixer /alsa to work. Have you tried the steps in 'https://wiki.archlinux.org/index.php/Ad … chitecture' ?

Offline

#9 2011-11-03 11:31:50

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [Solved] Need a hand with alsa configuration

My system uses:

period_size: 1088
buffer_size: 5440

Your period_size is small - I'd try setting period_size and buffer_size to exactly mine, and getting rid of the other period/buffer lines in your config.

Offline

#10 2011-11-03 13:41:42

dwidmann
Member
From: Gordonsville, Virginia, US
Registered: 2009-05-27
Posts: 60

Re: [Solved] Need a hand with alsa configuration

rwd wrote:

What happens with no asound.conf? I have never needed an asound.conf for alsamixer /alsa to work. Have you tried the steps in 'https://wiki.archlinux.org/index.php/Ad … chitecture' ?

Well, without an asoundrc or asound.conf, you can't duplicate output to multiple cards, nor can you have dmix with both stereo and surround sources at the same time. I looked at that page, but the page that ended up being the most helpful to me was this one, I think.

brebs wrote:

My system uses:

period_size: 1088
buffer_size: 5440

Your period_size is small - I'd try setting period_size and buffer_size to exactly mine, and getting rid of the other period/buffer lines in your config.

Thanks, this worked!! The sound-in-flash issue is no more.

I still can't open alsamixer though.

Last edited by dwidmann (2011-11-03 13:43:47)


"I refuse to be part of a society that encourages the rampant abuse of its own language." ~ BM

Offline

#11 2011-11-03 13:49:04

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [Solved] Need a hand with alsa configuration

See what these do:

alsamixer -c0
alsamixer -c2

Offline

#12 2011-11-03 13:54:15

dwidmann
Member
From: Gordonsville, Virginia, US
Registered: 2009-05-27
Posts: 60

Re: [Solved] Need a hand with alsa configuration

brebs wrote:

See what these do:

alsamixer -c0
alsamixer -c2

yikes Both of these work! (Trying to launch alsamixer without -c doesn't). Now, if I hit f6 and look at the list of devices, the one at the top of the list is "- default", if I try to jump to it I get the usual error.


"I refuse to be part of a society that encourages the rampant abuse of its own language." ~ BM

Offline

#13 2011-11-03 13:58:04

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: [Solved] Need a hand with alsa configuration

Try removing the ctl.!default and ctl.both entries - I don't think they are needed.

Offline

#14 2011-11-03 14:00:26

dwidmann
Member
From: Gordonsville, Virginia, US
Registered: 2009-05-27
Posts: 60

Re: [Solved] Need a hand with alsa configuration

Ooooh, that did the trick. Thanks again.!


"I refuse to be part of a society that encourages the rampant abuse of its own language." ~ BM

Offline

Board footer

Powered by FluxBB