You are not logged in.
Heyo! This is the first post i've made on this forum. I want your help for creating (or explaining) how can I make software mix to work? I tried every link from the search's list and none of them worked... So if can someone tell me what can I do in this case. I just want to use the pure ALSA. Not PulseAudio, nor JACK, nor PipeWire. Just, pure ALSA.
Here's my /etc/asound.conf file (same on ~/.asoundrc file too):
pcm.snd_card { # my usual sound card
type hw
card 1
}
ctl.!default { # default control; alsamixer and such will use this
type hw
card 1
}
# software mixer for sound card
pcm.dmixer {
type dmix
ipc_key 1024
ipc_perm 0666 # allow other users
slave.pcm "snd_card"
slave {
period_time 0
period_size 1024
buffer_size 4096
channels 2 # must match bindings
}
bindings {
0 0
1 1
}
}
# software mixer for loopback device
pcm.dmixerloop {
type dmix
ipc_key 2048
ipc_perm 0666 # allow other users
slave.pcm "hw:Loopback,0,0"
slave {
period_time 0
period_size 1024
buffer_size 4096
channels 2 # must match bindings
}
bindings {
0 0
1 1
}
}
# allows multiple programs to capture simultaneously
pcm.dsnooper {
type dsnoop
ipc_key 2048
ipc_perm 0666
slave.pcm "snd_card"
slave
{
period_time 0
period_size 1024
buffer_size 4096
channels 2
}
bindings {
0 0
1 1
}
}
pcm.!default {
type asym
playback.pcm "out"
capture.pcm "dsnooper"
}
# Multi, splitting onto usual card and loopback
pcm.out {
type plug
slave.pcm {
type multi
slaves {
a { channels 2 pcm "dmixer" }
b { channels 2 pcm "dmixerloop" }
}
bindings {
0 { slave a channel 0 }
1 { slave a channel 1 }
2 { slave b channel 0 }
3 { slave b channel 1 }
}
}
ttable [
[ 1 0 1 0 ] # left -> a.left, b.left
[ 0 1 0 1 ] # right -> a.right, b.right
]
}
The output for "aplay --list-devices"
~ > aplay --list-devices 00:45:17
**** List of PLAYBACK Hardware Devices ****
card 0: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 0: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 1: PCH [HDA Intel PCH], device 0: ALC233 Analog [ALC233 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
And even with that config, the software mixing still doesn't work and still limits to only one software
Last edited by gabubu (2022-04-15 14:01:59)
Offline
Do you use the loop device on purpose?
https://stackoverflow.com/questions/422 … -with-dmix - which points to a raspberry pi issue.
Basic dmix should™ be effortless, https://wiki.archlinux.org/title/Advanc … cture#Dmix
Offline
Do you use the loop device on purpose?
https://stackoverflow.com/questions/422 … -with-dmix - which points to a raspberry pi issue.
I don't even know how I have the loop device. And like I've said (or forgot idk) that config was found on other posts from other and this forum. And I'm not trying to use dmix on Raspberry Pi. I'm trying on my laptop.
Edit: Here's the config I used: https://unix.stackexchange.com/question … s-together
Basic dmix should™ be effortless, https://wiki.archlinux.org/title/Advanc … cture#Dmix
I tried and that too but no results. It still limits to one software to one output (I mean, software mixing it doesn't make the job)
Last edited by gabubu (2022-04-15 06:27:50)
Offline
Scrap the complex setup w/ the loop device, reload the alsa config. Check "aplay --list-devices" to confirm and post the output of "aplay -L" (dmix should™ show up there)
It still limits to one software to one output (I mean, software mixing it doesn't make the job)
How do you test that? Are you sure you're using the dmix device - or maybe even oss?
Try to play "mpv --audio-device=alsa/dmix:default foo.mp3" and "mpv --audio-device=alsa/dmix:default bar.mp3" concurrently.
Do you usually play over the ALC233 Analog or the HDMI device?
Offline
Loop device could come from droidcam or so. Generally I agree, the minimal config to make dmix just work is simply adjusting the defaults node which would be
defaults.pcm.!card "PCH"
defaults.ctl.!card "PCH"
and nothing else to uniquely switch to the correct card regardless of aloops presence.
Offline
Scrap the complex setup w/ the loop device, reload the alsa config. Check "aplay --list-devices" to confirm and post the output of "aplay -L" (dmix should™ show up there)
Deleted the config and rebooted.
The output for "aplay --list-devices" it's still same:
~ > aplay --list-devices 11:32:47
**** List of PLAYBACK Hardware Devices ****
card 0: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 0: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 1: PCH [HDA Intel PCH], device 0: ALC233 Analog [ALC233 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
And here's the output for "aplay -L":
~ > aplay -L 11:33:22
null
Discard all samples (playback) or generate zero samples (capture)
lavrate
Rate Converter Plugin Using Libav/FFmpeg Library
samplerate
Rate Converter Plugin Using Samplerate Library
speexrate
Rate Converter Plugin Using Speex Resampler
jack
JACK Audio Connection Kit
oss
Open Sound System
pipewire
PipeWire Sound Server
pulse
PulseAudio Sound Server
speex
Plugin using Speex DSP (resample, agc, denoise, echo, dereverb)
upmix
Plugin for channel upmix (4,6,8)
vdownmix
Plugin for channel downmix (stereo) with a simple spacialization
default
Default ALSA Output (currently PulseAudio Sound Server)
sysdefault:CARD=Loopback
Loopback, Loopback PCM
Default Audio Device
front:CARD=Loopback,DEV=0
Loopback, Loopback PCM
Front output / input
surround21:CARD=Loopback,DEV=0
Loopback, Loopback PCM
2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Loopback,DEV=0
Loopback, Loopback PCM
4.0 Surround output to Front and Rear speakers
surround41:CARD=Loopback,DEV=0
Loopback, Loopback PCM
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Loopback,DEV=0
Loopback, Loopback PCM
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Loopback,DEV=0
Loopback, Loopback PCM
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Loopback,DEV=0
Loopback, Loopback PCM
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
usbstream:CARD=Loopback
Loopback
USB Stream Output
sysdefault:CARD=PCH
HDA Intel PCH, ALC233 Analog
Default Audio Device
front:CARD=PCH,DEV=0
HDA Intel PCH, ALC233 Analog
Front output / input
surround21:CARD=PCH,DEV=0
HDA Intel PCH, ALC233 Analog
2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=PCH,DEV=0
HDA Intel PCH, ALC233 Analog
4.0 Surround output to Front and Rear speakers
surround41:CARD=PCH,DEV=0
HDA Intel PCH, ALC233 Analog
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=PCH,DEV=0
HDA Intel PCH, ALC233 Analog
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=PCH,DEV=0
HDA Intel PCH, ALC233 Analog
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=PCH,DEV=0
HDA Intel PCH, ALC233 Analog
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
hdmi:CARD=PCH,DEV=0
HDA Intel PCH, HDMI 0
HDMI Audio Output
usbstream:CARD=PCH
HDA Intel PCH
USB Stream Output
~ > 11:35:13
How do you test that? Are you sure you're using the dmix device - or maybe even oss?
I play music from Audacity and from osu! (a rhythm game) via ALSA.
Try to play "mpv --audio-device=alsa/dmix:default foo.mp3" and "mpv --audio-device=alsa/dmix:default bar.mp3" concurrently.
Do you usually play over the ALC233 Analog or the HDMI device?
Output for "mpv --audio-device=alsa/dmix:default Music/Don\'t\ leave\ me\ here\ alone.mp3.mp3":
~ > mpv --audio-device=alsa/dmix:default Music/Don\'t\ leave\ me\ here\ alone.mp3 11:38:
[ffmpeg/demuxer] mp3: Estimating duration from bitrate, this may be inaccurate
(+) Video --vid=1 [P] (png 750x750 1.000fps)
(+) Audio --aid=1 (mp3 2ch 44100Hz)
File tags:
Artist: aryll fae
Album: Artificial.Music
Comment: If you'd like to use my music, please credit me. It's all royalty-free and free to download, but
one thing I'd like is credit.
Date: 2015
Genre: calm
Title: don't leave me here alone
[vo/x11] Warning: this legacy VO has bad performance. Consider fixing your graphics drivers, or not forcing
e x11 VO.
Displaying cover art. Use --no-audio-display to prevent this.
VO: [x11] 750x750 rgba
ALSA lib confmisc.c:855:(parse_card) cannot find card 'default'
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_card_id returned error: No such device
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_concat returned error: No such device
ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
ALSA lib conf.c:5178:(_snd_config_evaluate) function snd_func_refer returned error: No such device
ALSA lib conf.c:5701:(snd_config_expand) Evaluate error: No such device
ALSA lib pcm.c:2664:(snd_pcm_open_noupdate) Unknown PCM dmix:default
[ao/alsa] Playback open error: No such device
[ao] Failed to initialize audio driver 'alsa'
[ao] This audio driver/device was forced with the --audio-device option.
[ao] Try unsetting it.
Could not open/initialize audio device -> no sound.
Audio: no audio
Exiting... (Interrupted by error)
I don't think I need to run another command too because that's the same thing...
And yes, I play over ALC233 Analog because I don't have an HDMI monitor
Offline
Loop device could come from droidcam or so. Generally I agree, the minimal config to make dmix just work is simply adjusting the defaults node which would be
defaults.pcm.!card "PCH" defaults.ctl.!card "PCH"
and nothing else to uniquely switch to the correct card regardless of aloops presence.
Ah... so makes sense why I have the loopback device. And these 2 line where should i write to?
Offline
one of the asound.conf places, instead of that huge blob of broken config you have now.
Also something I'm seeing now
default
Default ALSA Output (currently PulseAudio Sound Server)
remove pulseaudio-alsa if that's not what you want to use.
Last edited by V1del (2022-04-15 11:24:22)
Offline
Generally I agree, the minimal config to make dmix just work is simply adjusting the defaults node which would be
defaults.pcm.!card "PCH" defaults.ctl.!card "PCH"
Tried and nothing. Still limits to one software...
remove pulseaudio-alsa if that's not what you want to use.
Tried and that and still no.
Offline
You might also have t o enforce loading the dmix plugin, see https://wiki.archlinux.org/title/Advanc … cture#Dmix again for this.
Offline
You might also have t o enforce loading the dmix plugin, see https://wiki.archlinux.org/title/Advanc … cture#Dmix again for this.
Like this?
Offline
Is the plugin now listed?
Sanity check
Here's my /etc/asound.conf file (same on ~/.asoundrc file too):
Are there still tow files and which are you editing how?
Offline
Are there still tow files and which are you editing how?
I deleted these 2 (~/.asoundrc and /etc/asound.conf files) and then created only /etc/asound.conf.
Offline
From my experience this is the only thing you need in $HOME/.asoundrc or /etc/asound.conf:
defaults.pcm.!card "PCH"
defaults.ctl.!card "PCH"
You can also try to set the card by index, e.g. this is my setup:
~ >> cat .asoundrc
defaults.ctl.card 0
defaults.pcm.card 0
~ >> aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC3236 Analog [ALC3236 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA Intel HDMI], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA Intel HDMI], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: HDMI [HDA Intel HDMI], device 8: HDMI 2 [HDMI 2]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: Headset [Logitech USB Headset], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
Last edited by karabaja4 (2022-04-15 12:38:36)
Offline
karabaja4 I tried and still nothing. Still limits to one software...
Offline
Updated output of aplay -L/--list-devices?
Offline
~ > aplay -L 16:19:58
null
Discard all samples (playback) or generate zero samples (capture)
lavrate
Rate Converter Plugin Using Libav/FFmpeg Library
samplerate
Rate Converter Plugin Using Samplerate Library
speexrate
Rate Converter Plugin Using Speex Resampler
jack
JACK Audio Connection Kit
oss
Open Sound System
pipewire
PipeWire Sound Server
pulse
PulseAudio Sound Server
speex
Plugin using Speex DSP (resample, agc, denoise, echo, dereverb)
upmix
Plugin for channel upmix (4,6,8)
vdownmix
Plugin for channel downmix (stereo) with a simple spacialization
default:CARD=Loopback
Loopback, Loopback PCM
Default Audio Device
sysdefault:CARD=Loopback
Loopback, Loopback PCM
Default Audio Device
front:CARD=Loopback,DEV=0
Loopback, Loopback PCM
Front output / input
surround21:CARD=Loopback,DEV=0
Loopback, Loopback PCM
2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Loopback,DEV=0
Loopback, Loopback PCM
4.0 Surround output to Front and Rear speakers
surround41:CARD=Loopback,DEV=0
Loopback, Loopback PCM
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Loopback,DEV=0
Loopback, Loopback PCM
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Loopback,DEV=0
Loopback, Loopback PCM
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Loopback,DEV=0
Loopback, Loopback PCM
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
usbstream:CARD=Loopback
Loopback
USB Stream Output
default:CARD=PCH
HDA Intel PCH, ALC233 Analog
Default Audio Device
sysdefault:CARD=PCH
HDA Intel PCH, ALC233 Analog
Default Audio Device
front:CARD=PCH,DEV=0
HDA Intel PCH, ALC233 Analog
Front output / input
surround21:CARD=PCH,DEV=0
HDA Intel PCH, ALC233 Analog
2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=PCH,DEV=0
HDA Intel PCH, ALC233 Analog
4.0 Surround output to Front and Rear speakers
surround41:CARD=PCH,DEV=0
HDA Intel PCH, ALC233 Analog
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=PCH,DEV=0
HDA Intel PCH, ALC233 Analog
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=PCH,DEV=0
HDA Intel PCH, ALC233 Analog
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=PCH,DEV=0
HDA Intel PCH, ALC233 Analog
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
hdmi:CARD=PCH,DEV=0
HDA Intel PCH, HDMI 0
HDMI Audio Output
usbstream:CARD=PCH
HDA Intel PCH
USB Stream Output
still same
Offline
Did you change anything? Where'S "--list-devices"?
But this looks like the loopback device is still the default and I might be missing sth. but the dmix plugin is still not listed (I actually use a HW mixer, so I can't check immediately whether it would be)
Offline
seth the output is still same...
~ > aplay --list-devices 16:25:53
**** List of PLAYBACK Hardware Devices ****
card 0: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 0: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 1: PCH [HDA Intel PCH], device 0: ALC233 Analog [ALC233 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
And the config is like that:
And still nothing
Offline
Because nothing has changed - instead of posting screenhots of "something" you could try to re-order the cards, /etc/modprobe.d/alsa-base.conf
options snd_hda_intel index=0
options snd_aloop index=1
you'll have to reboot afterwards but should be able to go completely w/o the asound.conf
Edit: and try to play two files w/ mpv (no -ao direction) and post the outputs.
Last edited by seth (2022-04-15 13:40:04)
Offline
Okay so running both mpv's at the same time works.
AND I CAN PLAY MUSIC FROM AUDACITY AND FROM OSU! AT THE SAME TIME :-D
Thank you so much. I really appreciate. You can mark now as solved :-)
Edit: idk how to edit the title to add [SOLVED] at the beginning lol
Last edited by gabubu (2022-04-15 13:51:51)
Offline
So what changed to go from "And still nothing" to " I CAN PLAY MUSIC FROM AUDACITY AND FROM OSU"?
Mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.
Offline
So to make you understand. Maybe I misunderstood or something. I tried to move from PulseAudio and use the pure ALSA instead. But that move was kinda awful from me before. What I meant is that I can play music from only one software. If I want to play music FROM another software AT THE SAME TIME, it says "busy" or error idk... I spent 3 days (including today) for searching and trying .asoundrc configs but none of them worked. So my last option was to create an account on this forum and to create a new thread. Thanks to you, seth, now it works normal. I can play 2 mpv's at the same time (example), without getting that "busy" error.
This solution fixed my problem with ALSA:
options snd_hda_intel index=0
options snd_aloop index=1
Thank you again and have a great day :-)
Last edited by gabubu (2022-04-15 14:03:33)
Offline
Ok, so for posteriority: the basic problem was that the loop device got in the way, but I'm not sure whether you simply failed to make it not the default card or that just having it on index 0 impedes dmix.
Offline
tbh i'm noob at ALSA. but from now i know what to do in that case :-)
Offline