It is currently September 21st, 2019, 6:11 pm

Measuring/changing Microphone Levels

Help with creating, editing & fixing problems with skins
Rumblebee
Posts: 4
Joined: July 21st, 2014, 10:08 am

Measuring/changing Microphone Levels

Rumblebee » April 2nd, 2019, 10:22 am

Does anyone know of a function that would let me measure or alter the levels of an audio input?
Maybe an equivalent of Win7AudioPlugin?

Thanks :)
Yincognito
Posts: 652
Joined: February 27th, 2015, 2:38 pm

Re: Measuring/changing Microphone Levels

Yincognito » April 3rd, 2019, 7:25 pm

You can download and use an utility like NirCMD to set the microphone level to the desired value:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeasureRun]
Measure=Plugin
Plugin=RunCommand
Parameter='F:\Wireless\nircmd\nircmd.exe setsysvolume 32768 "Microphone"'
State=Hide
OutputType=ANSI

[MeterRun]
Meter=String
FontSize=11
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Click to Run
LeftMouseUpAction=[!CommandMeasure MeasureRun "Run"]
The above sets the microphone volume to 50% (65535 is 100%) on left mouse click on the skin. Adapt the path to the location where you copied/installed NirCMD, and the microphone name to the one you use in your system (e.g. "front mic", "mic", etc).

Instead of setsysvolume 32768, you can use a different NirCMD command, like changesysvolume -6553, to reduce the microphone volume by 10%, for example. Other NirCMD commands are also available, like mutesysvolume [action] {Component} {Device Index}, changeappvolume [Process] [volume level] {Device Name/Index}, setvolume [device] [left-volume] [right-volume], and so on (the list of NirCMD commands is available in the NirCmd.chm help file included in the .zip you downloaded from the page I linked to above).

If you also want to "view" the microphone level, an utility like SoundVolumeView (also from NirSoft) can be used through the RunCommand plugin, similarly with the way NirCMD was used above, to get or set the desired volume. Check the bottom of the page I linked to above, to see a list and examples of command line parameters that you can use with SoundVolumeView.exe. That utility will probably output the desired info to STDOUT (the "Standard Out" string output of a program in a cmd.exe Command Prompt window), and that output can be further processed using a regex substitute at the end of the RunCommand measure.

EDIT: Apparently, SoundVolumeView's command line parameters for getting the microphone volume percent (i.e. SoundVolumeView.exe /GetPercent "Microphone") doesn't work in my case, so I can't guarantee for that (changing the volume seems to have an effect though). Anyway, you can always use the NirCMD.exe solution, assuming it works in your case.
Rumblebee
Posts: 4
Joined: July 21st, 2014, 10:08 am

Re: Measuring/changing Microphone Levels

Rumblebee » April 4th, 2019, 3:46 am

Wow, this looks perfect! Thanks for looking into this so much, what you've written will make a great starting point :)

Seems like I have a new project to tinker with, I'll let you know how it goes!
Yincognito
Posts: 652
Joined: February 27th, 2015, 2:38 pm

Re: Measuring/changing Microphone Levels

Yincognito » April 4th, 2019, 3:58 am

Rumblebee wrote:
April 4th, 2019, 3:46 am
Wow, this looks perfect! Thanks for looking into this so much, what you've written will make a great starting point :)

Seems like I have a new project to tinker with, I'll let you know how it goes!
Looking forward to it - good luck! :thumbup: