0

is there a way to read the current pc volume? This is going to be a part of a project that I have in mind that is essentially reading curent pc volume value and giving it an RGB value (green=>30, yellow=<30>60, red=<60) and lighting up an RGB led accordingly.

  • Please describe a little better what you want to read. pc = PC = Personal Computer (maybe with Windows)? Do you want to read if the volume slider is set i.e. to 30% or do you want to "read" how much noise comes out of the speakers? – Edgar Jun 18 '18 at 3:04
  • 3
    I'm voting to close this question as off-topic because the capabilities of PC operating systems are not on topic here - and doubly so when the operating system in question has not been identified. Needless to say, if you obtain a number by some means, you can transmit it to your embedded system. And no, Nick Alexeev, this is not an Arduino question either - it is a PC operating system question, and at presently too broad even for a site about those. SE policy prohibits the migration of unanswerable questions and requires that they be closed at the source. – Chris Stratton Jun 18 '18 at 3:16
  • You guessed it the system is windows and I want to read the precentage that windows has in volume manager I know there are many HID librarys that can increase or decrease the volume but I have not seen any that can be used to pull the value. @chris Stratton reddit.com/r/ProgrammerHumor/comments/2zp22c/… – user3451403 Jun 18 '18 at 3:58
  • 1
    Well aren't you just a perfect specimen of the SE community and reputation – user3451403 Jun 18 '18 at 4:05
  • 1
    The easiest way would be writing a program, that runs in the PC and sends the current volume and any change to the Arduino via Serial. Investigate how to interface system volume in the PC with your chosen programming language (for example python). – chrisl Jun 18 '18 at 7:24
1

There is no way for any hardware device, Arduino or otherwise, to request information like that from a computer.

HID is a protocol which (when used as a keyboard) allows you to send keypresses, including "media keys", which tell the computer to change the volume (amongst other things). There is no provision, other than three status LEDs, for getting any data back from the computer.

You will have to write software for your computer to query that information using whatever API may be available for your operating system, and pass that information through whatever communication channel you choose to the Arduino (such as through serial).

Some pointers:

0

There are external devices that show the volume, but you need a driver for that. I don't know if there is an open source driver which you could adapt to send the volume via a serial port to the Arduino.

The Windows PowerShell has the possibility to get the volume and transmit it to a serial port. You could do that a few times per second. In linux it might even be easier, a bash script with gawk with "amixer sget Master".

Another problem is to select the right serial port for the Arduino. I don't know how to automatically select the right port.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.