Forcing Audacity to use the default ALSA device (dmix) for output

Help for Audacity on GNU/Linux.
Forum rules
ImageThis forum is for Audacity on GNU/Linux.
Please state:
  • which version of Linux you are using,
  • the exact three-section version number of Audacity from Help menu > About Audacity,
  • whether you installed your distribution's release, PPA version, or compiled Audacity from source code.

Audacity 1.2.x and 1.3.x are obsolete and no longer supported. If you still have those versions, please upgrade (see https://www.audacityteam.org/download/).
The old forums for those versions are now closed, but you can still read the archives of the 1.2.x and 1.3.x forums.
Post Reply
sofcyqkn
Posts: 10
Joined: Wed Jul 25, 2018 10:24 am
Operating System: Linux Debian

Forcing Audacity to use the default ALSA device (dmix) for output

Post by sofcyqkn » Wed Jul 25, 2018 10:55 am

I'm using an USB sound card that has dmix disabled by default, so I've manually created a dmix device in asound.conf, made my USB sound card its slave and set the dmix sevice as the default output device. With this setup all of my other programs output to the dmix device, but Audacity always attempts to reserve the physical device for itself. This messes up the audio for the whole system and results in loud and nasty distortion which is probably not good for the speakers or the amp. Selecting the dmix device as output in Audacity releases the physical device and fixes the system audio, but I have to do this even if my dmix device is already selected when Audacity starts.

Is there any way to block Audacity from attempting to use the sound card directly? I'd even be happy with completely hiding the device systemwide so that it's only visible to the dmix device that uses it, if that's possible. I'm using plain ALSA, PulseAudio is not an option.

steve
Site Admin
Posts: 80752
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Forcing Audacity to use the default ALSA device (dmix) for output

Post by steve » Wed Jul 25, 2018 11:25 am

Which version of Audacity?
Which Linux distribution?

With Audacity 2.2.2 on Xubuntu, if I set the playback device to dmix in the device toolbar and then restart Audacity, dmix is still selected as the playback device. Is that not happening for you?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

sofcyqkn
Posts: 10
Joined: Wed Jul 25, 2018 10:24 am
Operating System: Linux Debian

Re: Forcing Audacity to use the default ALSA device (dmix) for output

Post by sofcyqkn » Wed Jul 25, 2018 12:03 pm

Audacity 2.2.2, 64-bit Gentoo.

It's still selected in the toolbar for me as well, but I have to reselect it (switch to any other device and then back to dmix) for Audacity to actually start using it.

Or maybe Audacity is using it but also reserves the physical device at startup for no reason?

steve
Site Admin
Posts: 80752
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Forcing Audacity to use the default ALSA device (dmix) for output

Post by steve » Wed Jul 25, 2018 12:31 pm

sofcyqkn wrote:
Wed Jul 25, 2018 12:03 pm
Or maybe Audacity is using it but also reserves the physical device at startup for no reason?
Audacity scans the sound system when the application launches (so that it can populate the Device Toolbar with a list of available devices), but it does not reserve any devices. Audacity connects to devices dynamically (on demand, when Play or Record or monitoring are started).
sofcyqkn wrote:
Wed Jul 25, 2018 10:55 am
PulseAudio is not an option
People usually say that when they have flaky ALSA drivers or other sound system problems that they are unable to resolve. Why is PulseAudio not an option for your computer?
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

steve
Site Admin
Posts: 80752
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Forcing Audacity to use the default ALSA device (dmix) for output

Post by steve » Wed Jul 25, 2018 12:34 pm

I've just tested playing a file with:

Code: Select all

aplay -D"plug:'dmix:RATE=44100'" "./test.wav"
and playing Audacity 2.2.2 via dmix at the same time, and it works fine here, so I don't think it is anything intrinsically wrong with Audacity.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

sofcyqkn
Posts: 10
Joined: Wed Jul 25, 2018 10:24 am
Operating System: Linux Debian

Re: Forcing Audacity to use the default ALSA device (dmix) for output

Post by sofcyqkn » Wed Jul 25, 2018 1:02 pm

The problem is not dmix not working (like I said it does work), but the fact that every time I start Audacity it's attempting to use the sound card directly even when it's not selected. I don't know if it happens when scanning for the devices, but since no other program I use does this I don't see how it's not a problem with Audacity.

Is it possible to configure Audacity not to automatically scan for new devices at startup?

steve
Site Admin
Posts: 80752
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Forcing Audacity to use the default ALSA device (dmix) for output

Post by steve » Wed Jul 25, 2018 1:35 pm

sofcyqkn wrote:
Wed Jul 25, 2018 1:02 pm
Is it possible to configure Audacity not to automatically scan for new devices at startup?
No. Audacity needs to scan the sound system so that it can populate the options in the Device Toolbar.
It may help you to debug the problem by forcing Audacity to rescan. That option is near the bottom of the Transport menu.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

sofcyqkn
Posts: 10
Joined: Wed Jul 25, 2018 10:24 am
Operating System: Linux Debian

Re: Forcing Audacity to use the default ALSA device (dmix) for output

Post by sofcyqkn » Wed Jul 25, 2018 2:10 pm

steve wrote:
Wed Jul 25, 2018 1:35 pm
sofcyqkn wrote:
Wed Jul 25, 2018 1:02 pm
Is it possible to configure Audacity not to automatically scan for new devices at startup?
No. Audacity needs to scan the sound system so that it can populate the options in the Device Toolbar.
It may help you to debug the problem by forcing Audacity to rescan. That option is near the bottom of the Transport menu.
Rescanning does cause the same distortion I get at startup. I'll try playing around with my ALSA config, maybe there's something in the way I've set up dmix I could change.

sofcyqkn
Posts: 10
Joined: Wed Jul 25, 2018 10:24 am
Operating System: Linux Debian

Re: Forcing Audacity to use the default ALSA device (dmix) for output

Post by sofcyqkn » Wed Jul 25, 2018 4:29 pm

Strangely enough, disabling OSS emulation support in the kernel seems to have solved the problem.

Post Reply