Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
playing 5.1 audio using 1 sound card
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
Adel Ahmed
Veteran
Veteran


Joined: 21 Sep 2012
Posts: 1523

PostPosted: Thu Nov 11, 2021 6:03 pm    Post subject: playing 5.1 audio using 1 sound card Reply with quote

Is it possible to output surround sound using a laptop's sound card?
I want to use the 2 speakers on the TV connected via HDMI as front right and front left, the laptop speakers or a bluetooth speaker as the subwoofer and 2 speakers connected via 3.5 as the rear left and rear right, would something like this be possible? if not can i get this done by getting a usb sound card and attaching speakers to that sound card?
I'm open to using alsa, pulse or anything else that would get this done, low latency would be a great bonus though.
Code:
adel@samsung ~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC269VC Analog [ALC269VC Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

adel@samsung ~ $ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
lavrate
    Rate Converter Plugin Using Libav/FFmpeg Library
pulse
    PulseAudio Sound Server
upmix
    Plugin for channel upmix (4,6,8)
vdownmix
    Plugin for channel downmix (stereo) with a simple spacialization
sysdefault:CARD=PCH
    HDA Intel PCH, ALC269VC Analog
    Default Audio Device
front:CARD=PCH,DEV=0
    HDA Intel PCH, ALC269VC Analog
    Front output / input
surround21:CARD=PCH,DEV=0
    HDA Intel PCH, ALC269VC Analog
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=PCH,DEV=0
    HDA Intel PCH, ALC269VC Analog
    4.0 Surround output to Front and Rear speakers
surround41:CARD=PCH,DEV=0
    HDA Intel PCH, ALC269VC Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=PCH,DEV=0
    HDA Intel PCH, ALC269VC Analog
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=PCH,DEV=0
    HDA Intel PCH, ALC269VC Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=PCH,DEV=0
    HDA Intel PCH, ALC269VC 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
Back to top
View user's profile Send private message
Adel Ahmed
Veteran
Veteran


Joined: 21 Sep 2012
Posts: 1523

PostPosted: Fri Nov 12, 2021 6:09 pm    Post subject: Reply with quote

I'm trying to do thsi using pulse audio:


Code:
pacmd "load-module module-alsa-sink device=hw:0,0"
pacmd "load-module module-alsa-sink device=hw:0,3"
#pacmd load-module module-loopback sink=FOUR_CH_SINK
pactl load-module module-null-sink sink_name=FOUR_CH_SINK channels=4 channel_map=front-left,front-right,rear-left,rear-right sink_properties=device.description=virtual
pactl load-module module-loopback latency_msec=1 channels=2 channel_map=front-left,front-right source=1 sink=FOUR_CH_SINK
pactl load-module module-loopback latency_msec=1 channels=2 channel_map=rear-left,rear-right source=2 sink=FOUR_CH_SINK
pacmd "set-default-sink FOUR_CH_SINK"


the first 2 sinks are created and playback audio succesfully.
the sink called virtual however does not play any output, I was hoping to play front lef and right using hw:0,0 and rear left and right using hw:0,3.

any ideas?
Back to top
View user's profile Send private message
Adel Ahmed
Veteran
Veteran


Joined: 21 Sep 2012
Posts: 1523

PostPosted: Fri Nov 12, 2021 6:31 pm    Post subject: Reply with quote

this appears to be what I want:
Code:
pacmd "load-module module-remap-sink sink_name=FOUR_CH_SINK master=2 channels=4 master_channel_map=rear-left,rear-right channel_map=rear-left,rear-right master=1 master_channel_map=front-left,front-right channel_map=front-left,front-right remix=no"



the remap module however will not take 2 masters and remap them toa virtual sink
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3136

PostPosted: Sat Nov 13, 2021 10:44 am    Post subject: Reply with quote

I think you should be able to route channels to different physical devices with alsa alone, by creating a virtual device (in alsa config file).
Haven't tried that though. Also, if you use different physical devices, their clocks might drift, in which case after a while your channels will no longer by synchronized.

AFAIR JACK is able to use several audio devices at the same time, natively. JACK2 can't. Just in case you wanted to try.
No idea about PA.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54237
Location: 56N 3W

PostPosted: Sat Nov 13, 2021 11:32 am    Post subject: Reply with quote

Its not just clock drift, its latency well.
The different outputs have different latencies, they will need to be compensated for.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
psycho
Guru
Guru


Joined: 22 Jun 2007
Posts: 534
Location: New Zealand

PostPosted: Mon Nov 29, 2021 11:46 pm    Post subject: Reply with quote

You don't need a USB sound card...you can already output all your surround channels through the HDMI connection you're using for the TV...what you really need is a proper AV receiver (if you're thinking of shelling out for a USB sound card you might as well get a cheap receiver instead...old second hand ones don't cost much), and ideally some proper speakers. If you want to hear excruciatingly bad surround (laptop speakers as a sub...that sounds unbearable!), sending the various channels to separate mismatched speakers is possible...and if you have a decent modern TV it's possible the front two channels won't sound too horrible...but if you can possibly afford to do it properly, do it properly.

I've done the kind of thing you're suggesting (I had a nice mini hifi stereo so used that for the front speakers, a dirt-cheap 2.1 PC speaker system for the sub and rear channels, and the TV speakers for the centre/dialogue channel), and I loved it and thought it was great...until I tried a proper receiver with decent speakers in the same space, and realised what a bone-jarringly hideous noise I'd been putting up with for so long. The subs aren't just for shaking the room when horses thunder past or whatever: they add depth and realism to everything from obvious stuff like big strings in orchestras through to stuff where you don't expect it to matter, like high-pitched electric guitar solos...everything just sounds better when a decent receiver's decoding the surround data properly, taking into account the positions and physical properties of the speakers. If you just want the extra channels for direction (e.g. if you're gaming and need to hear when something's behind you), OK, hacking something together with the available speakers can make sense, no matter how bad it sounds...but otherwise, just plugging a nice pair of stereo headphones into that 3.5 jack is probably going to sound much better than a Frankenstein's monster of TV+laptop+bluetooth speakers.

I don't have a copy of the .asoundrc I used for the hybrid setup, but from memory it was pretty complex, with a virtual device for each physical output, and then a default device that would route the appropriate channels to the various virtual sound cards. It can be done...but your HDMI output can already do the job much better, if you just plug it into the right hardware.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum