LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-12-2018, 05:12 AM   #1
Lysander666
Senior Member
 
Registered: Apr 2017
Location: The Underearth
Distribution: Slackware
Posts: 1,861
Blog Entries: 5

Rep: Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956
Adding dmix/alsaequal to asound.conf to use two or more simultaneous audio streams


Yesterday I came across an issue when trying to make something play through Audicious. I came across the error message

Quote:
snd_pcm_open: device or resource busy
Now this seems to mean that only one audio stream can use the sound card at a time. From reading around, it seems I need to add dmix to asound.conf in order to remedy this. Apparently dmix is native but not enabled. I am rather surprised that this is not enabled by default.

Anyway, can I just add dmix to my asound.conf like this? Where card/device is 0,0:

Code:
 ctl.equal {
    type equal;
    }
   
    pcm.plugequal {
      type equal;
      slave.pcm "plughw:0,0";
      }
    
    pcm.!default {
      type plug;
      slave.pcm plugequal;
      }

 pcm.!default {
     type plug
     slave.pcm "softvol"
     }
     
  pcm.softvol {
     type softvol
     slave {
        pcm "dmix:0,0"
        }
     control {
        name "Pre-Amp"
        card 1
        }
     min_dB -5.0
     max_dB 20.0
     resolution 6
     }
This also enables the pre-amp. Taken from this page:

https://docs.slackware.com/howtos:ha...s_on_slackware

Or maybe more simply to add

Code:
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
}
Re:

https://www.alsa-project.org/main/in.../Asoundrc#dmix

Or is there a better way to do this?

Apparently I can comment out some lines in alsa.conf but I'd rather not touch that.

I'm using alsaequal mixer, btw.

Last edited by Lysander666; 02-15-2018 at 03:49 AM.
 
Old 02-12-2018, 08:29 AM   #2
GazL
LQ Guru
 
Registered: May 2008
Posts: 5,182
Blog Entries: 18

Rep: Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897Reputation: 2897
Your second example is pretty much what I use (with minor alterations). The problems arise when some badly behaved application decides to bypass your default device and open the underlying alsa device directly.

If you can ensure that all your sound producing apps use either 'default' or the name you've given to your dmix device, rather than anything like hw:0 or 'front', then you should have no problems.

Last edited by GazL; 02-12-2018 at 08:36 AM.
 
Old 02-12-2018, 12:55 PM   #3
Lysander666
Senior Member
 
Registered: Apr 2017
Location: The Underearth
Distribution: Slackware
Posts: 1,861

Original Poster
Blog Entries: 5

Rep: Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956
Thank you, I am still having issues though. I deleted /etc/asound.conf and for now am just using .asoundrc to keep things simple.

My alsaequal plugin works but dmix is not working. I am still getting the error message that the device is busy if I have one or more audio streams playing.

Here are the contents of .asoundrc:

Code:
pcm.!default {
	type hw
	card 0
}

ctl.!default {
	type hw           
	card 0
}

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
		0 0
	}
}

ctl.dmixer {
	type hw
	card 0
}

 ctl.equal {
    type equal;
    }
   
    pcm.plugequal {
      type equal;
      slave.pcm "plughw:0,0";
      }
    
    pcm.!default {
      type plug;
      slave.pcm plugequal;
      }
Strangely, I cannot test with

Code:
aplay -f cd -D default test.wav
since I'm told that test.wav does not exist. I will read around but am stumped for now on what the issue is.

Last edited by Lysander666; 02-12-2018 at 12:57 PM.
 
Old 02-12-2018, 09:10 PM   #4
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: Carrollton, Texas
Distribution: Slackware64 14.2
Posts: 3,459

Rep: Reputation: 1799Reputation: 1799Reputation: 1799Reputation: 1799Reputation: 1799Reputation: 1799Reputation: 1799Reputation: 1799Reputation: 1799Reputation: 1799Reputation: 1799
In the directory where you ran
Code:
aplay -f cd -D default test.wav
is there a file named "test.wav"?

If there isn't, that's why you got that error message.

EDIT: I used to run with dmix in my alsa setup. You can get sound distortion if the input sample rate is too different.

Last edited by Richard Cranium; 02-12-2018 at 09:11 PM.
 
Old 02-13-2018, 12:52 AM   #5
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 12,471
Blog Entries: 9

Rep: Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377
slackers, maybe this can help?
https://wiki.archlinux.org/index.php...hitecture#Dmix
dmix has always been working on my arch box, however whenever i try to do some alsa tweaking, it stops working and i quickly undo everything i tweaked...
 
Old 02-13-2018, 03:48 AM   #6
Lysander666
Senior Member
 
Registered: Apr 2017
Location: The Underearth
Distribution: Slackware
Posts: 1,861

Original Poster
Blog Entries: 5

Rep: Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956
Quote:
Originally Posted by Richard Cranium View Post
In the directory where you ran
Code:
aplay -f cd -D default test.wav
is there a file named "test.wav"?

If there isn't, that's why you got that error message.
This is such a basic point, I'm surprised I missed it. I ran it from /home. I just got confused because aplay -l can be run from anywhere, it seems. I didn't have to be inside /usr/share/alsa/, which is where I think one has to be to run that test.

Quote:
Originally Posted by ondoho View Post
That looks like a very useful link and this part

Code:
pcm.dsp {
    type plug
    slave.pcm "dmix"
}
is remarkably simple. I'll try it and report back.

Interestingly, I'm pretty sure I remember that mixing was available as standard in root. I didn't have to do anything. But root did not, to my memory, have alsaequal. I think alsaequal somehow conflicted with mixing audio streams in my user account.

The Arch page also says:

Quote:
Mixing enables multiple applications to output sound at the same time. Most discrete sound cards support hardware mixing, which is enabled by default if available. Integrated motherboard sound cards (such as Intel HD Audio), usually do not support hardware mixing. On such cards, software mixing is done by an ALSA plugin called dmix. This feature is enabled automatically if hardware mixing is unavailable.
I am running an integrated HD audio card and I think mixing was enabled my default, but conflicted when alsaequal was enabled in my user account.

EDIT: This user seems to have had a similar issue on the Arch forum with conflicts. I may try out his .asoundrc.

Last edited by Lysander666; 02-13-2018 at 04:15 AM.
 
Old 02-13-2018, 11:16 AM   #7
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 12,471
Blog Entries: 9

Rep: Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377
Quote:
Originally Posted by Lysander666 View Post
I am running an integrated HD audio card and I think mixing was enabled my default, but conflicted when alsaequal was enabled in my user account.
what you quoted i think applies to archlinux, not alsa in general, but i'm not sure.

Quote:
This user seems to have had a similar issue on the Arch forum with conflicts. I may try out his .asoundrc.
it's from 2010? not sure it still applies. worth a try i guess.
 
Old 02-13-2018, 12:15 PM   #8
enorbet
Senior Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Slackware = Main OpSys for decades while testing others to keep up
Posts: 2,441

Rep: Reputation: 2452Reputation: 2452Reputation: 2452Reputation: 2452Reputation: 2452Reputation: 2452Reputation: 2452Reputation: 2452Reputation: 2452Reputation: 2452Reputation: 2452
Orchestrated, and possibly simultaneous multiple outputs for simpler, cheaper audio chipsets like those in most onboard audio chips are the main raison d'etre for pulseaudio even though Jack does it better. Are you alsa-only or using pulseaudio?
 
Old 02-13-2018, 12:27 PM   #9
Lysander666
Senior Member
 
Registered: Apr 2017
Location: The Underearth
Distribution: Slackware
Posts: 1,861

Original Poster
Blog Entries: 5

Rep: Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956
Quote:
Originally Posted by ondoho View Post
it's from 2010? not sure it still applies. worth a try i guess.
I gave it a go - something definitely happened. My CPU usage shot up to 50% with no other desktop programs open. This made testing rather difficult since if I tried to test e.g. qmplay2 and play something through Audacious, I was at 100%. It was too slow. So I just removed the part of .asoundrc that I had taken from that post in the Arch forum and CPU usage plummeted back down.

However, that may mean that dmix started working, but with less than ideal settings. Though I remember Audacious did start but threw out a new error.

I do wonder if this is all permission based, seeing as I don't think I had this issue with the root account [i.e. it could play two streams]. Though there's nothing that chown shows that makes me think Asla/Pulse would be affected.

Enorbet - I'm using Pulse Audio as well as Alsa.

By the way, inxi -F gives this as the sound card:

Code:
Audio:     Card Intel NM10/ICH7 Family High Def. Audio Controller
           driver: snd_hda_intel
EDIT: It's definitely not a problem with the root account. I logged in and was able to use qmplay2, Youtube and a terminal-based pink-noise test simultaneously.

Last edited by Lysander666; 02-15-2018 at 04:02 AM.
 
Old 02-13-2018, 02:14 PM   #10
Lysander666
Senior Member
 
Registered: Apr 2017
Location: The Underearth
Distribution: Slackware
Posts: 1,861

Original Poster
Blog Entries: 5

Rep: Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956
Solved it - the solution came from here:

https://wiki.archlinux.org/index.php...wide_equalizer

I thought that the issue lay with the fact that alsaequal had somehow conflicted with dmix. In the end the problem was one very small section of .asoundrc. Rather than:

Code:
    pcm.plugequal {
      type equal;
      slave.pcm "plughw:0,0";

this section should read:

Code:
    pcm.plugequal {
      type equal;
      slave.pcm "plug:dmix";
there is also no need to specify 0:0 since this is the default.

Now .asoundrc reads:

Code:
pcm.!default {
    type hw
    card 0
}

ctl.!default {
    type hw
    card 0
}

 ctl.equal {
    type equal;
    }

    pcm.plugequal {
      type equal;
      slave.pcm "plug:dmix";
      }

    pcm.!default {
      type plug;
      slave.pcm plugequal;
      }
Seeing as the original guidance for .asoundrc re alsaequal came from Slackdocs I wonder if the page should be updated.

Last edited by Lysander666; 02-13-2018 at 02:17 PM.
 
2 members found this post helpful.
Old 02-13-2018, 05:50 PM   #11
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 9,147

Rep: Reputation: 3971Reputation: 3971Reputation: 3971Reputation: 3971Reputation: 3971Reputation: 3971Reputation: 3971Reputation: 3971Reputation: 3971Reputation: 3971Reputation: 3971
Just wanted to mention: the default .asoundrc settings are here:

/usr/share/alsa/alsa.conf
 
Old 02-14-2018, 01:06 AM   #12
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 12,471
Blog Entries: 9

Rep: Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377
Quote:
Originally Posted by Lysander666 View Post
Solved it
are you saying both dmix and alsaequal are working now?
 
Old 02-14-2018, 03:06 AM   #13
Lysander666
Senior Member
 
Registered: Apr 2017
Location: The Underearth
Distribution: Slackware
Posts: 1,861

Original Poster
Blog Entries: 5

Rep: Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956
Quote:
Originally Posted by ondoho View Post
are you saying both dmix and alsaequal are working now?
Yes, they both are. As I say, dmix was indeed enabled by default, but the settings I used as suggested on the Slackdocs page did not, as far as I can see, allow for dmix to work with alsaequal [they effectively removed dmix from the equation]. The slightly revised version above allows for both to work.

I should note that though I tested two applications - qmplay2 and Audacious, and both worked simultaneously - I only opened alsaequal with alsamixer -D equal, I didn't try moving the sliders about. It opened with no issue and showed my saved settings. If anyone wants to try to reproduce the above it may be interesting.

Quote:
Originally Posted by dugan View Post
Just wanted to mention: the default .asoundrc settings are here:

/usr/share/alsa/alsa.conf
Thank you for that, good to know.

Last edited by Lysander666; 02-14-2018 at 03:23 AM.
 
Old 02-14-2018, 01:14 PM   #14
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 12,471
Blog Entries: 9

Rep: Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377Reputation: 3377
holy cow, it works.
thanks for sharing.
now how to add a fork to record master output...
 
1 members found this post helpful.
Old 02-15-2018, 06:29 AM   #15
Lysander666
Senior Member
 
Registered: Apr 2017
Location: The Underearth
Distribution: Slackware
Posts: 1,861

Original Poster
Blog Entries: 5

Rep: Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956Reputation: 1956
Quote:
Originally Posted by ondoho View Post
holy cow, it works.
thanks for sharing.
now how to add a fork to record master output...
To be honest, the Arch page is excellent and the Slackdocs one pales in comparison.

For ease, I'll quote the Arch page here:

Code:
/etc/asound.conf
-----------------------------
pcm.eq {
    type ladspa

    # The output from the EQ can either go direct to a hardware device
    # (if you have a hardware mixer, e.g. SBLive/Audigy) or it can go
    # to the software mixer shown here.
    #slave.pcm "plughw:0,0"
    slave.pcm "plug:dmix"

    # Sometimes you may need to specify the path to the plugins,
    # especially if you have just installed them.  Once you have logged
    # out/restarted this should not be necessary, but if you get errors
    # about being unable to find plugins, try uncommenting this.
    #path "/usr/lib/ladspa"

    plugins [
    {
        label mbeq
        id 1197
        input {
            # The following setting is just an example, edit to your own taste:
            # bands: 50hz, 100hz, 156hz, 220hz, 311hz, 440hz, 622hz, 880hz, 1250hz, 1750hz, 25000hz,
            # 50000hz, 10000hz, 20000hz
            controls [ -5 -5 -5 -5 -5 -10 -20 -15 -10 -10 -10 -10 -10 -3 -2 ]
            }
        }
    ]
}

# Redirect the default device to go via the EQ - you may want to do
# this last, once you are sure everything is working.  Otherwise all
# your audio programs will break/crash if something has gone wrong.
pcm.!default {
    type plug
    slave.pcm "eq"
}

# Redirect the OSS emulation through the EQ too (when programs are running through "aoss")
pcm.dsp0 {
    type plug
    slave.pcm "eq"
}
Maybe take a look at the same page and see if it helps you with your fork.

EDIT: updated the Slackdocs page.

Last edited by Lysander666; 02-15-2018 at 06:53 AM.
 
1 members found this post helpful.
  


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
/etc/asound.conf NEED CHANGES USUARIONUEVO Slackware 4 02-09-2016 05:22 PM
limiting simultaneous batch streams on Linux server Ed Bascom Linux - Server 4 03-28-2012 07:07 AM
play multiple sound streams on ALSA dmix knobby67 Programming 4 10-06-2011 12:37 PM
Software audio mixing (simultaneous audio streams) in Slackware? malloc Slackware 19 05-11-2011 09:25 PM
Purpose of asound.conf? ananth86coolguy Linux - Newbie 1 11-30-2009 03:11 AM

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

All times are GMT -5. The time now is 12:10 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration