Re: output sound to HDMI and analog simultaneously

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

First of all, i don't speak english, but with my limited knowledge i'll try.

If i understood you want to output the same sound in analog(Sound Card) and HDMI(via IGP or VGA) simultaneously. I think that have varies forms to do this, but i find only the shared above.

I used Fedora and actually use Archlinux, with gnome and alsa. I don't use pulseaudio like some others.

If you use gnome and alsa, maybe my solution work for you.

I create a configuration file in my home user directory named .asoundrc and inside this file a create the way to do sound simultaneously HDMI and Analog Sound Card.

If you don't know nothing about .asoundrc or config files of alsa sound, i recommend some links:

http://alsa.opensrc.org/.asoundrc

http://alsa.opensrc.org/index.php/Asoundrc.txt

http://alsa.opensrc.org/index.php/Hardware_mixing,_software_mixing

In the first link in up to down direction, have a solution to make Dupe output to multiple cards, is in this direction you have follow.

You have know what is the number of card and maybe device of each sound card in your pc.

Try this command in terminal to know what sound devices you have:

aplay -l

In my case this is the output of this command:

**** List of PLAYBACK Hardware Devices ****
card 0: SB [HDA ATI SB], device 0: ALC1200 Analog [ALC1200 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: SB [HDA ATI SB], device 1: ALC1200 Digital [ALC1200 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: HDMI [HDA ATI HDMI], device 3: ATI HDMI [ATI HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0


Note that my Analog device is card 0 and device 0 -> card 0: SB [HDA ATI SB], device 0: ALC1200 Analog [ALC1200 Analog]

And my HDMI is card1 and device3 -> card 1: HDMI [HDA ATI HDMI], device 3: ATI HDMI [ATI HDMI]

For joining the output sound for both i use the follow script in the file .asoundrc in my home user directory(~/.asoundrc or for the every user in /etc/asound.conf) Create this file if he not exist.

###############################################################
#          Configuration to output sound in HDMI
#        and in Analog Sound Device Simultaneously
###############################################################

# Begin Stereo Output
# Joining two Sound Cards as the same sound output
# This is only for 2 channels audio
# I use dmix to share the soundcard for every compatible application

pcm.2asone_ATISB_dmix {
    type dmix
    ipc_key 170300
    # "hw:0,0" is Card 0 Device 0 - ALC1200 Analog
    # Change this line bellow to accord you Analog Device
    slave.pcm "hw:0,0"
}

pcm.2asone_ATIHDMI_dmix {
    type dmix
    ipc_key 170310
    # "hw:1,3 is Card 1 Device 3 - ATI HDMI
    # Change this line bellowto accord you HDMI Device
    slave.pcm "hw:1,3"
}

pcm.mic_dsnoop {
    type dsnoop
    ipc_key 15645
    slave {
        # "hw:0,0" is Card 0 Device 0 - ALC1200 Analog
        # I use the mic plugged in the Analog Card
        # Change this line bellow to accord you Mic Device
        pcm "hw:0,0"
    }
}

pcm.2sndcardas1 {
    type multi
    slaves.a.pcm "2asone_ATISB_dmix"
    slaves.a.channels 2
    slaves.b.pcm "2asone_ATIHDMI_dmix"
    slaves.b.channels 2

    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
}


pcm.2asone {
    type route
    slave.pcm "2sndcardas1"   
    ttable.0.0 1
    ttable.1.1 1
    ttable.0.2 1
    ttable.1.3 1
}

# duplex device combining our PCM devices defined above
pcm.2asone_asym {
    type asym
    playback.pcm "2asone"
    capture.pcm "mic_dsnoop"
}

# This is if you don't want set he as default device
# You maybe know how to set up some application
# to use this plug
pcm.2as1plug
{
    type plug
    slave.pcm "2asone"
    # The line commented bellow is for ocasion
    # to use the mic, so comment the line above
    # and uncomment the line bellow
    # slave.pcm "2asone_asym"
    # hint for KDE phonon
    hint {
        show on
        description "HDMI and Analog as One"
    }
}


# Uncomment this to make the output
# to both sound card as system default
# pcm.!default {
#   type plug
#   slave.pcm "2asone_asym"
# }

###############################################################

The # in the script is to comment the instructions to alsa, with this alsa don't make nothing is like this not exist. If you like to make he you default device in hole system, delete the # caracters in the section !default, equal above(this uncomment a line):

pcm.!default {
   type plug
   slave.pcm "2asone_asym"
}

With this you default device is a Virtual device output sound to both sound cards simultaneously. Some applications don't work with this or need some configuration to work. Gnome and some application with use gstreamer need configuration via gconf to use the default system. This Virtual device support software mixing to playback and capture, some applications don't use this device, he taken the hardware directly and this script don't work for they.

To create this file use a file editor(gedit or another), is a pure text file.

In some system load he maybe lost the syncronization of sound output. In my tests in a preempt_rt kernel this is dificulty to happen, but preempt_rt kernel is too old and my system crash some times, i think is the xorg is up to date for the kernel.

Don't forgot to change some lines in the script to work with you particular set.

That is, i hope this help you.



On 18-11-2010 18:09, z wrote:
Hi,
I have a (new) HTPC running Ubuntu 10.10 on a Gigabyte GA-H55M-D2H board (with an Intel i3). I have a Samsung LCD TV and an (old) stereo receiver. I'd like to connect the HTPC to the TV using an HDMI, so that I can watch movies, and connect it to the stereo with an a analog RCA, to listen to music.
I am new to Linux, so please bare out with me...
In Ubuntu's sound configuration I could only configure the sound output to either go to digital HDMI or analog. Is there a way to direct the sound to both, simultaneously?
Thanks,
Zohar.
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user

[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux