Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise/lower volume #9

Open
bryal opened this issue Oct 19, 2020 · 2 comments
Open

Raise/lower volume #9

bryal opened this issue Oct 19, 2020 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@bryal
Copy link

bryal commented Oct 19, 2020

It would be nice to be able to raise and lower the volume directly in Emacs, not having to open Pavucontrols or equivalent to manually change the volume of the process. Not sure if it would be easy to come up with a solution portable between all the backends though, but for MPV it can be done with the --input-ipc-server flag and ncat. Example:

$ mpv --input-ipc-server=/tmp/eradiosocket ...
$ echo 'add volume -10' | ncat -U /tmp/eradiosocket

I suppose the functions would look something like

(defun eradio-lower-volume ()
  (interactive)
  (message (shell-command-to-string "echo 'add volume -10' | ncat -U /tmp/eradiosocket")))

except they would do something different depending on the backend.

An alternative solution which would probably work for most situations could be to ask the user for volume when executing eradio-play and pass that along as a command line argument when starting the player process. For MPV, there's the --volume flag. This solution would not allow changing the volume without restarting the player, but that's not all that bothersome, so it would still be very useful.

@bryal bryal added the enhancement New feature or request label Oct 19, 2020
@olavfosse
Copy link
Owner

Implementing this in a media player and operating system agnostic way sounds tricky. Instead we could add media player specific commands for changing the volume prefixed with the media player, starting with eradio-mpv-xyz. This obviously implies changing the mpv command to make the socket.

Alternatively we could do this on an audio system level and interface with pactl(1), SNDIOCTL(1) etc. I don't know how to go about this on MacOS though.

PRs are welcome.

Cool programming language btw, very based license :-)

@bryal
Copy link
Author

bryal commented Oct 19, 2020

I've implemented a version of this functionality in a very ad-hoc fork in my own emacs conf, but I don't know if the functionality is quite merge-ready. For example, I realized that MPV doesn't remember the volume when resuming after a stop, or changing the channel, so I added a variable eradio-volume which I change along with sending set volume commands to MPV, so when the process is restarted the previous volume is passed along with --volume. Maybe it's good enough, but the solution just feels a bit inelegant to me.

Cool programming language btw, very based license :-)

Thanks! Indeed, I feel it's the one license ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants