Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a laptop with an HDMI port. While we're homeless and staying with friends I've been plugging it into their surround sound receiver with an HDMI cable. To get sound working I have to open up the sound settings jobby and switch the hardware profile from "Analogue Stereo Output" to "Digital Stereo (HDMI) Output" to have sound coming from the surround sound instead of the laptop's mincey speakers.

I have to do the reverse when I unplug it to get sound coming out of the speakers.

I'm getting a little bored of doing this. I'd like to script this. I have seen this question and its answer but pacmd list-sinks only shows one sink when the sound profile drop down shows several options.

And is there a udev event I could hook this into so it can run the script whenever the HDMI status changes?

share|improve this question
    
You can use udevadm monitor to see which udev events are triggered by HDMI status changes, but according to this: [spinics.net/lists/xorg/msg52939.html], not all are perhaps supported. –  taneli Sep 5 '11 at 12:03
    
@Oli : this seems to be automatic in 11.10 –  danjjl Sep 6 '11 at 19:19
add comment

4 Answers 4

up vote 2 down vote accepted
+50

In Ubuntu 11.10 pulseaudio will recognize when you plug hdmi (or phone jack) and will make the switch automatically.

See this:

http://voices.canonical.com/david.henningsson/?p=15

share|improve this answer
    
Very cool. Looking forward to it! –  Oli Sep 7 '11 at 13:28
    
I don't want to wait, and I was hoping not to upgrade to 11.10..! :O looks like I will be, then. –  Dang Khoa Sep 7 '11 at 19:13
add comment

In ubuntu 11.10, automatic switching still does not work. Apparently the features are not implemented yet. I am using a script to switch the sound card profile to HDMI and back.

pacmd "set-card-profile output:hdmi-stereo-extra1"

Assigned a short-cut key, life is now better. Read more about it here.

share|improve this answer
add comment

I had the same problem but its easy to fix in kubuntu...go to system settings, screen and you will find both your internal and hdmi screen...choose your settings and in the bottom choose hdmi as your default output and save your profile at the bottom...every time you log into kde it will use your hdmi screen as default and your sound output will be auto set by phonon...

share|improve this answer
add comment

There is a tool in the ubuntu repositories, padevchooser, which claims to let you change the output on the fly. I tried this and it doesn't really work for me (trying to switch output between built-in sound card and external USB music centre). The tool only lets me select "Default" and "Other..." instead of listing my two output options.

You might, however, want to have a look at this blog post describing how to write a script to change the output device to HDMI. I don't know of a way to run this automatically, but at least it's only one click, so you can bind it to an unused button on your laptop.

share|improve this answer
    
It's very easy to switch too another output device in Ubuntu. You click the sound indicator and select the audio preferences item. You then select output devices and choose which one you want. But he wanted it to be automatic. Your answer didn't really match. -1. –  Jo-Erlend Schinstad Sep 3 '11 at 3:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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