You are not logged in.

#1 2011-12-25 09:34:51

Lockheed
Member
Registered: 2010-03-16
Posts: 1,524

Changing from PulseAudio to ALSA

My Wine programs had no sound with pulse, so I decided to move to alsa.
The only little issue I have now is the binding with volupe up/down keys. On Pulse, the script was:

#!/bin/bash
device="alsa_output.pci-0000_00_1b.0.analog-stereo"
case "$1" in
	"up")    # increase volume by 3000
		pacmd dump | awk --non-decimal-data '$1~/set-sink-volume/{if ($2~/'${device}'/) {if ($3+1000 > 65535) {system ("pactl "$1" '${device}' "65535)} else {system ("pactl "$1" '${device}' "$3+3000)}}}'
		;;
	"down")  # decrease volume by 3000
		pacmd dump | awk --non-decimal-data '$1~/set-sink-volume/{if ($2~/'${device}'/) {if ($3-1000 < 0) {system ("pactl "$1" '${device}' "0)} else {system ("pactl "$1" '${device}' "$3-3000)}}}'
		;;
	"mute")  # toggle mute
		pacmd dump|awk --non-decimal-data '$1~/set-sink-mute/{if ($2~/'${device}'/) {system ("pactl "$1" '${device}' "($3=="yes"?"no":"yes"))}}'
		;;
esac

Now, on ALSA, the above stopped working, so I changed it to:

#!/bin/bash
device="alsa_output.pci-0000_00_1b.0.analog-stereo"
case "$1" in
	"up")    # increase volume by 3000
		amixer set PCM 5%+
		;;
	"down")  # decrease volume by 3000
		amixer set PCM 5-
		;;
esac

It does change volume, but I no longer get the OSD display showing me the change, and I'd like to see it.

What can I do?

Offline

#2 2011-12-25 14:40:07

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: Changing from PulseAudio to ALSA

Lockheed wrote:

OSD display

Quick and dirty:

~/.xbindkeysrc

"/usr/bin/amixer -q sset Master 2+ && /home/brebs/bin/notifyvolume"
    KP_Multiply
"/usr/bin/amixer -q sset Master 2- && /home/brebs/bin/notifyvolume"
    KP_Subtract
"/usr/bin/amixer -q sset Master 0% && /home/brebs/bin/notifyvolume"
    KP_Divide

notifyvolume

#!/bin/bash

exec /usr/bin/notify-send -t 1000 -i volume-knob "Volume $(amixer -q | grep -A5 Master | grep '%' | cut -d'[' -f2 | cut -d']' -f1)"

I have e.g. /usr/share/icons/gnome/16x16/apps/volume-knob.png

Offline

#3 2011-12-25 16:07:57

Lockheed
Member
Registered: 2010-03-16
Posts: 1,524

Re: Changing from PulseAudio to ALSA

Thanks for the input but I was hoping for the same xfce-notifyd volume progress bar indicator as I had with pulseaudio rather than a know with 100% (which is stuck at 100% at all times, anyway)
Something like:
http://jeromeg.blog.free.fr/public/xfce … _35_34.png
except in my theme the bar is all grey. It still appears just fine if I use keyboard volume controls, but not while binding it to mouse buttons.

Offline

#4 2011-12-25 16:16:30

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: Changing from PulseAudio to ALSA

Just to clear this up:

Lockheed wrote:

(which is stuck at 100% at all times, anyway)

You probably have your "Master" as "PCM". See what it is in alsamixer. Probably the left-most control.

Offline

#5 2011-12-25 16:19:54

Lockheed
Member
Registered: 2010-03-16
Posts: 1,524

Re: Changing from PulseAudio to ALSA

Well, what I said was not entirely correct. I change the volume to, say, 70%, but the indicator is stuck at 100% for about a minute. Then it appears at the correct value, but it should not be visible at that point anymore.

However, this is a little bit of a moot point, as what I am after is the volume bar which was appearing when I was using the original script from the first post.
Is that possible? I imagine it should be as it is xfce-notifyd element, not pulseaudio.

Offline

#6 2011-12-25 20:01:53

cjazz
Member
Registered: 2009-03-12
Posts: 47

Re: Changing from PulseAudio to ALSA

Are you using xfce? Have you tried xfce4-volumed? It's located in AUR.

Offline

#7 2011-12-25 20:06:46

Lockheed
Member
Registered: 2010-03-16
Posts: 1,524

Re: Changing from PulseAudio to ALSA

And how would it help me?

EDIT:
Found the solution. I needed to replace PCM with Master in my original (second) script and voila - it is working with OSD.

Last edited by Lockheed (2011-12-25 20:29:27)

Offline

#8 2011-12-26 00:47:11

cjazz
Member
Registered: 2009-03-12
Posts: 47

Re: Changing from PulseAudio to ALSA

Lockheed wrote:

And how would it help me?

.

Hmm. Well, since xfce4-volumed does provide an on-screen display of volume change and I thought that's what you wanted, I thought it might be worth a try. Anyway, I'm glad you found a solution.

Offline

#9 2011-12-26 08:43:42

Lockheed
Member
Registered: 2010-03-16
Posts: 1,524

Re: Changing from PulseAudio to ALSA

cjazz wrote:

Hmm. Well, since xfce4-volumed does provide an on-screen display of volume change and I thought that's what you wanted,

Thanks, but I already had a working OSD of volume. Just wanted to make it being displayed.

Offline

Board footer

Powered by FluxBB