VectorLinux

Please login or register.

Login with username, password and session length
Advanced search  

News:

Visit our home page for VL info. For support and documentation, visit the Vector Linux Knowledge Center or search the Knowledge Center and this Forum using the search box above.

Author Topic: ALSA: Output Single Source to Multiple Devices  (Read 615 times)

Rytz

  • Member
  • *
  • Posts: 91
ALSA: Output Single Source to Multiple Devices
« on: December 20, 2016, 10:01:38 am »

Greetings:

I spent many hours yesterday scouring the interwebs on how to configure ALSA for a single source, multiple device output configuration.  I have a standard internal analog jack (onboard Intel) and HDMI audio through my NVidia video card.

Thus far, I can get both audio devices working correctly individually, but not jointly.  Technically, I was able to get both devices working together, however I was only getting random pops and crackles as an output.

I also noticed that with single working HDMI audio output, there is 100-200 milliseconds behind its visual counterpart.

Any suggestions on how to get both audio outputs working together at the same time appreciated.  Also, any information on how to remove the HDMI audio latency / delay appreciated. Thanks!

Here's the configuration stuff and asound.conf files used:

aplay -L
Code: [Select]
null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=PCH
    HDA Intel PCH, ALC887 Analog
    Default Audio Device
sysdefault:CARD=PCH
    HDA Intel PCH, ALC887 Analog
    Default Audio Device
front:CARD=PCH,DEV=0
    HDA Intel PCH, ALC887 Analog
    Front speakers
surround40:CARD=PCH,DEV=0
    HDA Intel PCH, ALC887 Analog
    4.0 Surround output to Front and Rear speakers
surround41:CARD=PCH,DEV=0
    HDA Intel PCH, ALC887 Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=PCH,DEV=0
    HDA Intel PCH, ALC887 Analog
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=PCH,DEV=0
    HDA Intel PCH, ALC887 Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=PCH,DEV=0
    HDA Intel PCH, ALC887 Analog
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
hdmi:CARD=NVidia,DEV=0
    HDA NVidia, HDMI 0
    HDMI Audio Output
hdmi:CARD=NVidia,DEV=1
    HDA NVidia, HDMI 1
    HDMI Audio Output

aplay -l
Code: [Select]
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC887 Analog [ALC887 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

speaker-test -D default:CARD=PCH -c 2
Code: [Select]
speaker-test 1.0.26

Playback device is default:CARD=PCH
Stream parameters are 48000Hz, S16_LE, 2 channels
Using 16 octaves of pink noise
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 2048 to 8192
Period size range from 1024 to 1024
Using max buffer size 8192
Periods = 4
was set period_size = 1024
was set buffer_size = 8192

speaker-test -D hdmi:CARD=NVidia,DEV=1 -c 2
Code: [Select]
speaker-test 1.0.26

Playback device is hdmi:CARD=NVidia,DEV=1
Stream parameters are 48000Hz, S16_LE, 2 channels
Using 16 octaves of pink noise
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 64 to 16384
Period size range from 32 to 8192
Using max buffer size 16384
Periods = 4
was set period_size = 4096
was set buffer_size = 16384

asound.conf (working analog) (works by default without asound.conf)
Code: [Select]
defaults.pcm.card 0
defaults.pcm.device 0
defaults.ctl.card 0

asound.conf (working HDMI, 100-200 ms lag behind visuals)
Code: [Select]
defaults.pcm.card 1
defaults.pcm.device 7
defaults.ctl.card 1

asound.conf (static+pops dual)
Code: [Select]
pcm.!default {
        type plug
        slave.pcm both
        ttable.0.0 1.0
        ttable.1.1 1.0
        ttable.0.2 1.0
        ttable.1.3 1.0
}

pcm.ana {
        type hw
        card 0
        device 0
        channels 2
}

pcm.digi {
        type hw
        card 1
        device 7
        channels 2
}

pcm.both {
        type multi
        slaves.a.pcm "digi"
        slaves.b.pcm "ana"
        bindings.0.slave a
        bindings.0.channel 0
        bindings.1.slave a
        bindings.1.channel 1
        bindings.2.slave b
        bindings.2.channel 0
        bindings.3.slave b
        bindings.3.channel 1
}

# tested with/without, no difference
#ctl.!default {
#        type hw
#        card "NVidia"
#}
Logged
~ Rytz