1

Is it possible to have (the same) audio going through HDMI and the line out on the Pi2 board at the same time?

I want to use my Pi2 as a RetroPie station, using HDMI for gaming, so video/audio are in sync, and as a ShairPort for when the TV is off. Alternatively it would be ok if I could detect if the HDMI device is on, and switch accordingly.

I don't need the two outputs to be bound to the same device. If ALSA represents them as different devices that would be ok as well. The Shairport should only use the Stereo jack.

5
  • It should be possible with JACK, at least in theory
    – jogco
    Jul 17, 2016 at 7:38
  • 2
    Possible duplicate of How to send audio to BOTH headphone jack and HDMI simultaneously?
    – goobering
    Jul 17, 2016 at 7:58
  • 1
    The duplicate does not really answer my question
    – Arne
    Jul 17, 2016 at 11:36
  • 2
    @goobering The question has been asked before but Not really a duplicate as the "answer" states it "should be possible" but does not explain HOW.
    – Milliways
    Jul 17, 2016 at 11:58
  • 1
    Apologies for the quick flagging. It's definitely possible to have audio output from the analogue and HDMI sockets simultaneously. Omxplayer, for example, has the '-o both' option that does this. I'm not confident of the audio arrangements for RetroPie, but if something pops up I'll see if I can contribute something more useful.
    – goobering
    Jul 17, 2016 at 13:06

1 Answer 1

1

I found out that I can manually switch to 3.5mm output:

 $ amixer cset numid=3 1                      
numid=3,iface=MIXER,name='PCM Playback Route'               
  ; type=INTEGER,access=rw------,values=1,min=0,max=2,step=0
  : values=1                                                

However the ALSA device does not seem to support both outputs at the same time.

The OMX API for the Broadcom chip however does seem to support setting the audio splitter to route to both outputs .

Furthermore I found out that aplay lists two devices for the Broadcom card:

**** List of PLAYBACK Hardware Devices ****                              
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]       
  Subdevices: 7/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: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
  Subdevices: 1/1                                                        
  Subdevice #0: subdevice #0                                             

The second one always being HDMI. Maybe it is possible to configure this to be the default output device for the system and use device 0 for the shairport.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.