f34 pipewire - how to set volume level from command line?
FedoraForum.org - Fedora Support Forums and Community
Results 1 to 12 of 12
  1. #1
    Join Date
    Dec 2012
    Location
    Private
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    f34 pipewire - how to set volume level from command line?

    I've been searching and so far I haven't been able to determine a working way to set the audio volume level in f34 from the command line. I used the following in f32:
    amixer-q set Master 20%;

  2. #2
    Join Date
    Jun 2004
    Location
    Maryland, US
    Posts
    9,280
    Mentioned
    40 Post(s)
    Tagged
    0 Thread(s)

    Re: f34 pipewire - how to set volume level from command line?

    that command worked when I tried it on Fedora 34 Wayland with KDE

  3. #3
    Join Date
    Dec 2012
    Location
    Private
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: f34 pipewire - how to set volume level from command line?

    ah - i didn't realize the command was in fact doing _something_ ... it is changing the volume, but it's not setting it to 20% (more like 50%). I'm using the Mate Spin.

  4. #4
    Join Date
    Jun 2004
    Location
    Maryland, US
    Posts
    9,280
    Mentioned
    40 Post(s)
    Tagged
    0 Thread(s)

    Re: f34 pipewire - how to set volume level from command line?

    Quote Originally Posted by FedoraFTW
    ah - i didn't realize the command was in fact doing _something_ ... it is changing the volume, but it's not setting it to 20% (more like 50%). I'm using the Mate Spin.
    That's not what I heard, I tried this:

    amixer -q set Master 100% --> laptop gets very loud

    amixer -q set Master 5% --> very quiet

    so the percent value is absolute. Then I tried:

    sleep 5;amixer -q set Master 100%

    and exposed the volume widget on KDE, when the timer ran out the volume slider went to full volume. If I run
    sleep 4;amixer -q set Master 0% and the slider went fully left and silent.
    Values of set between 100 and 0 do some weird things I don't understand (like one time I tried 50% on the CLI command the slider went to 79%)


    Last edited by marko; 3rd June 2021 at 05:03 PM.

  5. #5
    Join Date
    May 2005
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: f34 pipewire - how to set volume level from command line?

    If you have pipewire running a pulseaudio server, the pulseaudio tools still work:

    Code:
    # for sound output devices
    pactl list sinks
    pactl set sink-volume <device_id> 75%
    
    # for individual applications
    pactl list sink-inputs
    pactl set sink-input-volume <application_id> 80%

  6. #6
    Join Date
    Aug 2011
    Location
    ~
    Posts
    2,053
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: f34 pipewire - how to set volume level from command line?

    Quote Originally Posted by spear
    If you have pipewire running a pulseaudio server, the pulseaudio tools still work:

    Code:
    # for sound output devices
    pactl list sinks
    pactl set sink-volume <device_id> 75%
    
    # for individual applications
    pactl list sink-inputs
    pactl set sink-input-volume <application_id> 80%
    I would improve this by using @DEFAULT_SINK@

    Code:
    pactl set-sink-volume @DEFAULT_SINK@ -10%
    pactl set-sink-volume @DEFAULT_SINK@ +10%

  7. #7
    Join Date
    Dec 2012
    Location
    Private
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: f34 pipewire - how to set volume level from command line?

    Check out the results shown in Mate Sound Preferences when setting the volume to the following levels with amixer ...

    0%
    Click image for larger version. 

Name:	0.png 
Views:	6 
Size:	3.4 KB 
ID:	31700

    1%
    Click image for larger version. 

Name:	1.png 
Views:	9 
Size:	3.5 KB 
ID:	31701

    20%
    Click image for larger version. 

Name:	20.png 
Views:	6 
Size:	3.5 KB 
ID:	31702

    50%
    Click image for larger version. 

Name:	50.png 
Views:	5 
Size:	3.5 KB 
ID:	31703

    100%
    Click image for larger version. 

Name:	100.png 
Views:	3 
Size:	3.5 KB 
ID:	31704

    Whatever's going on, it's not a case of the Mate volume widgets showing the wrong value -- 20% has been my "default" volume for many years (I have a keybinding to reset to this volume, and a script that runs each night to reset to this value), and setting it to 20% with amixer since upgrading from F32 to F34 has resulted in a volume level that is considerably louder than my "default"

  8. #8
    Join Date
    Dec 2012
    Location
    Private
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: f34 pipewire - how to set volume level from command line?

    the pactl command isn't recognized on my installation

  9. #9
    Join Date
    Jun 2004
    Location
    Maryland, US
    Posts
    9,280
    Mentioned
    40 Post(s)
    Tagged
    0 Thread(s)

    Re: f34 pipewire - how to set volume level from command line?

    Quote Originally Posted by FedoraFTW
    the pactl command isn't recognized on my installation
    Code:
    dnf provides \*/pactl
    pulseaudio-utils-14.2-3.fc34.x86_64 : PulseAudio sound server utilities
    so try installing "pulseaudio-utils" with dnf, and retry running pactl

  10. #10
    Join Date
    Dec 2012
    Location
    Private
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: f34 pipewire - how to set volume level from command line?

    works great - thanks marko, spear, Dutchy :-)

    any idea why the strange results with amixer? and it seems odd to have to install pulseaudio-utils in order to correctly set the volume for pipewire?

  11. #11
    Join Date
    Jun 2004
    Location
    Maryland, US
    Posts
    9,280
    Mentioned
    40 Post(s)
    Tagged
    0 Thread(s)

    Re: f34 pipewire - how to set volume level from command line?

    Quote Originally Posted by FedoraFTW
    works great - thanks marko, spear, Dutchy :-)

    any idea why the strange results with amixer? and it seems odd to have to install pulseaudio-utils in order to correctly set the volume for pipewire?
    I did find some arcane, hard to remember ways to use "pw-cli" to do volumes:

    https://gitlab.freedesktop.org/pipew...teport-latency
    https://gitlab.freedesktop.org/pipew...put-volumemute

    The command looks like it's using JSON like this quoted from the first url:
    pw-cli s <device-id> Route { index: <route-index>, device: <card-profile-device>, props: { mute: false, channelVolumes: [ 0.5, 0.5 ], save: true } }


    Then the 2nd url shows the much simpler:

    pw-cli s <node-id> Props { mute: false, channelVolumes: [ 0.3, 0.3 ] }

    I think what's going on is at this stage these are really the developer interface commands, I really doubt pipewire project intends Joe User to use a crazy thing like that (imagine dealing with many many node-ids, and how to find out which one). So we're at the immature stage and pretty soon there'll probably be easier command line options. Remember, for most users, there's the volume widgets in their desktop that works fine for most uses.
    Last edited by marko; 3rd June 2021 at 08:03 PM.

  12. #12
    Join Date
    May 2005
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: f34 pipewire - how to set volume level from command line?

    This might explain the discrepancy between ALSA and PA volume displays:
    https://bugzilla.redhat.com/show_bug.cgi?id=502057

Similar Threads

  1. Playing a .wav file with a pipewire terminal command
    By Mazeris in forum Using Fedora
    Replies: 3
    Last Post: 5th May 2021, 01:56 PM
  2. command line program for audio and mic volume
    By COKEDUDE in forum Using Fedora
    Replies: 4
    Last Post: 23rd May 2013, 12:22 AM
  3. Command line gnome-volume-control
    By FennCruz in forum Using Fedora
    Replies: 0
    Last Post: 15th August 2010, 09:13 PM
  4. How to control volume from ssh command line?
    By sahilahuja in forum Using Fedora
    Replies: 4
    Last Post: 1st August 2010, 12:45 AM
  5. Volume level?
    By fluaju in forum Using Fedora
    Replies: 3
    Last Post: 28th January 2006, 10:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •