Coder Social home page Coder Social logo

pa_volume's Introduction

Pulseaudio volume setter

pa_volume is a simple tool to set the remembered volume level of pulseaudio clients. It requires module-stream-restore to be loaded (which is usually the case) to function. When called without arguments it shows all the known clients (running and non-running) and their remembered volume level. To set the volume level pass it the name of the client followed by the volume in percent.

Compiling

No configure script is provided right now, but there is a simple Makefile. You will need to have pkg-config and the development packages for libpulse installed. To create a man page, pandoc is required. On Debian/Ubuntu based distributions these are the pkg-config, libpulse-dev, pandoc packages.

sudo apt-get install pkg-config libpulse-dev pandoc
git clone https://github.com/rhaas80/pa_volume.git
cd pa_volume/
make

You can then test the executable using ./pa_volume.

Copy the executable (pa_volume) and man page (pa_volume.1) to a directory in your $PATH and $MANPATH, respectively.

AUR

This program is available on the AUR for Arch Linux-based distributions as pa_volume-git.

Alpine Linux

To compile and install on alpine Linux or other for Docker images these commands, suggested by @anvda may be used:

RUN set -ex && apk --no-cache add  build-base libpulse pulseaudio-dev make git
RUN cd /tmp && \
    git clone https://github.com/rhaas80/pa_volume.git && \
    cd pa_volume && \
    PKG_CONFIG_PATH=/usr/lib  make && \
    cp  pa_volume /usr/local/bin

Examples

pa_volume paplay 50.1

will set the volume of paplay to 50.1%.

pa_volume

will list all known clients and their rememebered volume level for each channel.

pa_volume paplay 66 alsa_output.pci-0000_00_1f.3.analog-stereo

will set the volume of paplay to 66% on a PCI sound device

pa_volume paplay toggle

will toggle mute for paplay

pa_volume's People

Contributors

amckee avatar coxtor avatar forgottenumbrella avatar rhaas80 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pa_volume's Issues

pa_volume command not found

I'm pretty new to linux and I'm stuck on this, I pasted this command in the linux command prompt:

sudo apt-get install pkg-config libpulse-dev pandoc
git clone https://github.com/rhaas80/pa_volume.git
cd pa_volume/
make

it installed fine, but then when I type pa_volume it doesn't work, it says pa_volume command not found.

set all clients to one volume - bash script workaround

feel free to include this script ....

#!/bin/bash
# pa_volume_set_all_clients.sh
# set all known pulseaudio clients to one volume
# license CC0-1.0, warranty none

pa_volume_exe='./pa_volume'

volume="$1" # first argument passed to this script
if [[ -z "$volume" ]]
then
  echo "usage: $0 volume_in_percent"
  exit 1
fi

echo "setting all known pulseaudio clients to volume $volume"
while read line
do
  client="$(echo "$line" | sed -E 's/client: (.*[^ ]) +[0-9]+%/\1/')"
  echo "$volume $client"
  "$pa_volume_exe" "$client" "$volume"
done < <("$pa_volume_exe") # bash process substitution

add proper command line parsing

Right now command line parsing is basically non-existent as all I do is look at the number of arguments passed and whether one of them is the string "--help". With more functionality requested (see #5) this will become more and more unfeasible and one should use either POSIX's getopt or (assuming only glibc needs to be supported) GNU's getopt_long.

The settings for AudioIPC Server are not remembered

First of all, thanks for the great app!! It works great for all sorts of applications, but unfortunately not with Firefox.

While playing (for example a youtube video) I can change the volume with pa_volume 'AudioIPC Server' 40 and it works. Unfortunately, the setting is not remembered (or is changed by something) so that next time it is played the volume will be at 100% again.

The intended usage is not youtube of course, there I adjust the volume manually, but messaging apps. Their notifications are way too loud and the volume cannot be adjusted. Is there a way how to get around this problem?

Multiple volume levels

./pa_volume
...
client: Firefox 0:  21% 1:  21%
...

There are two volume levels displayed behind the applications. When trying to change volume of an application the volume changes unsuspectively, e.g.:

./pa_volume Firefox 25
./pa_volume
...
client: Firefox 0:  63% 1:  63%
...

exception when trying to set the volume for an application

Hi, I happen to find your answer on stackoverflow , thanks for the great tool.

I am trying to set the volume for an application. i.e., gmplayer on linux mint Sarah 18 (=ubuntu 16.04). I was able to build your code and it listed the applications and their volumes as expected. e.g,:

$ ./pa_volume
client: Firefox 100%
client: ALSA plug-in [java]   0%
client: LibreOffice 5.1   0%
client: Audacious  23%
client: Opera   0%
client: speech-dispatcher   0%
client: gmplayer   0%

However, when I tried to set the volume for gmplayer:

$ ./pa_volume gmplayer 100
Assertion 'o' failed at pulse/operation.c:67, function pa_operation_unref(). Aborting.
Aborted

Do you know what the problem it might be? Thanks for helping!

Get this working with Pipewire

I really love this utility and use it all the time to control per-application volume.

I've recently switched to pipewire rather than pulseaudio since that's the new default for my distribution, and have found that pa_volume no longer works as expected, it just outputs:

$ pa_volume
client: event 100%

I'm looking for a way to modify per-application volume from the command line with pipewire.
It looks like this is possible with pavucontrol, but I have to use the GUI for that.

Anyone have any ideas why this project only returns a single client called client: event? (or know of a way to do the same thing but with pipewire?) ๐Ÿค”

EDIT: had a quick look at easyeffects can also adjust per-application volume, but again a GUI app and not usable from the terminal

after installation on raspberry pi bullseye command not found

Hi, I am trying to use this on a raspberry pi with bullseye, but after the installation the command is not found. Am I missing something?

cd pa_volume/
make
cc -O2 -std=c99 -Wall -o pa_volume pa_volume.c -lpulse
pandoc --standalone --to man pa_volume.1.md -o pa_volume.1
echo "All done"
All done
~/pa_volume $ pa_volume
-bash: pa_volume: command not found.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.