Announcement

Collapse
No announcement yet.

External volume control

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • External volume control

    I thought this was already posted but couldn't find it. I have an external volume control (from a usb keyboard), have it hooked up and am wondering how to get it to control the volume for my system. I am thinking that it is probably easier to make it control the system volume and leave nghost volume maxed out, but the knob doesn't change any volume except mplayer's when playing videos.

  • #2
    Fixed it

    xbindkeys setup

    I used xbindkeys. In my .xbindkeysrc config file I added these lines:

    # Examples of commands:

    "sh $HOME/Scripts/volume-down.sh &"
    m:0x0 + c:122

    "sh $HOME/Scripts/volume-up.sh &"
    m:0x0 + c:123
    #----

    The scripts I use are found at Post #7. The process was simple. I had to modify my scripts because I have the pulseaudio equalizer running which has a separate audio device. below are my modified scripts.

    #volume-up.sh
    #!/bin/bash

    A=`pacmd dump | grep "set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo" | cut -d " " -f 3`
    B=$((A + 0x01000))
    if [ $(($B)) -gt $((0x10000)) ]
    then
    B=$((0x10000))
    fi
    pactl set-sink-volume 0 `printf "0x%X" $B`

    C=`pacmd dump | grep "set-sink-volume ladspa_output.mbeq_1197.mbeq" | cut -d " " -f 3`
    D=$((C + 0x10000))
    if [ $(($D)) -gt $((0x10000)) ]
    then
    D=$((0x10000))
    fi
    pactl set-sink-volume 1 `printf "0x%X" $D`
    #---
    #volume-down.sh
    #!/bin/bash

    A=`pacmd dump | grep "set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo" | cut -d " " -f 3`
    B=$((A - 0x01000))
    if [ $(($B)) -lt $((0x00000)) ]
    then
    B=$((0x00000))
    fi
    pactl set-sink-volume 0 `printf "0x%X" $B`

    C=`pacmd dump | grep "set-sink-volume ladspa_output.mbeq_1197.mbeq" | cut -d " " -f 3`
    D=$((C + 0x10000))
    if [ $(($D)) -gt $((0x10000)) ]
    then
    D=$((0x10000))
    fi
    pactl set-sink-volume 1 `printf "0x%X" $D`
    #---

    In my matchbox session file I added these two lines.

    #matchbox session file
    xbindkeys &

    "sh $HOME/Scripts/volume-down.sh &"
    #---

    Now whenever I adjust the volume it maxes out my "ladspa_output.mbeq_1197.mbeq" output. This output causse small clicks in the sound when adjusted so I decided to just max it out when adjust the volume either way. When my system boots, it runs the volume down script to pretty much just set the system volume before the music is really played. One thing that I don't like is that I can only adjust the volume 6% or less than that. I have tried different values, but 6% is about the only plausible step. If anyone has any questions about this, let me know. You can also make a mute script if you wish.

    Comment

    Working...
    X