It is currently April 27th, 2024, 2:04 am

Adjust Mic Volume Level?

Get help with creating, editing & fixing problems with skins
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Adjust Mic Volume Level?

Post by sl23 »

death.crafter wrote: August 12th, 2021, 10:02 pm Yeah I was talking about this one. It works but still gives error.
I can live with it :D
- MuLab -
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Adjust Mic Volume Level?

Post by death.crafter »

sl23 wrote: August 12th, 2021, 10:06 pm I was planning on adding the code to another skin if that's ok? Thanks for the help :thumbup:
Is the delay after clicking due to the nature of the plugin? I tried using:
LeftMouseUpAction=[!SetVariable MicVolume "(Floor($MouseX:%$))"][!CommandMeasure MicVolume "Set-MicVolume"] [!UpdateMeter *][!Redraw]
But it no effect.
It's the plugin. Nothing can be done about that.

If you want you can remove the [!UpdateMeter *][!Redraw] from script file and add it yo LeftMouseUpAction.
I was planning on adding the code to another skin if that's ok?
I made it for you to use lol. Just keep Addons folder intact.
from the Realm of Death
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Adjust Mic Volume Level?

Post by sl23 »

Ah ok, thought as much.
death.crafter wrote: August 12th, 2021, 10:21 pm If you want you can remove the [!UpdateMeter *][!Redraw] from script file and add it yo LeftMouseUpAction.
I did add it to the LeftMouseUpAction, should I delete it from the script then? It doesn't appear to help anyway does it?
death.crafter wrote: August 12th, 2021, 10:21 pm I made it for you to use lol. Just keep Addons folder intact.
Yeah, just best to check though :D And yes, I'll keep it intact, seeing as I haven't a clue how it works :oops: :rofl:
- MuLab -
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Adjust Mic Volume Level?

Post by death.crafter »

sl23 wrote: August 12th, 2021, 10:29 pm I did add it to the LeftMouseUpAction, should I delete it from the script then? It doesn't appear to help anyway does it?

Code: Select all

function Set-MicVolume {
    Set-AudioDevice -RecordingVolume $RmAPI.Variable('MicVolume')
    $RmAPI.Bang('[!CommandMeasure MicVolume Update][!UpdateMeter *][!Redraw]')
}
TO

Code: Select all

function Set-MicVolume {
    Set-AudioDevice -RecordingVolume $RmAPI.Variable('MicVolume')
    $RmAPI.Bang('[!CommandMeasure MicVolume Update]')
}
from the Realm of Death
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Adjust Mic Volume Level?

Post by sl23 »

OMG! I'm stuck already! :oops: :?

So, I'm trying to convert it into a bar rather than a shape measure, and got this so far:

Code: Select all

[Variables]
MicVolume=
Increment=5

[styleBar]
BarColor=235,170,0,255
BarOrientation=HORIZONTAL
SolidColor=255,255,255,15

[MicVolume]
Measure=Plugin
Plugin=PowershellRM
ScriptFile=#@#Scripts\MicVolume.ps1

[meterBarMic]
Meter=Bar
MeterStyle=styleBar
MeasureName=MicVolume
LeftMouseUpAction=[!SetVariable MicVolume "(Floor($MouseX:%$))"][!CommandMeasure MicVolume "Set-MicVolume"] [!UpdateMeter *][!Redraw]
DynamicVariables=1
X=50
Y=50
W=100
H=8

[MeterString]
Meter=String
MeasureName=MicVolume
MeterStyle=sAllText
X=20
Y=15
Text=%1%
Isn't this all that's required from that demo skin? This new skin is in the same folder as the original, so it should see the @Resources folder shouldn't it?

EDIT: Does it have anything to do with this file? MicVolume.code-workspace
What about the skinName or it's folderName, can they be changed without affecting the working of this code?


EDIT: Oh crap!!! Sorry, my fault, was working from the wrong folder! :? :oops:
It works, but not very well. Clicking on the left of the bar is ok but 2% shows fine, click 3% and you get 2.999999999%.
Also, as you move up the bar, the place where the cursor is is not where the 'click' activates the bar. eg, click around 80% and you;ll get about 87%
- MuLab -
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Adjust Mic Volume Level?

Post by sl23 »

Too tired, I need my bed! zzz
Thanks for you assistance death.crafter, I'll be back on this tmrw :D :thumbup:

EDIT: Here's what I'm working on, so you get a better picture.

Code: Select all

[Rainmeter]
Update=50
BackgroundMode=2
SolidColor=0,0,0,1
DynamicWindowSize=1

[Metadata]
Name=RoundTemplate
Author=sl23
Information=RoundTemplate.||Credits:||Adapted from "SimplyRound" Suite by Krzysztof "gronostaj" Smialek||Help via forum: 
Version=2021.8.9
License=CC BY 3.0

[Variables]
Color1=255,255,255,200
Color2=128,255,0
Color3=64,191,167,200
Color4=0,255,255
Color5=255,255,255,60
Color6=64,96,191,200

APP1=explorer.exe
APP2=taskmgr.exe
APP3=ms-settings:
APP4=

NAME1=MS Explorer
NAME2=Task Manager
NAME3=MS Settings
NAME4=

; For Mic Click action
MicVolume=
Increment=5

========================================
; Background
========================================
[Bg]
Meter=Shape
Shape=Rectangle 0,0,230,70,35 | Fill Color 0,0,0,150 | StrokeWidth 2 | Extend StrokeAlpha
StrokeAlpha=Stroke Color #Color5#
DynamicVariables=1
X=2
Y=2

[Bg1]
Meter=Shape
Shape=Rectangle 0,0,60,60,50 | Fill Color 0,0,0,50 | StrokeWidth 2 | Extend StrokeAlpha
Shape2=Rectangle 9,9,42,42,50 | Fill Color 0,0,0,1 | StrokeWidth 2 | Extend StrokeAlpha2
Shape3=Rectangle 5,5,50,50,50 | Fill Color 0,0,0,1 | StrokeWidth 10 | Stroke Color 255,255,255,20
StrokeAlpha=Stroke Color #Color5#
StrokeAlpha2=Stroke Color #Color5#

LeftMouseUpAction=#APP1#
RightMouseUpAction=#APP2#

MouseOverAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color #Color4#"][!SetOption Speaker FontColor "#Color2#"] [!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color #Color5#"][!SetOption Speaker FontColor "#Color1#"] [!UpdateMeter *][!Redraw]

DynamicVariables=1
ToolTipText=L - #NAME1##CRLF#R - #NAME2#
X=7
Y=7

[BgLine]
Meter=Shape
Shape=Rectangle 67,42,100,1,0 | Fill Color #Color5# | StrokeWidth 0
DynamicVariables=1

[Bg2]
Meter=Shape
Shape=Rectangle 0,0,60,60,50 | Fill Color 0,0,0,50 | StrokeWidth 2 | Extend StrokeAlpha
Shape2=Rectangle 9,9,42,42,50 | Fill Color 0,0,0,1 | StrokeWidth 2 | Extend StrokeAlpha2
Shape3=Rectangle 5,5,50,50,50 | Fill Color 0,0,0,1 | StrokeWidth 10 | Stroke Color 255,255,255,20
StrokeAlpha=Stroke Color #Color5#
StrokeAlpha2=Stroke Color #Color5#

LeftMouseUpAction=#APP3#
RightMouseUpAction=#APP4#

MouseOverAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color #Color4#"][!SetOption Mic FontColor "#Color2#"] [!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color #Color5#"][!SetOption Mic FontColor "#Color1#"] [!UpdateMeter *][!Redraw]

DynamicVariables=1
ToolTipText=L - #NAME3##CRLF#R - #NAME4#
X=167
Y=7

========================================
; STYLES
========================================
[sAllText]
FontFace=Trebuchet MS
StringStyle=Bold
StringAlign=Center
FontSize=12
FontColor=#Color1#
StringEffect=Shadow
FontEffectColor=0,0,0,150
AntiAlias=1

[sHighlight]
MouseOverAction=[!SetOption #CURRENTSECTION# FontColor "128,255,0"] [!UpdateMeter #CURRENTSECTION#] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# FontColor ""] [!UpdateMeter #CURRENTSECTION#] [!Redraw]

[sRoundBar]
LineStart=22
LineLength=28
LineWidth=2
StartAngle=(Rad(270))
Antialias=1
Solid=1

[styleBar]
BarColor=235,170,0,255
BarOrientation=HORIZONTAL
SolidColor=255,255,255,15

;[Title]
;Meter=String
;MeterStyle=sAllText | sHighlight
;FontSize=11
;Text=SPKR   +   MIC
;InlineSetting=Size | 8
;InlinePattern=.+  ( .+ )  .+
;LeftMouseUpAction=[!ToggleMeterGroup Info][!Redraw]
;X=116
;Y=25

========================================
; Speaker E767 	Volume; E992 	Volume0; E993 	Volume1; E994 	Volume2; E995 	Volume3;
========================================
[mSpeakerAudio]
Measure=Plugin
Plugin=AudioLevel
Port=Output
RMSAttack=50
RMSDecay=300
RMSGain=1

[mSpeaker]
Measure=Plugin
Plugin=AudioLevel
Parent=mSpeakerAudio
Type=RMS

[Speaker]
Meter=String
MeterStyle=sAllText
MeasureName=mSpeaker
NumOfDecimals=2
Percentual=1
Text=%1
X=90
Y=5

[SpeakerBar]
Meter=Roundline
MeasureName=mSpeaker
MeterStyle=sRoundBar
LineColor=#Color3#
X=37
Y=37

[SpeakerIcon]
Meter=String
MeterStyle=sAllText
FontFace=Segoe MDL2 Assets
FontSize=16
Text=[\xE767]
X=38
Y=27

========================================
; E720 	Microphone; EC54 	MicOff; EC55 	MicSleep; EC56 	MicError; F12E 	MicrophoneListening
========================================
[mMicAudio]
Measure=Plugin
Plugin=AudioLevel
Port=Input
RMSAttack=50
RMSDecay=300
;Set your desired Mic-response here--------------------
RMSGain=6

[mMic]
Measure=Plugin
Plugin=AudioLevel
Parent=mMicAudio
Type=RMS

[Mic]
Meter=String
MeterStyle=sAllText
MeasureName=mMic
NumOfDecimals=2
Percentual=1
Text=%1
X=145
Y=5

[MicBar]
Meter=Roundline
MeasureName=mMic
MeterStyle=sRoundBar
LineColor=#Color3#
X=197
Y=37

[MicIcon]
Meter=String
MeterStyle=sAllText
FontFace=Segoe MDL2 Assets
FontSize=16
Text=[\xE720]
X=197
Y=27




[MicVolume]
Measure=Plugin
Plugin=PowershellRM
ScriptFile=#@#Scripts\MicVolume.ps1

[meterBarMic]
Meter=Bar
MeterStyle=styleBar
MeasureName=MicVolume
LeftMouseUpAction=[!SetVariable MicVolume "(Floor($MouseX:%$))"][!CommandMeasure MicVolume "Set-MicVolume"] [!UpdateMeter *][!Redraw]
DynamicVariables=1
X=70
Y=50
W=90
H=8

[MeterString]
Meter=String
MeasureName=MicVolume
MeterStyle=sAllText
X=20
Y=15
Text=%1%
Last edited by sl23 on August 14th, 2021, 2:07 pm, edited 3 times in total.
- MuLab -
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Adjust Mic Volume Level?

Post by death.crafter »

sl23 wrote: August 12th, 2021, 10:51 pm OMG! I'm stuck already! :oops: :?

So, I'm trying to convert it into a bar rather than a shape measure, and got this so far:

Code: Select all

[Variables]
MicVolume=
Increment=5

[styleBar]
BarColor=235,170,0,255
BarOrientation=HORIZONTAL
SolidColor=255,255,255,15

[MicVolume]
Measure=Plugin
Plugin=PowershellRM
ScriptFile=#@#Scripts\MicVolume.ps1

[meterBarMic]
Meter=Bar
MeterStyle=styleBar
MeasureName=MicVolume
LeftMouseUpAction=[!SetVariable MicVolume "(Floor($MouseX:%$))"][!CommandMeasure MicVolume "Set-MicVolume"] [!UpdateMeter *][!Redraw]
DynamicVariables=1
X=50
Y=50
W=100
H=8

[MeterString]
Meter=String
MeasureName=MicVolume
MeterStyle=sAllText
X=20
Y=15
Text=%1%
Isn't this all that's required from that demo skin? This new skin is in the same folder as the original, so it should see the @Resources folder shouldn't it?

EDIT: Does it have anything to do with this file? MicVolume.code-workspace
What about the skinName or it's folderName, can they be changed without affecting the working of this code?


EDIT? Oh crap!!! Sorry, my fault, was working from the wrong folder! :? :oops:
It works, but not very well. Clicking on the left of the bar is ok but 2% shows fine, click 3% and you get 2.999999999%.
Also, as you move up the bar, the place where the cursor is is not where the 'click' activates the bar. eg, click around 80% and you;ll get about 87%
Don't know about bars much but you shouldn't get double values. Only integers since floor is used.

May be try the same with shape. I prefer shapes because they are like vectors, pixel independent i.e.
from the Realm of Death
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Adjust Mic Volume Level?

Post by sl23 »

Ok will give that a go tomorrow. Thank you.
- MuLab -
User avatar
Yincognito
Rainmeter Sage
Posts: 7175
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Adjust Mic Volume Level?

Post by Yincognito »

For the record, if it's for local use, you can easily set the mic level using Win7Audio measures, assuming you identify your MIC's index in the output device list first.

If intended to be shared, probably some more measures (e.g. AudioLevel, Registry) would be needed to identify the MIC's ID and / or index so you can set it for use with the Win7Audio measure.

Another alternative is to use some NirCmd utilities to do that.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Adjust Mic Volume Level?

Post by death.crafter »

Yincognito wrote: August 13th, 2021, 10:46 am For the record, if it's for local use, you can easily set the mic level using Win7Audio measures, assuming you identify your MIC's index in the output device list first.

If intended to be shared, probably some more measures (e.g. AudioLevel, Registry) would be needed to identify the MIC's ID and / or index so you can set it for use with the Win7Audio measure.

Another alternative is to use some NirCmd utilities to do that.
https://docs.rainmeter.net/manual-beta/plugins/win7audio/
Are you sure?

And about nircmd, how would you get the volume?
from the Realm of Death