Giter VIP home page Giter VIP logo

pamixer's Introduction

pamixer: pulseaudio command line mixer

pamixer is like amixer but for pulseaudio. It can control the volume levels of the sinks.

Also, this project can provide you a small C++ library to control pulseaudio.

Features

  • Get the current volume of the default sink, the default source or a selected one by his id
  • Set the volume for the default sink, the default source or any other device
  • List the sinks
  • List the sources
  • Increase / Decrease the volume for a device (using gamma correction optionally)
  • Mute or unmute a device

Dependencies

  • libpulse
  • cxxopts

You need the headers as well (“-dev” packages for Debian).

Installation

  • From source:

    • Get the source:

      git clone https://github.com/cdemoulins/pamixer.git
      
    • Compile:

      meson setup build
      meson compile -C build
      
    • And use it:

      ./build/pamixer --help
      pulseaudio command line mixer
      Usage:
        pamixer [OPTION...]
      
        -h, --help              help message
        -v, --version           print version info
            --sink arg          choose a different sink than the default
            --source arg        choose a different source than the default
            --default-source    select the default source
            --get-volume        get the current volume
            --get-volume-human  get the current volume percentage or the string
                                "muted"
            --set-volume arg    set the volume
        -i, --increase arg      increase the volume
        -d, --decrease arg      decrease the volume
        -t, --toggle-mute       switch between mute and unmute
        -m, --mute              set mute
            --allow-boost       allow volume to go above 100%
            --set-limit arg     set a limit for the volume
            --gamma arg         increase/decrease using gamma correction e.g. 2.2
                                (default: 1.0)
        -u, --unmute            unset mute
            --get-mute          display true if the volume is mute, false
                                otherwise
            --list-sinks        list the sinks
            --list-sources      list the sources
            --get-default-sink  print the default sink
      
    • Or install it:

      meson install -C build
      

pamixer's People

Contributors

alhirzel avatar ammgws avatar basil-conto avatar cdemoulins avatar expectocode avatar gebi avatar johnbotris avatar oxij avatar pmkap avatar roryrjb avatar skruppy avatar victorz avatar wilzbach 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pamixer's Issues

Add sleep when polling state?

Have you considered putting a sleep instruction here when you're polling the state to prevent the CPU from running at 100% when the pulse audio demon is responding a bit slowly?

I'm also reaching out to let you know that I'm working on a similar topic, only as a static library: https://github.com/beaumanvienna/pamanager
I thought there aren't many good recourses on C++ solutions about how to deal with libpulse and also found your project way too late. I put a link to pamixer in the readme :-) If you have the time to look over it, please let me know any feedback. Thanks!

Pamixer does not see front panel audio

Hello when I use pamixer on my desktop I am not able to change the volume of my headphones plugged into the front panel audio ports. Pulseaudio works and I can hear videos from youtube but I cannot change the volume. When I run pamixer --list-sinks the only thing that shows up is the audio for my HDMI monitor. Sometimes the front panel ports are listed and I can change volume but most of the time they are not there.
I am using an Artix Linux(Arch based with runit instead of systemd) and have the latest version from the arch repos

Set default sink / segfault with unknown option

There appears no option to set the default sink?!

I've tried pamixer --default-sink, but it segfaulted:

terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::program_options::unknown_option> >'
  what():  unrecognised option '--default-sink'
[1]    21268 abort (core dumped)  ./pamixer --default-sink 6

Please release a new version

Please release a new version, for example 1.1.1, so that we can get proper error reports instead of core dumps. Apart from this, thank you very much for a nice and useful utility.

pthread_mutex_destroy Assertion failure on exit

After opening pamixer and using normally, I receive an error on exit, after pressing q

> pamix
Assertion 'pthread_mutex_destroy(&m->mutex) == 0' failed at ../pulseaudio/src/pulsecore/mutex-posix.c:83, function pa_mutex_free(). Aborting.
Aborted (core dumped)

This occurs even if I close right after I open it. Sometimes, the volume drops to 10%.

compilation problem in debian wheezy

when i try to compile in debian wheezy:

% make

g++ --std=c++11 -Wall -Werror -Wextra -pedantic -c -o pulseaudio.o pulseaudio.cc
pulseaudio.cc: In member function ‘void Pulseaudio::set_volume(Device&, pa_volume_t)’:
pulseaudio.cc:140:22: error: ‘UINT32_MAX’ was not declared in this scope
make: *** [pulseaudio.o] Error 1

these are the specific lines:
140 if (new_volume > PA_VOLUME_MAX) {
141 new_volume = PA_VOLUME_MAX;
142 }

if i comment out these lines, compilation works fine

Add playing of sound when volume changes

I'm not sure whether this makes sense to add into pamixer given it's not running in a daemon mode. But looking at how pavucontrol has added a sound when you change a devices volume makes me think adding this to pamixer might not be as hard since the underlying code already exists.

pulseaudio/pavucontrol@8a11d0f#diff-49473dca262eeab3b4a43002adb08b4db31020d190caaad1594b47f1d5daa810L40-L42

is the latest commit that touches that code and might give some insight in how this is implemented.

Basically it uses libcanberra CA_PROP_EVENT_ID to play audio-volume-change which uses the systems installed Freedesktop sound-theme files.

Though in pavucontrol it replaces currently playing audio-volume-change sound whenever a new volume change event is incoming, I'm not sure how well this would work with pamixer - so I guess I might just end up writing a daemon-wrapper around pamixer to allow such functionality.

Time being I'm just using canberra-gtk-play --id=audio-volume-change in my pamixer wrapper.

Feature request: dump current settings in runnable format

Hi, Thanks for pamixer(1).

I've three or so different configurations of settings which I keep switching between, e.g. videoconferencing v. listening to music. It would be nice to set PulseAudio up as required and then pamixer --print or similar and have it write to stdout an invocation of pamixer which will restore the settings it can control. It's then up to the user where or how he stores these for later use. pamixer doesn't need to start understanding configuration-file formats, or user profiles, and selecting between them.

Suggestion: update README to be more specific on the dependencies.

README.rst lists:
"Dependencies
libpulse
boost-program_options"

I already had libpulse0, and after I installed libboost-program-options1.71.0, I thought all would be good.
No.

Eventually, I found I had to install libpulse-dev and libboost-program-options1.71-dev .

Indicating that -dev packages are required, and that the boost package was a library ("lib-") would save a bit of confusion
(at least for those of us less savvy about compilation)...


[Incidentally - I have to assume that boost really helps your software development, since to compile your 369KB program:
-rwxr-xr-x 1 scott scott 369200 Aug 3 17:54 pamixer
One needs to install 142MB of boost-related files
"After this operation, 142 MB of additional disk space will be used." , since libboost-program-options1.71-dev (3.7MB) pulls in
libboost1.71-dev (138MB) as well...
(and also libboost-program-options1.71.0 (2.6MB), which I had already installed in my attempts to make pamixer).]

Add a `--get-default-source` option

Hi! First of all, thanks for pamixer, it's a great tool!

I'd like to have a --get-default-source option, that would print the name of the default source, similar to what --get-default-sink does. What do you think?

Command line argument --default-source is a no-op

Thanks for pamixer!

Reading through the source code, I can't quite figure out what --default-source does. It seems to me that it is effectively a no-op, since the return value get_selected_device isn't used if --default-source is specified.

Feature Request: Microphone mute functionality

I use pamixer in conjunction with a tiling window manager using keybinds to issue commands. My laptop has a microphone mute button that I would love to be able to trigger using this utility. Is there any chance you would add the ability to toggle source mutes in addition to sink mutes?

Boost not working

First of all, thanks for your work.
I tried to boost my sound with these commands, but it didn't work:

> pamixer --get-volume                                                ~
100
> pamixer --allow-boost                                               ~
> pamixer --set-volume 150                                            ~
> pamixer --get-volume                                                ~
100

Did I'm missing something?
Did I'm something wrong?

Connection error

在我使用pamixer 任何操作的时候,它都在终端打印Connection error

[Feature request] A command to decrease volume only if it is currently above threshold

I would like to have a command that given one input parameter ($THRESHOLD) would compare it with the current volume ($CURRENT_VOLUME), and then set the volume to the smallest value of the two ($THRESHOLD or $CURRENT_VOLUME).

Currently, I use a shell script that does this:

if [[ $CURRENT_VOLUME -gt $THRESHOLD  ]]; then
    pamixer --set-volume $THRESHOLD
fi

I'm coming from pulseaudio-ctl which had it implemented as

pulseaudio-ctl almost $THRESHOLD

I believe it could be a nice convenient addition to what pamixer can do.

Thank you very much for pamixer, it helped a lot to transition from pulseaudio to pipewire!

Ability to use --get-volume and --get-mute at the same time

Thanks for your work it's awesome when pactl doesn't allow you to easily get the volume for example !

It could reply something like [status] percentage or just status percentage to easily parse the response in a script.

I have a script that (always) use asynchronous call to get the response, and it would be easier to get status and percentage at the same call..

I've seen that the 2 options are in the list of conflicting options, why ?

Thank's for reading

[Feature request] Allow to select “running” sinks

pamixer currently allows to control the default sink or any other sink specified by its index or name. There’s also option --get-default-sink that prints the default sink.

I’d like to have the same for the currently running sink(s). At least --get-running-sinks or additional column with the state of the sinks in the --list-sinks output would be beneficial.

[Feature request] Ability to specify server to connect to

It would be useful to be able to specify the pulseaudio server to connect to and interact with, as there are setups where you might have multiple servers (e.g. per-user).

Plain pactl exposes this as -s, --server=SERVER; with -s not already having a defined meaning, following suit could probably make sense.

Invalid command line syntax

  1. Passing an invalid command line argument, like 'pamixer -i' (without any further arguments) should show the help page or a warning but not crash with a boost exception
  2. Command line argument -s is ambiguous and matches '--sink', and '--source'

New release tag

It's been a couple of years since the last release and a number of useful features have been added:

Would be nice to see these included in a 1.5 release tag, so they can be included in package repos.

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.