Configuring HDMI Audio via command line

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?


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.