It is currently April 24th, 2024, 11:22 pm

Measuring/changing Microphone Levels

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

Measuring/changing Microphone Levels

Post by Rumblebee »

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 :)
User avatar
Yincognito
Rainmeter Sage
Posts: 7157
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Measuring/changing Microphone Levels

Post by Yincognito »

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.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
Rumblebee
Posts: 4
Joined: July 21st, 2014, 10:08 am

Re: Measuring/changing Microphone Levels

Post by Rumblebee »

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!
User avatar
Yincognito
Rainmeter Sage
Posts: 7157
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Measuring/changing Microphone Levels

Post by Yincognito »

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:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth