KMix has a long history of having a remote interface. But whether it was based on DCOP or DBUS, it has always been an expert tool. For some common tasks like muting the master or setting a volume, the hurdles have been too high for many users and script developers.
Starting with the next release KMix ships a small script kmixremote, that makes things very easy: You can mute, get and set volume levels, and list soundcards and controls. This bash script can also serve as a starting point for developers interested in creating scripts or 3rd party apps.
This was a two hour excursion back into bash scripting for me. I found it entertaining as I am not doing a lot of those anymore. I hope you find the result useful.
Local usage example:
Shown are (in this order) listing soundcards, listing controls of a specific soundcard. After that reading, modifying, and reading the (modified) volume level again:
chris@whitefall # kmixremote list ALSA__Creative_X_Fi_1 ALSA__HDA_NVidia_1 chris@whitefall # kmixremote list ALSA__Creative_X_Fi_1 Master_0 PCM_0 Front_0 [...] chris@whitefall # kmixremote get ALSA__Creative_X_Fi_1 PCM_0 100 chris@whitefall # kmixremote set ALSA__Creative_X_Fi_1 PCM_0 70 chris@whitefall # kmixremote get ALSA__Creative_X_Fi_1 PCM_0 70
Remote usage example:
Remote usage does not differ from local usage. You only have to make sure you have a remote login, and permissions to access the X11 server where KMix is running. In the example, I am using “DISPLAY=:0”:
chris@remote-pc: ssh user@pc-with-kmix DISPLAY=:0 /usr/bin/kmixremote ALSA__Creative_X_Fi_1 ALSA__HDA_NVidia_1
Posted by Alexander E. Patrakov on December 29, 2013 at 7:29 am
Please note that, with PulseAudio enabled, having the “scripted volume changes” functionality is in direct contradiction with the documentation patch that will hopefully be accepted soon:
http://comments.gmane.org/gmane.comp.audio.pulseaudio.general/18673
So, if you are going to ship this, please document the implications somewhere. Basically, it needs to be explicitly said that the scripts that manipulate volumes in kmix are trusted to make no harmful changes.
Posted by beylix on January 2, 2014 at 6:09 am
Honestly, I do not understand the “documentation patch”. Could you elaborate how this applies to KMix? KMix does not create sinks, it only controls the volume of sinks for the given range.
Posted by Alexander E. Patrakov on February 11, 2014 at 6:43 pm
Sorry for taking too long to reply. I reread the post, and after the phrase “KMix has a long history of having a remote interface” have to partially retract my comment. The issue is not new, and not really specific to PulseAudio.
What the documentation patch says, in relation to KMix, is: any volume change that is not a result of user input is bad. But in practice, there are no such volume changes, unless a clueless user shoots himself in the ear.
The changes done via the GUI are obviously user-initiated. It is OK to call kmixremote e.g. in response to a hotkey, as that’s still user input. It is OK to run kmixremote from a command line, as that’s still user input.
What is not OK is that some clueless application author would read about kmixremote or about the D-BUS API and use that to change the volume when his application thinks that this is needed, potentially overriding the user’s choice (i.e. fighting with the user for the mixer controls). I think that a note about this potential of “fighting” would be useful in the same place which documents the D-Bus API and kmixremote.
Posted by beylix on March 7, 2014 at 8:05 am
Interesting read, Alexander. Do you think it is likely things like these would happen? What application do you have in mind? Media players only change volume on user demand, and I think usage w/o user interaction is also OK, like a tool that allows stuff like “mute my computer always at 23:00 local time”. This is also valid usage.
Posted by jospoortvliet on December 30, 2013 at 10:10 am
hey, this is very cool! Controling kmix from the command line…
Posted by Alexey Korepov on January 27, 2014 at 7:56 pm
Thanks, very useful! Also will be good to see android app for remote control kmix (or pulseaudio), because now I can’t find any way how to conrol pulseaudio volume from Android tablet. Is something like this planned?
Posted by upinvermont on March 16, 2014 at 9:34 pm
KMIX, on all three of my systems (latest KDE), has been nothing but a source of frustration and irritation. I despise it. I want one slider, my volume control keys, to control all sound events equally — in the sense that I want to unify the volume control. I don’t want a dozen sliders for a dozen apps. I don’t listen to a dozen apps at the same time so it makes absolutely no sense, in my case, to have separate sliders. What I would really like to see is a little checkbox that says something like: UNIFY VOLUME CONTROL. If this capability already exists, then I’d love to know how to do it (’cause nobody else seems to know about it). If it doesn’t, then for God’s sake please add it. I beg you.
Posted by beylix on April 4, 2014 at 10:07 am
Honestly, I feel insulted. Blurping out that you want (quoting) “something like: UNIFY VOLUME CONTROL” and presuming this what is in your head is obvious is a stupid assumption. Adding words like “for gods sake” will not help motivating me. Thank you.
Posted by upinvermont on April 4, 2014 at 11:48 am
The facts are this: KMIX doesn’t function as designed on any of my systems. If you want to feel insulted, that’s up to you; but pouting because of one negative comment doesn’t do squat to improve your software. I’m currently trying Veromix. Thank you.
Posted by beylix on April 4, 2014 at 12:11 pm
Wrong. KMix actually functions as designed. It simply does not seem to match your taste – which you did not even bother to specify exactly. That is OK for me, but telling “I want” and “I despise” and “for gods sake” is NEITHER friendly NOR constructive. Destructive criticism does not solve any problems.
Posted by upinvermont on April 4, 2014 at 1:08 pm
If the option doesn’t already exist, the ability to lock (unify) all sound events under one slider would greatly benefit any number of users who neither use nor want a separate slider/control for each sound event or application.
Posted by beylix on April 4, 2014 at 3:26 pm
All soundcards that I know already have a more or less “unified” channel. So by selecting that channel as master you should be done. You can do it probably since 10 years in KMix. Select the sound card (Pulseaudio) or PCM (ALSA, OSS) as master, and it will regulate all volumes for that soundcard.
Please note, that for about 10 years there also was only one slider. I find it now pretty antiquated, but if you want that back then configure KMix to show only one. The new – user friendly way – is described in an older post: https://kmix5.wordpress.com/2013/11/26/secret-view-in-the-new-configuration-dialog/ . You might need to wait until distributions pick up that version, but then it is pretty nice.
Posted by Релиз KDE 4.13 - Блог старого админа on April 16, 2014 at 7:29 pm
[…] звуковой микшер KMix добавлена поддержка удалённого управления с использованием DBus, […]
Posted by Релиз KDE 4.13 | AllUNIX.ru — Всероссийский портал о UNIX-системах on April 16, 2014 at 7:37 pm
[…] звуковой микшер KMix добавлена поддержка удалённого управления с использованием DBus, […]