You are not logged in.

#1 2016-01-14 01:09:38

MathCubes
Member
Registered: 2015-09-07
Posts: 10

Can't change default sound device in i3wm.

Hey, I am currently trying to move to i3 from GNOME.  I am setting it up.  The issue is I can't change the default sound device in i3.  I try "pamixer" which doesn't work but "pavucontols" works under gnome but doesn't under i3?  I would want to change it though the CLI.  Are there any way to fix this?  Can I use "amixer"?

I think I am using ASLA but then why PluseAudio applications that control it, work?

Last edited by MathCubes (2016-01-14 01:21:15)

Offline

#2 2016-01-14 03:59:16

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,740

Re: Can't change default sound device in i3wm.

pacmd is your better choice from the command line

edit:  Here is a simple script that I bind my media control keys to in i3wm

#!/bin/bash
oldvolume=$(pacmd dump |awk '( $1 ~ "set-sink-volume" && $0 ~ "analog" ){ print $3 }')
oldmute=$(pacmd dump |awk '( $1 ~ "set-sink-mute" && $0 ~ "analog" ){ print $3 }')
case $1 in

increase)
    newvolume=$(($oldvolume + 0x400))
    if (($newvolume >0x10000)) ; then
        newvolume=$((0x10000))
    fi
    pacmd set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo $(printf '0x%x' $((newvolume)) ) 
    ;;

decrease)
    newvolume=$(($oldvolume - 0x400))
    if (($newvolume < 0 )) ; then
        newvolume=$((0x0000))
    fi
    pacmd set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo $(printf '0x%x' $((newvolume)) ) 
    ;;

mute)
    if [[(($oldmute == 'yes' ))]] ; then
       pacmd set-sink-mute alsa_output.pci-0000_00_1b.0.analog-stereo 0
    else
       pacmd set-sink-mute alsa_output.pci-0000_00_1b.0.analog-stereo 1
    fi
    ;;
*)
    echo "usage pavolume increase | decrease | mute"
esac

Edit 2:  Meant only as an example.  I am sure my pci addresses might not be the same as yours.

Last edited by ewaller (2016-01-14 04:03:35)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2016-01-14 07:56:39

tom.ty89
Member
Registered: 2012-11-15
Posts: 897

Re: Can't change default sound device in i3wm.

PulseAudio is running upon login on GNOME, but not if you startx with i3.

systemctl --user enable pulseaudio

If pulse is running, you can use either pacmd/pactl/pavucontrol/pamixer/ponymix tongue

Last edited by tom.ty89 (2016-01-14 07:57:19)

Offline

#4 2016-01-14 08:14:08

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: Can't change default sound device in i3wm.

I am controlling sound with keyboard sound keys using xbindkeys, this is in my .xbindkeysrc

"pactl set-sink-volume @DEFAULT_SINK@ +5%"
   XF86AudioRaiseVolume

"pactl set-sink-volume @DEFAULT_SINK@ -5%"
   XF86AudioLowerVolume

"pactl set-sink-mute @DEFAULT_SINK@ toggle"   
   XF86AudioMute

hope this helps, you can check by running pactl command in terminal first before binding keys.

Offline

#5 2016-01-14 09:05:26

tom.ty89
Member
Registered: 2012-11-15
Posts: 897

Re: Can't change default sound device in i3wm.

Personally I hate using pactl for increasing/decreasing volume, because it allows the volume to go beyond 100% by default and the steps aren't at fixed points. IMHO pamixer/ponymix do it in a much better way for those.

Last edited by tom.ty89 (2016-01-14 09:07:02)

Offline

#6 2016-01-14 11:52:41

MathCubes
Member
Registered: 2015-09-07
Posts: 10

Re: Can't change default sound device in i3wm.

ewaller wrote:

pacmd is your better choice from the command line

edit:  Here is a simple script that I bind my media control keys to in i3wm

#!/bin/bash
oldvolume=$(pacmd dump |awk '( $1 ~ "set-sink-volume" && $0 ~ "analog" ){ print $3 }')
oldmute=$(pacmd dump |awk '( $1 ~ "set-sink-mute" && $0 ~ "analog" ){ print $3 }')
case $1 in

increase)
    newvolume=$(($oldvolume + 0x400))
    if (($newvolume >0x10000)) ; then
        newvolume=$((0x10000))
    fi
    pacmd set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo $(printf '0x%x' $((newvolume)) ) 
    ;;

decrease)
    newvolume=$(($oldvolume - 0x400))
    if (($newvolume < 0 )) ; then
        newvolume=$((0x0000))
    fi
    pacmd set-sink-volume alsa_output.pci-0000_00_1b.0.analog-stereo $(printf '0x%x' $((newvolume)) ) 
    ;;

mute)
    if [[(($oldmute == 'yes' ))]] ; then
       pacmd set-sink-mute alsa_output.pci-0000_00_1b.0.analog-stereo 0
    else
       pacmd set-sink-mute alsa_output.pci-0000_00_1b.0.analog-stereo 1
    fi
    ;;
*)
    echo "usage pavolume increase | decrease | mute"
esac

Edit 2:  Meant only as an example.  I am sure my PCI addresses might not be the same as yours.

Okay.  How do I use the sound device that I am using?  I often switch back in forth through my speakers on my desk and headphones.

Offline

#7 2016-01-14 15:49:07

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,740

Re: Can't change default sound device in i3wm.

Check the output of pacmd dump
The information you need is in there.  Post it if you need help.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#8 2016-01-16 18:13:42

MathCubes
Member
Registered: 2015-09-07
Posts: 10

Re: Can't change default sound device in i3wm.

tom.ty89 wrote:

PulseAudio is running upon login on GNOME, but not if you startx with i3.

systemctl --user enable pulseaudio

If pulse is running, you can use either pacmd/pactl/pavucontrol/pamixer/ponymix tongue

Thanks it wasn't now I just need to put it into my i3 conf file.

Offline

#9 2016-01-16 18:20:37

tom.ty89
Member
Registered: 2012-11-15
Posts: 897

Re: Can't change default sound device in i3wm.

i3 conf file?

Offline

Board footer

Powered by FluxBB