LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 04-18-2014, 12:00 PM   #1
lingon
LQ Newbie
 
Registered: Apr 2014
Posts: 5

Rep: Reputation: Disabled
ALSA USB dmix help - hogs soundcard


Hello,

edit: Forgot to mention im on Debian Wheezy

I'm trying to get ALSA setup on my computer with dmix.
My problem is that I can only have one sound source, for example if I listen to music I can't hear the sound of a YouTube video at the same time, so they first application to use the USB headset as output locks it.

I have tried soooo many ways without success and has been sitting with this for more than a day straight if you add up the hours.

What I want to achieve is being able to use multiple applications sound at the same time.
Here is some debug stuff that might help.
Code:
anon@anon:~$ lspci | grep Audio
00:1b.0 Audio device: Intel Corporation Lynx Point High Definition Audio Controller (rev 05)
01:00.1 Audio device: NVIDIA Corporation Device 0e1a (rev a1)
02:00.1 Audio device: NVIDIA Corporation Device 0e1a (rev a1)
Code:
anon@anon:~$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 174c:2074 ASMedia Technology Inc. 
Bus 001 Device 003: ID 046d:c223 Logitech, Inc. G11/G15 Keyboard / USB Hub
Bus 002 Device 002: ID 174c:3074 ASMedia Technology Inc. 
Bus 003 Device 002: ID 8087:8008 Intel Corp. 
Bus 004 Device 002: ID 8087:8000 Intel Corp. 
Bus 001 Device 004: ID 046d:0a15 Logitech, Inc. 
Bus 001 Device 005: ID 046d:c066 Logitech, Inc. <--- this is my headset
Bus 001 Device 006: ID 046d:c226 Logitech, Inc. G15 Refresh Keyboard
Bus 001 Device 007: ID 046d:c227 Logitech, Inc. G15 Refresh Keyboard
I have successfully made my headset the default device.
Code:
anon@anon:~$ cat /proc/asound/cards
 0 [Headset        ]: USB-Audio - Logitech G35 Headset
                      Logitech Logitech G35 Headset at usb-0000:00:14.0-3.1, full speed
 1 [PCH            ]: HDA-Intel - HDA Intel PCH
                      HDA Intel PCH at 0xf5130000 irq 47
 2 [NVidia         ]: HDA-Intel - HDA NVidia
                      HDA NVidia at 0xf7080000 irq 17
 3 [NVidia_1       ]: HDA-Intel - HDA NVidia
                      HDA NVidia at 0xf5080000 irq 18
/etc/modprobe.d/alsa-base.conf
Code:
anon@anon:~$ cat /etc/modprobe.d/alsa-base.conf 
#alias snd-card-0 snd-usb-audio
#alias snd-card-1 snd-hda-intel

#options snd-hda-intel index=-2
#options snd-usb-audio index=0

# autoloader aliases
install sound-slot-0 /sbin/modprobe snd-card-0
install sound-slot-1 /sbin/modprobe snd-card-1
install sound-slot-2 /sbin/modprobe snd-card-2
install sound-slot-3 /sbin/modprobe snd-card-3
install sound-slot-4 /sbin/modprobe snd-card-4
install sound-slot-5 /sbin/modprobe snd-card-5
install sound-slot-6 /sbin/modprobe snd-card-6
install sound-slot-7 /sbin/modprobe snd-card-7
# Cause optional modules to be loaded above generic modules
install snd /sbin/modprobe --ignore-install snd && { /sbin/modprobe --quiet snd-ioctl32 ; /sbin/modprobe --quiet snd-seq ; : ; }
install snd-rawmidi /sbin/modprobe --ignore-install snd-rawmidi && { /sbin/modprobe --quiet snd-seq-midi ; : ; }
install snd-emu10k1 /sbin/modprobe --ignore-install snd-emu10k1 && { /sbin/modprobe --quiet snd-emu10k1-synth ; : ; }

# Keep snd-pcsp from beeing loaded as first soundcard
options snd-pcsp index=-2

#options snd-usb-audio index=-2

# Prevent abnormal drivers from grabbing index 0
options bt87x index=-2
options cx88_alsa index=-2
options snd-atiixp-modem index=-2
options snd-intel8x0m index=-2
options snd-via82xx-modem index=-2

#alias snd-card-0 snd-usb-audio
#alias snd-card-1 snd-hda-intel
#options snd-usb-audio index=0
#options snd-usb-audio index=0 vid=0x046d pid=0xc066

options snd-usb-audio index=-1
I know that the configuration is wrong in the asoundrc file, but this is the only
way I have made the sound working, every attempt at a dmix configuration has failed. I'm pretty sure that this is the configuration that makes it hog the usb sound output to one application that first accuires the resource.

~/.asoundrc
Code:
anon@anon:~$ cat .asoundrc
# ALSA library configuration file

# Include settings that are under the control of asoundconf(1).
# (To disable these settings, comment out this line.)
</home/anon/.asoundrc.asoundconf>

pcm.!default {
        type hw
        card 0
}

ctl.!default {
        type hw           
        card 0
}

pcm.dsp {
    type plug
    slave.pcm "dmix"
}
Im really grateful for any help that I can get about this.
Im pretty much getting down on my knees for any help from all of the experts here.

Thanks!

Last edited by lingon; 04-20-2014 at 05:58 AM.
 
Old 04-26-2014, 05:38 AM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
i have tried something like this myself a few times, and it brought me to my knees every time.
all i can say, on my archlinux install the dmix works ootb, but i never managed to set it up manually.
you are much better off installing pulseaudio or jackaudio sound architecture.

that said, what you want is definitely possible with pure alsa, but there's something very, very cryptic about it.
if you're really keen on getting raw knees, you can join the alsa-user mailing list and try asking there.
 
Old 04-26-2014, 08:51 AM   #3
Drakeo
Senior Member
 
Registered: Jan 2008
Location: Urbana IL
Distribution: Slackware, Slacko,
Posts: 3,716
Blog Entries: 3

Rep: Reputation: 483Reputation: 483Reputation: 483Reputation: 483Reputation: 483
you may want to read this it really helped me with multiple devices. http://alien.slackbook.org/blog/sett...-in-slackware/
 
Old 04-26-2014, 04:13 PM   #4
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8104Reputation: 8104Reputation: 8104Reputation: 8104Reputation: 8104Reputation: 8104Reputation: 8104Reputation: 8104Reputation: 8104Reputation: 8104Reputation: 8104
Edit: nevermind, sorry.
 
Old 04-26-2014, 05:14 PM   #5
brebs
Member
 
Registered: May 2013
Posts: 89

Rep: Reputation: Disabled
Your ~/.asoundrc is going to the hardware ("type hw"), bypassing dmix.

See my config, and tweak it to suit.
 
Old 05-05-2014, 03:54 PM   #6
lingon
LQ Newbie
 
Registered: Apr 2014
Posts: 5

Original Poster
Rep: Reputation: Disabled
Hello,

Thank for your help, haven't been working on this for weeks, but I decided to give it a go today and I got it working.
To help all you others that might have this problem.

I read this article briefly.
http://www.alsa-project.org/main/index.php/Asoundrc

And used the default ~/.asoundrc configuration from there and changed the hardware pcm from hw:1,0 to hw:0,0.
My working ~/.asoundrc configuration now looks like this:
Quote:
pcm.!default {
type plug
slave.pcm "dmixer"
}

pcm.dmixer {
type dmix
ipc_key 1024
slave {
pcm "hw:0,0"
period_time 0
period_size 1024
buffer_size 4096
rate 44100
}
bindings {
0 0
1 1
}
}

ctl.dmixer {
type hw
card 0
}
What I did after that was make sure I turned off any application that uses audio (i.e google chrome, music player etc).
Then I stopped ALSA and reloaded the kernel modules using the following:

sudo /etc/init.d/alsa-utils stop
sudo alsa reload
sudo /etc/init.d/alsa-utils start

After a quick test with two audio sources it worked just fine.
Make sure that the sound output device you want is the default #0 device (like this)
Quote:
cat /proc/asound/cards
0 [Headset ]: USB-Audio - Logitech G35 Headset
Logitech Logitech G35 Headset at usb-0000:00:14.0-3.2, full speed
1 [PCH ]: HDA-Intel - HDA Intel PCH
HDA Intel PCH at 0xf5130000 irq 47
2 [NVidia ]: HDA-Intel - HDA NVidia
HDA NVidia at 0xf7080000 irq 17
3 [NVidia_1 ]: HDA-Intel - HDA NVidia
HDA NVidia at 0xf5080000 irq 18
As you can see my prefered device is #0.
You can fix these device indexes and force default device in /etc/modprobe.d/alsa-base.conf (see my first post).
You can read some here: https://wiki.archlinux.org/index.php...d_Architecture

Thanks for your help!

Best regards
lingon
 
Old 05-06-2014, 12:47 PM   #7
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
thanks for sharing your solution!
the linux community desperately needs more documentation and howto's on alsa.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Alsa - problem with hotpluggable USB soundcard deu Linux - Hardware 1 05-13-2013 05:05 PM
Alsa: USB soundcard device disappears suddenly JonL Linux - General 1 08-04-2012 04:47 AM
alsa to use usb soundcard efus Linux - Hardware 2 07-09-2007 06:02 AM
Permission to use alsa dmix Ian_Hawdon Linux - Software 10 12-21-2005 09:09 AM
alsa dmix in ubuntu compujas Linux - General 2 08-17-2005 08:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 11:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration