How to get current system volume level?

Here you are welcome to post Setvol feature requests
Post Reply
MichaelChistyakov
Posts: 5
Joined: Tue Jan 28, 2020 10:10 am

How to get current system volume level?

Post by MichaelChistyakov »

Hi there!

I'm just trying to create my own 'home' application to control my laptop volume and music from sofa :) I'm using nodejs as a local server (with socket.io) and open urls like '192.168.0.133:3000' on my phone to enter control panel.

And... I'm using SetVol.exe to change volume but I have no ideas how to get current system volume level with it. Is it possible?

Also I think it would be perfect if you implement some addition media control features like executing system 'next' / 'previous' / 'play' / 'pause' etc. methods. For them I have to use this solution: https://github.com/anthony-butcher/node ... controller

Greetings from Siberia!
RobLatour
Site Admin
Posts: 1003
Joined: Mon Feb 19, 2018 11:43 am

Re: How to get current system volume level?

Post by RobLatour »

you can type
setvol report
to get the current levels

setvol report >result.txt
would send that output to a file, which you could perhaps read?
MichaelChistyakov
Posts: 5
Joined: Tue Jan 28, 2020 10:10 am

Re: How to get current system volume level?

Post by MichaelChistyakov »

Thanks! But this is a bad practice.

I have to check current system volume with some interval to show volume value on page that is opened in mobile phone. So I think the way to rewrite and read file for tens times per second is not my way.

Rob, can I ask you to create new (or modify SetVol) .exe with these methods:
play
pause
skip
next
previous
setvolume
getvolume
getcurrenttrack (I think that is possible in win10)

There is no need to pass not numeric values to 'setvolume' as I think.

My idea is to create simple education application for win systems. It will be packed with electron.js (https://www.electronjs.org/) and have minimal interface. After launch it will show ip address to connect and QR-code with ip to make it easier for mobile phones. Then, after you enter page on your phone you'll see some interface with control buttons to play-pause methods and range slider to change system volume (it should change in runtime if we change volume on PC). Ideally it can show current playing track name.

Something like this but in browser page that has local address:
Attachments
demo.png
demo.png (10.81 KiB) Viewed 10182 times
MichaelChistyakov
Posts: 5
Joined: Tue Jan 28, 2020 10:10 am

Re: How to get current system volume level?

Post by MichaelChistyakov »

'report' is working fine.

Master volume level = 12
Channel 0 level = 12
Channel 1 level = 12

But I dont like to parse this result to extract numeric values (that is a bad practice imho). Is it possible for you to change or update you application to work exactly like:

setvol.exe getvolume → 12
setvol.exe getchannels → 12 12
setcol.exe getcurrenttrack → Just Like You (Liam Howlett of The Prodigy Hospitalized Remix)
setcol.exe getcurrentartist → Ian Brown

At now getting volume is a stop factor for me. So I have to find already done solution or ask you to update setvol or to write my own. In last case I'll have to study C++ :D
MichaelChistyakov
Posts: 5
Joined: Tue Jan 28, 2020 10:10 am

Re: How to get current system volume level?

Post by MichaelChistyakov »

Offtop: can you disable forum option to wait for moderator check?
RobLatour
Site Admin
Posts: 1003
Joined: Mon Feb 19, 2018 11:43 am

Re: How to get current system volume level?

Post by RobLatour »

Setvol was design for a simple task - setting the volume on your computer; it is not geared to working with other app - figuring out tracks that some software may be playing etc. - in short that is outside the scope of the program. I have made some updates to the program to make it more useful, but those updates were linked more directly to the core function of the program. Skipping tracks etc. is too far out.

re setvol.exe getvolume

coding
setvol getvolume as you describe it is something I could potentially do (assuming you are asking for the result to be in the programs return code)

Setvol getchannels would not work because you can only return one value in the return code, you can however return a display of what ever you want (which is what setvol report does) and you can pipe it into a file, which you can read later - which I don't see as a bad practice but simply as a way to work around the limits of command line programs.
MichaelChistyakov
Posts: 5
Joined: Tue Jan 28, 2020 10:10 am

Re: How to get current system volume level?

Post by MichaelChistyakov »

Ok, thank you for answer. getchannels is unnecessary for me:)

In short: can you tell me will you update program with list of options I asked before?

Also running inside other program is similar to usual execution, Except in my way it will be running in background mode.
RobLatour
Site Admin
Posts: 1003
Joined: Mon Feb 19, 2018 11:43 am

Re: How to get current system volume level?

Post by RobLatour »

Hi Michael,

As mentioned early, setvol getvolume as you describe it is something I could potentially do (assuming you are asking for the result to be in the programs return code). The others are not directional.

If getvolume, as you describe, it would be helpful to you I can look at it sooner than later, but so far I haven't had anyone else ask for it.

Having that said, I should also mention, if you use VLC you may want to look at this post http://www.push2run.com/phpbb/view ... ?f=9&t=618

In any case, please let me know about getvolume.

Rob
Post Reply