This guide uses PulseAudio and gnome-media pacakages in order to get surround sound (both 5.1 and 7.1) out of your Bodhi machine through your HDMI connection. Surround sound is possible without these packages but is much more difficult to configure. Furthermore, “fast switching” between surround sound and on board sound is much easier with PulseAudio installed, as is keyboard shortcuts and GUI interface. Lastly, for those PulseAudio doubters, it’s gotten substantially better in the last year or so, I recommend giving it another try.
The guide will show how to:
Real Simple:
sudo apt-get install pulseaudio gnome-media
I have two methods for doing this, one is less “clean” but easier to do so I’ll explain both, starting with the easier method and you can decide which to use.
cd /usr/share/pulseaudio/alsa-mixer/profile-sets
sudo leafpad default.conf
[Mapping analog-mono] device-strings = hw:%f channel-map = mono paths-output = analog-output analog-output-speaker analog-output-desktop-speaker analog-output-headphones analog-output-headphones-2 analog-output-mono analog-output-lfe-on-mono paths-input = analog-input-front-mic analog-input-rear-mic analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line priority = 1 [Mapping analog-stereo] device-strings = front:%f hw:%f channel-map = left,right paths-output = analog-output analog-output-speaker analog-output-desktop-speaker analog-output-headphones analog-output-headphones-2 analog-output-mono analog-output-lfe-on-mono paths-input = analog-input-front-mic analog-input-rear-mic analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line priority = 10 [Mapping analog-surround-40] device-strings = surround40:%f channel-map = front-left,front-right,rear-left,rear-right paths-output = analog-output analog-output-speaker analog-output-desktop-speaker analog-output-lfe-on-mono priority = 7 direction = output [Mapping analog-surround-41] device-strings = surround41:%f channel-map = front-left,front-right,rear-left,rear-right,lfe paths-output = analog-output analog-output-speaker analog-output-desktop-speaker analog-output-lfe-on-mono priority = 8 direction = output [Mapping analog-surround-50] device-strings = surround50:%f channel-map = front-left,front-right,rear-left,rear-right,front-center paths-output = analog-output analog-output-speaker analog-output-desktop-speaker analog-output-lfe-on-mono priority = 7 direction = output [Mapping analog-surround-51] device-strings = surround51:%f channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe paths-output = analog-output analog-output-speaker analog-output-desktop-speaker analog-output-lfe-on-mono priority = 8 direction = output [Mapping analog-surround-71] device-strings = surround71:%f channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe,side-left,side-right description = Analog Surround 7.1 paths-output = analog-output analog-output-speaker analog-output-desktop-speaker analog-output-lfe-on-mono priority = 7 direction = output [Mapping iec958-stereo] device-strings = iec958:%f channel-map = left,right paths-input = iec958-stereo-input paths-output = iec958-stereo-output priority = 5 [Mapping iec958-ac3-surround-40] device-strings = a52:%f channel-map = front-left,front-right,rear-left,rear-right priority = 2 direction = output [Mapping iec958-ac3-surround-51] device-strings = a52:%f channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe priority = 3 direction = output [Mapping hdmi-stereo] device-strings = hdmi:%f description = Digital Stereo (HDMI) paths-output = hdmi-output-0 channel-map = left,right priority = 4 direction = output [Mapping hdmi-surround] description = Digital Surround 5.1 (HDMI) device-strings = hdmi:%f paths-output = hdmi-output-0 channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe priority = 3 direction = output [Mapping hdmi-stereo-extra1] description = Digital Stereo (HDMI) nr 2 device-strings = hdmi:%f,1 paths-output = hdmi-output-1 channel-map = left,right priority = 2 direction = output [Mapping hdmi-surround-extra1] description = Digital Surround 5.1 (HDMI) nr 2 device-strings = hdmi:%f,1 paths-output = hdmi-output-1 channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe priority = 1 direction = output [Mapping hdmi-stereo-extra2] description = Digital Stereo (HDMI) nr 3 device-strings = hdmi:%f,2 paths-output = hdmi-output-2 channel-map = left,right priority = 2 direction = output [Mapping hdmi-surround-extra2] description = Digital Surround 5.1 (HDMI) nr 3 device-strings = hdmi:%f,2 paths-output = hdmi-output-2 channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe priority = 1 direction = output [Mapping hdmi-stereo-extra3] description = Digital Stereo (HDMI) nr 4 device-strings = hdmi:%f,3 paths-output = hdmi-output-3 channel-map = left,right priority = 2 direction = output [Mapping hdmi-surround-extra3] description = Digital Surround 5.1 (HDMI) nr 4 device-strings = hdmi:%f,3 paths-output = hdmi-output-3 channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe priority = 1 direction = output
cd /usr/share/pulseaudio/alsa-mixer/profile-sets
sudo leafpad default.conf
My system uses hdmi:%f and I only have a 5.1 setup so I took the following profile from the above code:
[Mapping hdmi-surround] description = Digital Surround 5.1 (HDMI) device-strings = hdmi:%f paths-output = hdmi-output-0 channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe priority = 3 direction = output
You should now have “sound” listed under accessories → preferences → sound
In here you will be able to click the “hardware” tab where, click here, under profiles you'll see a list (depending on which method you used above), switching is as easy as clicking on the profile that you want
Here I will provide one example and hope that it suffices for everyone to get their setup working for them.
aplay -l
cd /usr/share/pulseaudio/alsa-mixer/profile-sets sudo leafpad default.conf
pactl set-card-profile # output:PROFILE
#/bin/bash
sleep 2 && pactl set-card-profile # output:PROFILE
chmod a+x FILENAME
cd /etc/xdg/autostart
sudo leafpad nm-applet.desktop
Exec=gnome-volume-control-applet
leafpad /.e/e/applications/startup/.order
/etc/xdg/autostart/gnome-sound.desktop
CODE:
leafpad ~/volume.sh
paste this code:
#!/bin/bash # PulseAudio volume changer and osd for notify-osd # depends on: notify-osd, pulseaudio # original version (v1.1) by sen # current version (v1.2) by wecing # -- config -- VOLUME_SAVE="/dev/shm/saved_vol" STEP=5 VOLUME=$(( $(pacmd dump |grep set-sink-volume |cut -d" " -f3) / 655 )) DEVICE=$(pacmd dump |grep "set-sink-volume" |cut -d" " -f2) MUTED=$(pacmd dump | grep "set-sink-mute" | cut -d " " -f3) # -- increase volume -- if [[ $1 = '-i' ]] && [[ VOLUME -lt 100 ]]; then if [[ VOLUME+STEP -lt 100 ]]; then VOLUME=$((VOLUME+STEP)) else VOLUME=100 fi # -- decrease volume -- elif [[ $1 = '-d' ]]&& [[ VOLUME -gt 0 ]]; then if [[ VOLUME-STEP -gt 0 ]]; then VOLUME=$((VOLUME-STEP)) else VOLUME=0 fi # -- toggle mute -- elif [[ $1 = '-t' ]]; then if [[ ! -d $VOLUME_SAVE ]]; then touch $VOLUME_SAVE fi if [[ VOLUME -eq 0 ]]; then VOLUME=$(cat $VOLUME_SAVE) else echo $VOLUME >| $VOLUME_SAVE VOLUME=0 fi else exit 1 fi SET=$((VOLUME*655)) pacmd set-sink-volume $DEVICE $SET > /dev/null SET_MUTED=0 if [[ VOLUME -eq 0 ]]; then SET_MUTED=1 fi pacmd set-sink-mute $DEVICE $SET_MUTED > /dev/null # -- notify-osd -- if [[ VOLUME -eq 0 ]]; then ICON=notification-audio-volume-muted else if [[ VOLUME -lt 25 ]]; then ICON=notification-audio-volume-off elif [[ VOLUME -lt 50 ]]; then ICON=notification-audio-volume-low elif [[ VOLUME -lt 75 ]]; then ICON=notification-audio-volume-medium else ICON=notification-audio-volume-high fi fi notify-send "Volume" -i $ICON -h int:value:$VOLUME -h string:x-canonical-private-synchronous:1
Make executable:
chmod a+x ~/volume.sh
Attach to key bindings:
left click on desktop → settings → All → Input → Keys
Find your media buttons, attach them to “command” and make command the following (example is for volume down & using the path that I used in this tutorial)
bash ~/volume.sh -d
for increase use -i and for mute use -t
#/bin/bash sleep 2 && xrandr --output HDMI1 --auto & sleep 4 && xrandr --output LVDS1 --off & sleep 6 && pactl set-card-profile 0 output:hdmi-surround & sleep 10 && xbmc
Just like that my laptop becomes a sweet media box, another key binding reverts it back to my daily machine.
1.
sudo leafpad /etc/asound.conf
2. paste this into it
pcm.pulse {
type pulse
}
ctl.pulse {
type pulse
}
pcm.!default {
type pulse
}
ctl.!default {
type pulse
}
3. save,close, reboot
If you would like to comment or make further suggestions, please leave a note on our Comments page (you will have to Create an Account if you haven't already).
Original Author - jmadero