8

I'm looking for a way to configure HDMI audio output via the command line using pulseaudio. I was able to get it running by using pavucontrol and changing it in the configuration tab, but I need a way to automate the process. I haven't been able to find any documentation at all so far. The system is a lucid install.

Edit: From what I've found, I can use pacmd set-card-profile to do this. However, whenever I try, I get an error like the following (using the default profiles as defined in /usr/share/pulseaudio/alsa-mixer/profile-sets/default.conf)

# pacmd set-card-profile 0 hdmi-stereo
Welcome to PulseAudio! Use "help" for usage information.
>>> Failed to set card profile to 'hdmi-stereo'.

# pacmd set-card-profile 0 analog-stereo
Welcome to PulseAudio! Use "help" for usage information.
>>> Failed to set card profile to 'analog-stereo'.

Why can't I change these from command line when pavucontrol works to change them?

Daenyth
  • 758
  • 2
  • 8
  • 25
  • 1
    [This answer](http://askubuntu.com/questions/14077/how-can-i-change-the-default-audio-device-from-command-line/14083#14083) may help you. – Takkat Sep 29 '11 at 19:43

3 Answers3

15

I was using the tool wrong. The correct way to do it was pactl set-card-profile 0 output:hdmi-audio. You can get a list of avilable profile names by running pacmd list-cards.

Daenyth
  • 758
  • 2
  • 8
  • 25
  • the 2nd argument (0) is the index of the card (>>> 1 card(s) available. index: 0). the 3rd argument (output:hdmi-audio) is the part before the second semicolon under "profiles:" (e.g. it's "output:hdmi-stereo" from the line output:hdmi-stereo: Digital Stereo (HDMI) Output (priority 5400)) – Elvis Nov 04 '12 at 02:31
  • 1
    it's `pactl list cards` at least in `pulseaudio-utils 1:4.0-0ubuntu22` – int_ua Nov 07 '14 at 09:31
  • @int_ua: `pactl list cards` and `pacmd list-cards` are both correct, the two tools use different syntax but provide most of the same functionality. In theory, the command to change the output profile could be `pacmd set-card-profile 0 output:hdmi-audio` (or `... output:hdmi-stereo` or whatever), either will work. – FeRD Aug 19 '15 at 12:21
0

Open a terminal and type:

sudo apt-get install alsamixergui

Then run it (Alt+F2 or press super key):

alsamixergui

A window will open for sound cofiguration...

decent
  • 88
  • 5
  • 1
    I'm not looking to edit mixer levels, I'm looking to configure the audio to use HDMI. I also said I'm not looking for a GUI tool, I need something that I can automate. – Daenyth Sep 30 '11 at 16:51
  • alsamixergui solution by @decent worked for me on Nvidia ION with 10.04 and now with 12.04, I just launched the command and **unmute** the channel **IEC 958 1** now I have audio... –  Jun 07 '12 at 08:54
-1

I found a simpler way to do this - on the Hardware tab of the System Settings Sound control, right-click on the profile drop down and select Digital Stereo (HDMI) Output + Analog Stereo input from the list.