You are not logged in.
I'm currently using ALSA and I have an audio jack from my Nintendo Switch plugged into my computer as well as a speaker through which audio is played. On Windows, I was able to use both the audio from my computer and the console simultaneously through the use of Stereo Mix. Is there an equivalent way to play multiple audio sources through one speaker at the same time?
Offline
You can merge an input into an output with snd-aloop if you want to stay on ALSA land a couple of other methods with pulse and friends.
E.g. https://wiki.archlinux.org/title/Advanc … _snd-aloop
If you need more help than that we'd need to see your setup e.g. while having audio from the switch and playing out of the speaker post
sudo fuser -v /dev/snd/*
aplay -Ll
arecord -Ll
amixer -c0 #replace with correct index from card if not 0
And post these wrapped in [ code ] [ /code ] tags without the spaces
Online
Here is the output of the listed commands in order:
USER PID ACCESS COMMAND
/dev/snd/controlC0: Tree 1197 F.... wireplumber
/dev/snd/controlC1: Tree 1197 F.... wireplumber
/dev/snd/controlC2: Tree 1197 F.... wireplumber
/dev/snd/controlC3: Tree 1197 F.... wireplumber
/dev/snd/controlC4: Tree 1197 F.... wireplumber
/dev/snd/controlC5: Tree 1197 F.... wireplumber
/dev/snd/seq: Tree 1195 F.... pipewire
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)
hdmi:CARD=NVidia,DEV=0
HDA NVidia, Sceptre M24
HDMI Audio Output
hdmi:CARD=NVidia,DEV=1
HDA NVidia, HDMI 1
HDMI Audio Output
hdmi:CARD=NVidia,DEV=2
HDA NVidia, HDMI 2
HDMI Audio Output
hdmi:CARD=NVidia,DEV=3
HDA NVidia, HDMI 3
HDMI Audio Output
usbstream:CARD=NVidia
HDA NVidia
USB Stream Output
hdmi:CARD=Generic,DEV=0
HD-Audio Generic, HDMI 0
HDMI Audio Output
usbstream:CARD=Generic
HD-Audio Generic
USB Stream Output
sysdefault:CARD=Generic_1
HD-Audio Generic, ALC671 Analog
Default Audio Device
front:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC671 Analog
Front output / input
surround21:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC671 Analog
2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC671 Analog
4.0 Surround output to Front and Rear speakers
surround41:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC671 Analog
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC671 Analog
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC671 Analog
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC671 Analog
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
usbstream:CARD=Generic_1
HD-Audio Generic
USB Stream Output
usbstream:CARD=Capture
FHD Capture
USB Stream Output
usbstream:CARD=M799B
M799B
USB Stream Output
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
**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 3: HDMI 0 [Sceptre M24]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 9: HDMI 3 [HDMI 3]
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: ALC671 Analog [ALC671 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 5: 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 5: 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
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)
usbstream:CARD=NVidia
HDA NVidia
USB Stream Output
usbstream:CARD=Generic
HD-Audio Generic
USB Stream Output
sysdefault:CARD=Generic_1
HD-Audio Generic, ALC671 Analog
Default Audio Device
front:CARD=Generic_1,DEV=0
HD-Audio Generic, ALC671 Analog
Front output / input
usbstream:CARD=Generic_1
HD-Audio Generic
USB Stream Output
sysdefault:CARD=Capture
FHD Capture, USB Audio
Default Audio Device
front:CARD=Capture,DEV=0
FHD Capture, USB Audio
Front output / input
usbstream:CARD=Capture
FHD Capture
USB Stream Output
sysdefault:CARD=M799B
M799B, USB Audio
Default Audio Device
front:CARD=M799B,DEV=0
M799B, USB Audio
Front output / input
usbstream:CARD=M799B
M799B
USB Stream Output
sysdefault:CARD=Loopback
Loopback, Loopback PCM
Default Audio Device
front:CARD=Loopback,DEV=0
Loopback, Loopback PCM
Front output / input
usbstream:CARD=Loopback
Loopback
USB Stream Output
**** List of CAPTURE Hardware Devices ****
card 2: Generic_1 [HD-Audio Generic], device 0: ALC671 Analog [ALC671 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: Generic_1 [HD-Audio Generic], device 2: ALC671 Alt Analog [ALC671 Alt Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 3: Capture [FHD Capture], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 4: M799B [M799B], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 5: 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 5: 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
Simple mixer control 'Master',0
Capabilities: pvolume pvolume-joined pswitch pswitch-joined
Playback channels: Mono
Limits: Playback 0 - 87
Mono: Playback 87 [100%] [0.00dB] [on]
Simple mixer control 'Headphone',0
Capabilities: pswitch
Playback channels: Front Left - Front Right
Mono:
Front Left: Playback [off]
Front Right: Playback [off]
Simple mixer control 'Headphone+LO',0
Capabilities: pvolume
Playback channels: Front Left - Front Right
Limits: Playback 0 - 87
Mono:
Front Left: Playback 87 [100%] [0.00dB]
Front Right: Playback 87 [100%] [0.00dB]
Simple mixer control 'PCM',0
Capabilities: pvolume
Playback channels: Front Left - Front Right
Limits: Playback 0 - 255
Mono:
Front Left: Playback 255 [100%] [0.00dB]
Front Right: Playback 255 [100%] [0.00dB]
Simple mixer control 'Front',0
Capabilities: pswitch
Playback channels: Front Left - Front Right
Mono:
Front Left: Playback [on]
Front Right: Playback [on]
Simple mixer control 'Front Mic',0
Capabilities: pvolume pswitch
Playback channels: Front Left - Front Right
Limits: Playback 0 - 31
Mono:
Front Left: Playback 0 [0%] [-34.50dB] [off]
Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'Front Mic Boost',0
Capabilities: volume
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 3
Front Left: 0 [0%] [0.00dB]
Front Right: 0 [0%] [0.00dB]
Simple mixer control 'Surround',0
Capabilities: pvolume pswitch
Playback channels: Front Left - Front Right
Limits: Playback 0 - 87
Mono:
Front Left: Playback 87 [100%] [0.00dB] [on]
Front Right: Playback 87 [100%] [0.00dB] [on]
Simple mixer control 'Center',0
Capabilities: pvolume pvolume-joined pswitch pswitch-joined
Playback channels: Mono
Limits: Playback 0 - 87
Mono: Playback 87 [100%] [0.00dB] [on]
Simple mixer control 'LFE',0
Capabilities: pvolume pvolume-joined pswitch pswitch-joined
Playback channels: Mono
Limits: Playback 0 - 87
Mono: Playback 87 [100%] [0.00dB] [on]
Simple mixer control 'Line',0
Capabilities: pvolume pswitch
Playback channels: Front Left - Front Right
Limits: Playback 0 - 31
Mono:
Front Left: Playback 0 [0%] [-34.50dB] [off]
Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'Line Boost',0
Capabilities: volume
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 3
Front Left: 3 [100%] [36.00dB]
Front Right: 3 [100%] [36.00dB]
Simple mixer control 'Capture',0
Capabilities: cvolume cswitch
Capture channels: Front Left - Front Right
Limits: Capture 0 - 31
Front Left: Capture 31 [100%] [30.00dB] [on]
Front Right: Capture 31 [100%] [30.00dB] [on]
Simple mixer control 'Capture',1
Capabilities: cvolume cswitch
Capture channels: Front Left - Front Right
Limits: Capture 0 - 31
Front Left: Capture 0 [0%] [-16.50dB] [off]
Front Right: Capture 0 [0%] [-16.50dB] [off]
Simple mixer control 'Auto-Mute Mode',0
Capabilities: enum
Items: 'Disabled' 'Enabled'
Item0: 'Enabled'
Simple mixer control 'Channel Mode',0
Capabilities: enum
Items: '2ch' '4ch' '6ch'
Item0: '2ch'
Simple mixer control 'Input Source',0
Capabilities: cenum
Items: 'Front Mic' 'Rear Mic' 'Line'
Item0: 'Line'
Simple mixer control 'Input Source',1
Capabilities: cenum
Items: 'Front Mic' 'Rear Mic' 'Line'
Item0: 'Front Mic'
Simple mixer control 'Loopback Mixing',0
Capabilities: enum
Items: 'Disabled' 'Enabled'
Item0: 'Disabled'
Simple mixer control 'Rear Mic',0
Capabilities: pvolume pswitch
Playback channels: Front Left - Front Right
Limits: Playback 0 - 31
Mono:
Front Left: Playback 0 [0%] [-34.50dB] [off]
Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'Rear Mic Boost',0
Capabilities: volume
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 3
Front Left: 0 [0%] [0.00dB]
Front Right: 0 [0%] [0.00dB]
I followed the method described in that section of the wiki using this command:
ffmpeg -f alsa -i hw:5,0,0 -f alsa -i hw:2,0,0 -filter_complex amerge output.mp3
and received the following output:
ffmpeg version n7.0.2 Copyright (c) 2000-2024 the FFmpeg developers
built with gcc 14.2.1 (GCC) 20240910
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-frei0r --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libdvdnav --enable-libdvdread --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libharfbuzz --enable-libiec61883 --enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-librav1e --enable-librsvg --enable-librubberband --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-vapoursynth --enable-version3 --enable-vulkan
libavutil 59. 8.100 / 59. 8.100
libavcodec 61. 3.100 / 61. 3.100
libavformat 61. 1.100 / 61. 1.100
libavdevice 61. 1.100 / 61. 1.100
libavfilter 10. 1.100 / 10. 1.100
libswscale 8. 1.100 / 8. 1.100
libswresample 5. 1.100 / 5. 1.100
libpostproc 58. 1.100 / 58. 1.100
[aist#0:0/pcm_s16le @ 0x5a7affcd5140] Guessed Channel Layout: stereo
Input #0, alsa, from 'hw:5,0,0':
Duration: N/A, start: 1727542448.378069, bitrate: 1536 kb/s
Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
[aist#1:0/pcm_s16le @ 0x5a7affcdadc0] Guessed Channel Layout: stereo
Input #1, alsa, from 'hw:2,0,0':
Duration: N/A, start: 1727542448.647524, bitrate: 1536 kb/s
Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
Stream #0:0 (pcm_s16le) -> amerge
Stream #1:0 (pcm_s16le) -> amerge
amerge:default -> Stream #0:0 (libmp3lame)
Press [q] to stop, [?] for help
[Parsed_amerge_0 @ 0x72e4700056c0] No channel layout for input 1
[Parsed_amerge_0 @ 0x72e4700056c0] Input channel layouts overlap: output layout will be determined by the number of distinct input channels
Output #0, mp3, to 'output.mp3':
Metadata:
TSSE : Lavf61.1.100
Stream #0:0: Audio: mp3, 48000 Hz, stereo, s16p
Metadata:
encoder : Lavc61.3.100 libmp3lame
[out#0/mp3 @ 0x5a7affcdaf40] video:0KiB audio:3487KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.006609%
size= 3487KiB time=00:03:43.14 bitrate= 128.0kbits/s speed= 1x
Exiting normally, received signal 2.
I turned my Switch on to test if the sound was working during the time ffmpeg was running and stopped it upon realizing that no audio was playing. I may have used the wrong card number but it seems unlikely.
Last edited by Meechh (2024-09-28 17:04:53)
Offline
I've switched to PulseAudio before and tried to use the simultaneous output it allows but it didn't work and I ended up with a faulty audio system (hang on "Establishing connection to PulseAudio" and I figured out it conflicted with pipewire. Tried to uninstall but it had too many dependencies and things using it so I decided against it and thought it'd be easier to just remove PulseAudio and stick to ALSA). MPlayer and FFmpeg haven't worked and I'm not sure if real-time simultaneous output from a console and a PC at the same time is even possible on Linux. If it is, I am not sure where to look...
Offline