You are not logged in.

#1 2014-07-18 16:52:22

WyoPBS
Member
From: Cheyenne, WY
Registered: 2007-10-05
Posts: 101
Website

[Solved] Need help with .asoundrc / PulseAudio configuration

I have not upgraded my system for over a year, but this weekend I did and now I'm up to the bleeding-edge latest.  Everything works, after only two days of figuring out what packages were missing!  My only problem is, Skype won't use the right hardware.  I'm sure it's because I don't have the first clue how to manage .asoundrc.  None of TFM makes a bit of sense to me.  Can a hardware guru give me a hand with this?

Here's the output of my aplay -l dump:

**** List of PLAYBACK Hardware Devices ****
card 0: CODEC [USB Audio CODEC], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: Generic_1 [HD-Audio Generic], device 0: ALC662 rev1 Analog [ALC662 rev1 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

I have three audio devices:  There's the onboard HDMI, the onboard analog, and a USB mixer I use for my podcasts and voice chat -- that's card 0 in the list above (although the card number changes whenever I reboot, which is a whole 'nother problem because configurations that rely on card number get messed up).

HDMI is completely unused; my monitor plugs into the VGA portion of the onboard video/audio stuff.  So the external speakers use the card2 / device 0.  Microphone and headset, however, go through the USB mixer in card 0 / device 0.

Since I want most sounds by default to go through the analog card, .asoundrc has this:

pcm.!default {
	type hw
	card 2
	device 0
}
ctl.!default {
	type hw
	card 2
}

Then for the usb card, I have this entry:

pcm.usb-audio {
	type hw
	card 0
	device 0
}     
ctl.usb-audio {
	type hw
	card 0
	device 0
}

NEARLY everything works exactly right -- aplay, mpg123, audacity, idjc, xine, youtube, sound and voice chat in Second Life... all allow me to select either the analog card or the usb card as needed, and play through the appropriate device.

My one problem child is Skype.  All audio goes through the default device, which has no mic.  Before the upgrade, the Sound Devices section had a choice "Audio System To Use", and I could switch among ALSA or whatever other audio drivers were available; within ALSA it would let me select between the external speakers (analog card) or headphones/mic (usb).  Now... no Audio System option.  The only "choice" for mic/speakers/ringing is PulseAudio, and there's a note at the bottom telling me I have to use "your desktop manager volume control or PulseAudio volume control"

My desktop manager, fluxbox, doesn't have a volume control, and the only /usr/bin/ file that came with pulseaudio was the pulseaudio driver itself, no volume control.  In any case, volume control isn't my problem; device selection is.

I tried removing pulseaudio and pulseaudio-alsa and restarting Skype, and now the only device choice is "virtual device", with no audio at all.

Help!

Last edited by WyoPBS (2014-07-19 22:10:39)


Peter B. Steiger
Cheyenne, WY

Offline

#2 2014-07-18 17:00:56

emeres
Member
Registered: 2013-10-08
Posts: 1,570

Re: [Solved] Need help with .asoundrc / PulseAudio configuration

Use [_code_][_/code_] tags without the underscores to mark output of a command. You use 'type hw', which is not recommended and explained on the wiki. Skype dropped support for alsa. Read the alsa wiki, there are enough information how to properly set up alsa configuration.

Offline

#3 2014-07-18 17:46:00

WyoPBS
Member
From: Cheyenne, WY
Registered: 2007-10-05
Posts: 101
Website

Re: [Solved] Need help with .asoundrc / PulseAudio configuration

emeres wrote:

You use 'type hw', which is not recommended and explained on the wiki.

That's very amusing, since the wiki recommends this:

... the following would be correct for the above example.

pcm.!default {
	type hw
	card Audio
}

ctl.!default {
	type hw           
	card Audio
}
emeres wrote:

  Read the alsa wiki, there are enough information how to properly set up alsa configuration.

I must be hopelessly stupid, then, because I do not find it so.  That was the first place I looked.  It does a fine job of explaining how to set my default device; it does a fine job of explaining how to define each card (using the hw option, ha!).  It gives examples of what works for the author, such as this:

Effectively, here is an example of a working /etc/asound.conf: 
pcm.dmixer {
        type dmix
        ipc_key 1024
        ipc_key_add_uid 0
        ipc_perm 0660
}
pcm.dsp {
        type plug
        slave.pcm "dmix"
}

What does ipc_key do?  Never explained in the wiki, so I have no idea if that's unique to the author's setup, or 1024 is a universal value that will work with all my hardware, or if I need special values for specific cards.  Same for the other ipc_* options.  Furthermore, I have no idea overall what the pcm.* entries do in terms of device selection from applications.  He says it's an example of a working configuration, but for what devices?  Will it cause Skype to allow me the choice between external speakers and usb mixer?  (hint: I tried his examples, and it didn't).

At least he links to the ALSA documentation wiki, so I guess I'll prowl around there and see if they specifically mention pulseaudio, multiple devices, and/or Skype in particular. *sigh* this is just what I was trying to avoid, spending umpteen hours following links to links to links to links and trying to glean enough information from multiple sources to eventually put it all together.

Thank you for the quick response, but telling me to RTFM when I started out saying I've done exactly that and TFM didn't help... well, doesn't help.


Peter B. Steiger
Cheyenne, WY

Offline

#4 2014-07-18 18:58:28

emeres
Member
Registered: 2013-10-08
Posts: 1,570

Re: [Solved] Need help with .asoundrc / PulseAudio configuration

WyoPBS wrote:
emeres wrote:

You use 'type hw', which is not recommended and explained on the wiki.

That's very amusing, since the wiki recommends this:

Alsa wiki wrote:

Simply setting a type hw as default card is equivalent to addressing hardware directly, which leaves the device unavailable to other applications. This method is only recommended if it is a part of a more sophisticated setup ~/.asoundrc or if user deliberately wants to address sound card directly (digital output through eic958 or dedicated music server for example).

I think I remember what I wrote. This is an example configuration under Alternative method, not a recommendation. The recommended part is using modprobe. Read the whole chapter, not only what you think is sufficient.

WyoPBS wrote:

I must be hopelessly stupid, then, because I do not find it so.  That was the first place I looked.  It does a fine job of explaining how to set my default device; it does a fine job of explaining how to define each card (using the hw option, ha!).  It gives examples of what works for the author, such as this:

Then the wiki needs further rewriting and additional explanation, which is already in progress. Read the references, using direct hardware access leaves you with one sound source at a time.

WyoPBS wrote:

What does ipc_key do?  Never explained in the wiki, so I have no idea if that's unique to the author's setup, or 1024 is a universal value that will work with all my hardware, or if I need special values for specific cards.  Same for the other ipc_* options.  Furthermore, I have no idea overall what the pcm.* entries do in terms of device selection from applications.  He says it's an example of a working configuration, but for what devices?  Will it cause Skype to allow me the choice between external speakers and usb mixer?  (hint: I tried his examples, and it didn't).

Basic syntax section explains a lot and it makes references to its original source, where ipc key and other aspects are explained.

Okay, so you want to continue using Skype with pulseaudio? Delete ~/.asoundrc, install pulseaudio-alsa, which installs /etc/asound.conf, and read the pulseaudio wiki for further setup steps. I do not use pa any more, so I can help little with it.

You should consider using modprobe to set your default device, which pulseaudio should also respect.

WyoPBS wrote:

At least he links to the ALSA documentation wiki, so I guess I'll prowl around there and see if they specifically mention pulseaudio, multiple devices, and/or Skype in particular. *sigh* this is just what I was trying to avoid, spending umpteen hours following links to links to links to links and trying to glean enough information from multiple sources to eventually put it all together.

Thank you for the quick response, but telling me to RTFM when I started out saying I've done exactly that and TFM didn't help... well, doesn't help.

That does not change the fact that this is a highly inefficient ~/.asoundrc that you posted. Also the dmixer part is hopeless, there is a pcm.dmix by default. Not to mention that right after pcm.dmixer the author references to pcm.dmix. Completely hopeless.

And your previous post still has no code tags.

Last edited by emeres (2014-07-18 19:04:22)

Offline

#5 2014-07-18 19:18:51

Roken
Member
From: South Wales, UK
Registered: 2012-01-16
Posts: 1,251

Re: [Solved] Need help with .asoundrc / PulseAudio configuration

OK, to maintain hw numbering, modify (or create) /etc/modprobe.d/alsa-base.conf and number your soundcards. Mine:

options snd slots=snd_ca0106
options snd_ca0106 index=0
#options snd slots=hda-intel
#options hda-intel index=1

Then disable what you don't use by modifying (or creating) /etc/modprobe.d/alsa_blacklist.conf

Mine:

#install snd_hda_intel /bin/false
#blacklist soundcore

NB. I commented out because I no longer need them - this was all back in my Creative days. Remove the # to uncomment

You will, of course, need to adapt for your system


Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus Prime B450 Plus, 32Gb Corsair DDR4, Cooler Master N300 chassis, 5 HD (1 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703

Offline

#6 2014-07-18 19:24:32

emeres
Member
Registered: 2013-10-08
Posts: 1,570

Re: [Solved] Need help with .asoundrc / PulseAudio configuration

@Roken Why do you use both methods? Either use the newer slots or the older index method. I recommend sticking to index. And since WyoPBS has a HDMI card and another hda compliant card, one can assume they both use snd_hda_intel, meaning he must use vid and pid for this to work.

Offline

#7 2014-07-19 22:32:56

WyoPBS
Member
From: Cheyenne, WY
Registered: 2007-10-05
Posts: 101
Website

Re: [Solved] Need help with .asoundrc / PulseAudio configuration

Just a quick followup to explain how I solved it in case other travellers follow me down this road...

I installed the aur package of Skype 4.2, which still supports ALSA.

@emeres, I didn't realize you were the author of the ALSA wiki page here or I wouldn't have kept referring to you in the third person.  I plead guilty to only reading the sections I thought would help me, but in the end no amount of tweaking on the asound.conf side helped; it's a PulseAudio problem.  Your comments about the mess at the end of my config file with dmix/dmixer/whatever only highlighted my frustration at not finding documentation that explains what the various options are.  You say I should not directly access hardware and I should instead use the mixer, but how?  I read the ALSA page on plugins, and specifically the section on the dmix plugin.  There are bits and pieces but no complete working example.  So I'm left confused as to how to define my cards if the "hw" method is incorrect, and how to bind those cards to the dmix plugin.  For example, what is "client channel N"?  Where is that defined?  Mostly what I got from the ALSA site is a lot of technical documentation that reads more like an API rather than a practical guide to configuring hardware.  It's like I need to know how to set the time on my VCR and I'm reading pages of wiring diagrams instead.  But I don't blame you or the ALSA folks for writing stuff that is technically over my head; that's my fault, not yours.

@Roken, I did the blacklist thing

install snd_hda_codec_hdmi /bin/false

and now the module no longer loads, but the physical device still appears in the list (e.g., with aplay -l, /proc/asound, etc.)  Both the analog and HDMI ports of the card are both given the extremely unhelpful device name of "Generic".  I used the vid and pid options in /etc/modprobe.d/alsa-base.conf:

options snd slots=snd_usb_audio,snd_hda_intel
options snd_usb_audio index=0
options snd_hda_intel index=1  model=auto vid=1002 pid=1714
options snd_hda_intel index=2  model=auto vid=1022 pid=780d

but the two still change places at random whenever I reboot... although so far the usb has consistently been in card 0 every time, so at least that's an improvment.

Anyhow, my biggest headache was getting Skype working so I'm marking this closed.  Also adding the [_code_] tags to the first post since it was making emeres unhappy :-)

Last edited by WyoPBS (2014-07-19 22:42:13)


Peter B. Steiger
Cheyenne, WY

Offline

#8 2014-07-19 23:33:03

emeres
Member
Registered: 2013-10-08
Posts: 1,570

Re: [Solved] Need help with .asoundrc / PulseAudio configuration

WyoPBS wrote:

@emeres, I didn't realize you were the author of the ALSA wiki page here or I wouldn't have kept referring to you in the third person.

I am not the author of the whole alsa wiki page, I can only take credit for small parts of it. The quote I made comes from me however. Do not worry about it.

WyoPBS wrote:

  I plead guilty to only reading the sections I thought would help me, but in the end no amount of tweaking on the asound.conf side helped; it's a PulseAudio problem.

It is difficult to create a flow on the wiki without rewriting whole chapters. At some point a more dynamic approach on the wiki will be needed.

WyoPBS wrote:

  Your comments about the mess at the end of my config file with dmix/dmixer/whatever only highlighted my frustration at not finding documentation that explains what the various options are.  You say I should not directly access hardware and I should instead use the mixer, but how?  I read the ALSA page on plugins, and specifically the section on the dmix plugin.  There are bits and pieces but no complete working example.  So I'm left confused as to how to define my cards if the "hw" method is incorrect, and how to bind those cards to the dmix plugin.  For example, what is "client channel N"?  Where is that defined?  Mostly what I got from the ALSA site is a lot of technical documentation that reads more like an API rather than a practical guide to configuring hardware.  It's like I need to know how to set the time on my VCR and I'm reading pages of wiring diagrams instead.  But I don't blame you or the ALSA folks for writing stuff that is technically over my head; that's my fault, not yours.

The documentation is not a easy read, one prove is that people still think they need to define both period_time and period_size. Dmix enables direct mixing, meaning multiple sound sources at once, and it is usually the piece between a pcm definition for a device and hardware (type hw). Try to run multiple instances of speaker-test with the old ~/.asoundrc on the same hw device. Only one will play, the first one to get hold of the device to be precise. That is the problem, not to mention not being able use other parameters of the pcm stream than those defined, unless used with plug pcm.

Client channel would refer to channel of the application using/calling the dmix definition starting with 0 for left. Bindings would be used to change mapping of channels. Probably not necessary in your case, there are only few mandatory options in dmix, since it falls back to default node, which is often not indicated. For a more sophisticated alsa configuration you can refer to brebs signature (hope you do not mind brebs). I can also share mine for Azalia:

##Azalia
pcm.dmixazalia {	type dmix;
			ipc_key 3;
			slave {	pcm "hw:SB";
				format S32_LE;
				channels 8;
				period_size 4096;
				buffer_size 65536;
				rate 192000;	}	}

pcm.dmixazaliahq {	type dmix;
			ipc_key 4;
			slave {	pcm "hw:SB";
				rate_converter "speexrate_medium";
				format S32_LE;
				channels 8;
				period_size 4096;
				buffer_size 65536;
				rate 192000;	}	}

pcm.capazalia {	type hw;
		card SB;
		device 0;	}

pcm.azalia {	type asym;
		capture.pcm "capazalia";
		playback.pcm "dmixazalia";	}

Should Skype allow to use a pcm definition like pcm.azalia, this should work. I abandoned Skype for moral reasons some time ago, so I can not test this. You might also want to look at dsnoop.

WyoPBS wrote:
install snd_hda_codec_hdmi /bin/false

and now the module no longer loads, but the physical device still appears in the list (e.g., with aplay -l, /proc/asound, etc.)  Both the analog and HDMI ports of the card are both given the extremely unhelpful device name of "Generic".  I used the vid and pid options in /etc/modprobe.d/alsa-base.conf:

options snd slots=snd_usb_audio,snd_hda_intel
options snd_usb_audio index=0
options snd_hda_intel index=1  model=auto vid=1002 pid=1714
options snd_hda_intel index=2  model=auto vid=1022 pid=780d

but the two still change places at random whenever I reboot... although so far the usb has consistently been in card 0 every time, so at least that's an improvment.

Again, both methods are not necessary. Use only one, either slots or index, I recommend index. To disable the HDMI card use enable=0 parameter for the appropriate options entry, so in your case this should work:

options snd_hda_intel enable=0 vid=1002 pid=1714

Afterwards HDMI card should not be usable, probably also not recognized. This makes the blacklisting process of snd_hda_codec_hdmi unnecessary and easier to maintain, since only one file is involved.

WyoPBS wrote:

Anyhow, my biggest headache was getting Skype working so I'm marking this closed.  Also adding the [_code_] tags to the first post since it was making emeres unhappy :-)

You agreed to forums rules and it is easier to read, not only for me but also others. Appreciate it.

Last edited by emeres (2014-07-19 23:37:18)

Offline

#9 2018-09-19 01:05:13

nooteasy2
Member
Registered: 2018-09-19
Posts: 2

Re: [Solved] Need help with .asoundrc / PulseAudio configuration

For  my case, i created a correct profile in .asoundrc and change  the owner from  pi to root. My googtle asssitant pushtotalk  is working.


:-)

Offline

#10 2018-09-19 01:13:18

nooteasy2
Member
Registered: 2018-09-19
Posts: 2

Re: [Solved] Need help with .asoundrc / PulseAudio configuration

Below is the .asoundrc file for USB  adopter which plug into pi  zero W for google assistant.
It took me 2 days to fix this with the followings:
1.comment out the line  dtpara=audio=on
# Enable audio (loads snd_bcm2835)
#dtparam=audio=on

2.a command: sudo chown  root:root .asoundrc

pcm.!default {
  type asym
  capture.pcm "mic"
  playback.pcm "speaker"
}
pcm.mic {
  type plug
  slave {
    pcm "hw:1,0"
  }
}
pcm.speaker {
  type plug
  slave {
    pcm "hw:1,0"
  }
}


:-)

Offline

#11 2018-09-19 01:38:35

circleface
Member
Registered: 2012-05-26
Posts: 639

Re: [Solved] Need help with .asoundrc / PulseAudio configuration

nooteasy2, thanks for your contribution.  However, please do not necrobump old threads like this one.

Offline

#12 2018-09-19 02:06:18

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] Need help with .asoundrc / PulseAudio configuration


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB