Note: These instructions are specific to the Inspiron 9400/E1705, but can probably be applied to almost any HDA Intel audio device. I recently started playing around with Kubuntu 8.04 (via Wubi) on my Ispiron 9400. Of the things that just refused to work properly was audio mixing and the media buttons (which I normally use for all volume and mute stuff). The problem is that the Master and LFE (subwoofer) channels aren't synced, so changing the "master" volume leaves the sub at full volume, and muting the master doesn't mute the sub. This is KDE, and so you can partially solve this problem by using kmix to change the master channel to "PCM". Downside is that PCM cannot be muted period. That, and it's not the real master. The solution here is threefold. FIRST STEP First, edit your /etc/modprobe.d/alsa-base file and add the line "options snd-hda-intel model=dell-m27". This will change some settings for the HDA Intel driver specific to the 9400/E1705 (which is the m27). If you have a different laptop/computer using HDA Intel drivers, you can find the exact model here: http://www.mmilan.com/hda-intel-sound-cards/ Just find your audio device (Mine is the STAC9200), then find your specific model or the closest to it. Model name is the first word of each line. SECOND STEP At this point, you should have working audio devices, but we're going to need a way to change the settings the way we want. We need to be able to do three things: 1) Raise the volume of Master and LFE simultaneously 2) Lower the volume of Master and LFE simultaneously 3) Mute/Unmute Master and LFE simultaneously In order to do this, there is a very handy program called "amixer". This is a commandline interface to ALSA's mixer, which will let us directly change the volumes. Create somewhere two shell scripts (I called mine "chvol" and "mute", and put them in ~/.audio/). The contents: chvol:mute:Please excuse my horrible shell scripting. It's been a very long time since I've ever done any serious shell scripting, so I fell back to the basics (mainly grep) to get the job done quickly. You'll want to make both these files executable. chvol will take as a parameter the amount to change the volume (we're interested in mainly "1" and "-1"), and change the volume of both LFE and Master by that amount. It does this by querying amixer for the current volume, modifying that value, and setting it again. mute takes no parameters, and simply toggles on/off the mute of Master and LFE. It does this by getting the current mute setting and reversing it. Of note is that all operations here get the current values of master, so even if you muck about manually with the master/lfe settings, they will always be in sync whenever you run one of these scripts. The LFE settings will be ignored and overwritten. STEP THREE The last step is to bind these scripts to your actual media buttons. 1) I'm using Kubuntu, so this is KDE 3.5.9. Right click on anything in the K menu thing, and click "Edit Menu". This will open the KDE Menu Editor. 2) Create a new submenu, call it "Audio Controls". 3) Create in the submenu a new item called "Volume Up". Uncheck "Enable Launch Feedback" (everything should be unchecked), and set the command to "~/.audio/chvol 1" (change to match the path you have for your script). 4) Repeat step 3 for "Volume Down", setting it to "~/.audio/chvol -1". 5) Repeat step 3 for "Volume Mute", setting it to "~/.audio/mute". 6) Add keybindings to all three menu items. To do this, click on the menu item you created, click on the key image next to "Current shortcut key", and then press the media button you want to bind it to. The three keys are "XF86AudioRaiseVolume", "XF86AudioLowerVolume", and "XF86AudioMute". You can, of course, change the parameter of chvol to a bigger number if you want your volume to change faster. Your media buttons might actually be set to some sort of onscreen display after you install Kubuntu, but after you reboot your new keyboard shortcuts should override that and take precedence. EDIT: I decided I wanted some sort of OSD for myself, so I modified the above scripts to use kdialog to stick up a popup. They're hardcoded to appear roughly center on a 1920x1200 display, so you might have to adjust the --geometry bits if you run at a different res. If you don't care about having an OSD, you can just cut out everything after the final amixer call in either script.
#!/bin/bash let curvol=$(amixer get Master|egrep -om 1 "[0-9]+ \\["|cut -f 1 -d " ")+$1 echo "set Master Playback $curvol set LFE Playback $curvol" | amixer -sq if [ "$curvol" = "32" ]; then let curvol=31 elif [ "$curvol" = "-1" ]; then let curvol=0 fi let curvol*=100 let curvol/=31 killall kdialog_audio ~/.audio/kdialog_audio --geometry +910+575 --title "Volume: $curvol" --passivepopup "" 1
#!/bin/bash if [ "$(amixer get Master|egrep -om 1 "\\[(on|off)"|cut -f 2 -d "[")" = "on" ]; then echo "set Master mute off set LFE mute off" | amixer -sq killall kdialog_audio ~/.audio/kdialog_audio --geometry +910+575 --title "Volume Muted" --passivepopup "" 1 else echo "set Master mute on set LFE mute on" | amixer -sq killall kdialog_audio ~/.audio/kdialog_audio --geometry +900+575 --title "Volume Unmuted" --passivepopup "" 1 fi