It is currently September 16th, 2024, 7:08 pm

Audio Peak Level not dropping

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

Re: Audio Peak Level not dropping

Post by sl23 »

sl23 wrote: July 1st, 2024, 1:05 pm ...On sensing a drop in volume, it will pause the meter (or Measure) for a second to allow it to stay in position when dropped, but react straight away when increased in volume.
Haha! I know how you feel! I lost myself ages ago and had to reread this bit! :rolmfao:

Well, that's the goal, but I'm so far from the mark I can't even see it with a telescope! :Whistle
57686174 77696C6C 6265 77696C6C 6265
User avatar
sl23
Posts: 1686
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Audio Peak Level not dropping

Post by sl23 »

Yincognito wrote: July 1st, 2024, 4:19 pmSo, do you still need that previous value vs current value thingy or not? :confused:
I do, I do, yes, I do!!! :D
Everything I do just creates more problems I get so many errors now! :oops: :rolmfao:
57686174 77696C6C 6265 77696C6C 6265
User avatar
sl23
Posts: 1686
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Audio Peak Level not dropping

Post by sl23 »

Managed to get this close, but the attack doesn't respond quickly enough.

Code: Select all

[mPeakLeft]
Measure=Plugin
Plugin=AudioLevel
Parent=mAudio
Type=Peak
Channel=L
OnChangeAction=[!SetVariable PeakDelayL "[#CURRENTSECTION#]"]
IfCondition=#CURRENTSECTION#=1
IfTrueAction=[!ShowMeter ClipL][!UpdateMeter ClipL][!Redraw]
IfFalseAction=[!Delay 1000][!HideMeter ClipL][!UpdateMeter ClipL][!Redraw]
DynamicVariables=1
IfCondition2=(#CURRENTSECTION# < #PeakDelayL#)
IfTrueAction2=[!PauseMeasure #CURRENTSECTION#][!Delay 1000][!UnPauseMeasure #CURRENTSECTION#][!Redraw]
But getting error: Extra operation: IfCondition2=(mPeakLeft < ) (RM - Backup\OcenVUmeter\5. OcenVUMetre.ini - [mPeakLeft])
This sort of works. Two issues though.
1. Attack doesn't respond with the RMS meters. Almost ok, but not quite. Have to do.
2. After a pause, there's a sudden drop before slow descent. Probably nothing can be done with this one I expect.

Full code:

Code: Select all

[Rainmeter]
Update=25
BackgroundMode=2
SolidColor=255,255,255,20
AccurateText=1
MiddleMouseUpAction=[!Refresh]

[Metadata]
Author=sl23
Description=VU Metre
Version=2024.6.30

[Variables]
AquaDark=0,255,255,200
Green=128,255,0
Orange=255,170,0
OrangeDark=255,128,0
Red=255,100,100
White20=255,255,255,20
PeakDelayL=
PeakDelayR=

========================================
; Measures
========================================
[mAudio]
Measure=Plugin
Plugin=AudioLevel
Port=Output
RMSAttack=52
RMSDecay=300
RMSGain=2.0
PeakAttack=50
PeakDecay=3000
PeakGain=2.0
DynamicVariables=1

[mLeft]
Measure=Plugin
Plugin=AudioLevel
Parent=mAudio
Type=RMS
Channel=L

[mRight]
Measure=Plugin
Plugin=AudioLevel
Parent=mAudio
Type=RMS
Channel=R

[mPeakLeft]
Measure=Plugin
Plugin=AudioLevel
Parent=mAudio
Type=Peak
Channel=L
OnChangeAction=[!SetVariable PeakDelayL "[#CURRENTSECTION#]"]
IfCondition=#CURRENTSECTION#=1
IfTrueAction=[!ShowMeter ClipL][!UpdateMeter ClipL][!Redraw]
IfFalseAction=[!Delay 1000][!HideMeter ClipL][!UpdateMeter ClipL][!Redraw]
IfCondition2=(#CURRENTSECTION# < #PeakDelayL#)
IfTrueAction2=[!PauseMeasure #CURRENTSECTION#][!Delay 1000][!UnPauseMeasure #CURRENTSECTION#]
IfFalseAction=[!UnPauseMeasure #CURRENTSECTION#]
DynamicVariables=1

[mPeakRight]
Measure=Plugin
Plugin=AudioLevel
Parent=mAudio
Type=Peak
Channel=R
OnChangeAction=[!SetVariable PeakDelayR "[#CURRENTSECTION#]"]
IfCondition=#CURRENTSECTION#=1
IfTrueAction=[!ShowMeter ClipR][!UpdateMeter ClipR][!Redraw]
IfFalseAction=[!Delay 1000][!HideMeter ClipR][!UpdateMeter ClipR][!Redraw]
IfCondition2=(#CURRENTSECTION# < #PeakDelayR#)
IfTrueAction2=[!PauseMeasure #CURRENTSECTION#][!Delay 1000][!UnPauseMeasure #CURRENTSECTION#]
IfFalseAction=[!UnPauseMeasure #CURRENTSECTION#]
DynamicVariables=1

========================================
; Meters
========================================
[sClip]
Shape=Rectangle 0,0,5,5 | Fill Color #Red# | StrokeWidth 0
Y=r
Hidden=1

[sPeak]
Shape=Rectangle 0,0,2,5 | Fill Color #AquaDark# | StrokeWidth 0
DynamicVariables=1
Y=r

[sBar]
BarOrientation=Horizontal
BarColor=#Green#,70
SolidColor=#White20#
W=200
H=5
Y=r

;-------------------------------------
[OutBarL]
Meter=Bar
MeasureName=mLeft
MeterStyle=sBar

[ClipL]
Meter=Shape
MeterStyle=sClip
X=5R

[PeakBarL]
Meter=Shape
MeterStyle=sPeak
X=([OutBarL:X]+[OutBarL:W]*[mPeakLeft])

;-------------------------------------
[OutBarR]
Meter=Bar
MeasureName=mRight
MeterStyle=sBar
Y=2R

[ClipR]
Meter=Shape
MeterStyle=sClip
X=5R

[PeakBarR]
Meter=Shape
MeterStyle=sPeak
X=([OutBarR:X]+[OutBarR:W]*[mPeakRight])
57686174 77696C6C 6265 77696C6C 6265
User avatar
Yincognito
Rainmeter Sage
Posts: 8153
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Audio Peak Level not dropping

Post by Yincognito »

sl23 wrote: July 1st, 2024, 1:05 pmOn sensing a drop in volume, it will pause the meter (or Measure) for a second to allow it to stay in position when dropped, but react straight away when increased in volume.
sl23 wrote: July 1st, 2024, 4:25 pmWell, that's the goal
sl23 wrote: July 1st, 2024, 5:26 pmI do, I do, yes, I do!!! :D
So, just to be sure, if 0.7, 0.5, 0.3, 0.4, 0.2 happen one after the other during that one second while it should stay in position at 0.7 (because 0.5 was less than the previous 0.7 value), it should however use 0.4 when this occurs (because it is greater than the previous 0.3 value), right? In other words, an increase in the value has priority over the potential stay in position that might be happening at the same time? Yes or no.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1686
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Audio Peak Level not dropping

Post by sl23 »

Got it in one! :thumbup:

Actually, I'm thinking it may be better to have it pause as priority for the whole second. Please! :thumbup:
57686174 77696C6C 6265 77696C6C 6265
User avatar
Yincognito
Rainmeter Sage
Posts: 8153
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Audio Peak Level not dropping

Post by Yincognito »

sl23 wrote: July 1st, 2024, 7:47 pmActually, I'm thinking it may be better to have it pause as priority for the whole second. Please! :thumbup:
I'll wait for a confirmation that you're absolutely sure about it, I don't like to work twice on something. :p
Then, either tonight if I'm still in the mood after the Euros, or tomorrow, you'll probably have a short sample of how to do it. It'll be up to you to adapt it to your skin, since I'll use RMS for simplicity in testing.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1686
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Audio Peak Level not dropping

Post by sl23 »

Ok, sorry, just had second thoughts about how it should work. The second thought was the better one! :D

Definitely! :lol: :thumbup:

Will it work with Peak if you're designing it for RMS? Or doesn't it matter? It's adaptable to either I suppose?

Thank you... again! :Whistle
57686174 77696C6C 6265 77696C6C 6265
User avatar
Yincognito
Rainmeter Sage
Posts: 8153
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Audio Peak Level not dropping

Post by Yincognito »

sl23 wrote: July 1st, 2024, 8:38 pm Will it work with Peak if you're designing it for RMS?
I'll simply use a default / rudimentar AudioLevel parent for the sample (hence RMS). You'll just have to adjust the parent as desired, and move the IfCondition(s) into a child with Type=Peak instead, nothing fancy.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1686
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Audio Peak Level not dropping

Post by sl23 »

I bet you think I understood that?! :rolmfao:
57686174 77696C6C 6265 77696C6C 6265
User avatar
Yincognito
Rainmeter Sage
Posts: 8153
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Audio Peak Level not dropping

Post by Yincognito »

sl23 wrote: July 2nd, 2024, 10:28 am I bet you think I understood that?! :rolmfao:
Well, you will have to, cause I won't repeat myself. ;-)

Alright, so here's the sample, you'll have to uncomment the Formula corresponding to the priority you prefer (you said you wanted the "Time Expiration" priority, but I included the "Value Increase" one just so I don't have to do it again if you changed your mind, and also for comparison purposes):

Code: Select all

[Variables]
Update=25
TimeMax=1000

[Rainmeter]
Update=#Update#
AccurateText=1
DynamicWindowSize=1
BackgroundMode=2
SolidColor=128,128,128,255

---Measures---

[TimeValue]
Group=Toggle
Paused=1
Measure=Calc

; PRIORITY = Time Expiration
; Formula=((TimeValue+#Update#>=#TimeMax#)?0:TimeValue+#Update#)

; PRIORITY = Value Increase
; Formula=((TimeValue+#Update#>=#TimeMax#)||(CurrValue>=LastValue)?0:TimeValue+#Update#)

IfCondition=(TimeValue=0)
IfTrueAction=[!TogglePauseMeasureGroup Toggle]
IfConditionMode=1

[LastValue]
Measure=Calc
Formula=CurrValue

[CurrValue]
Measure=Plugin
Plugin=AudioLevel
RMSGain=3

[FakeValue]
Group=Toggle
Measure=Calc
Formula=(CurrValue<LastValue?LastValue:CurrValue)
IfCondition=(CurrValue<LastValue)&&(TimeValue=0)
IfTrueAction=[!TogglePauseMeasureGroup Toggle]
IfConditionMode=1

---Meters---

[Result]
Meter=String
FontFace=Consolas
MeasureName =LastValue
MeasureName2=CurrValue
MeasureName3=FakeValue
NumOfDecimals=5
Text=Last Value = %1#CRLF#Curr Value = %2#CRLF#Fake Value = %3
DynamicVariables=1

[Visual]
Meter=Shape
X=5R
Y=0r
Shape =Rectangle 0, 0,             150 ,48 | StrokeWidth 0 | Fill Color 128,128,128,255
Shape2=Rectangle 0, 0,([LastValue]*150),16 | StrokeWidth 0 | Stroke Color 0,0,0,0 | Fill Color 255,0,0,255
Shape3=Rectangle 0,16,([CurrValue]*150),16 | StrokeWidth 0 | Stroke Color 0,0,0,0 | Fill Color 0,255,0,255
Shape4=Rectangle 0,32,([FakeValue]*150),16 | StrokeWidth 0 | Stroke Color 0,0,0,0 | Fill Color 0,0,255,255
DynamicVariables=1
What you're after is FakeValue. Be aware that the order of measures does matter. The idea is simple:
- you start with TimeValue as the time counter paused at 0, and FakeValue unpaused as the largest between LastValue and CurrValue
- in FakeValue, when value drops and time is 0, you pause FakeValue to keep position and unpause TimeValue to start the time counter
- in TimeValue, you count to TimeMax and when you reach it, you reset time at 0 to again pause TimeValue and unpause FakeValue
Obviously, Update is assumed to be less than TimeMax so that the math checks out. The values are displayed as numbers and bars for conveniency. You can set Update and TimeMax to larger values like 2500 and 5000, to better observe the behavior in slow motion.

Not sure if you need PeakValue anymore, you'll have to figure that out yourself. The implementation and whatever other details regarding the inclusion of the approach in your skin is entirely up to you. Me, I already explained how to reach your goal, both in words and in code:
sl23 wrote: July 1st, 2024, 1:05 pmOn sensing a drop in volume, it will pause the meter (or Measure) for a second to allow it to stay in position when dropped, but react straight away when increased in volume.
sl23 wrote: July 1st, 2024, 7:47 pmActually, I'm thinking it may be better to have it pause as priority for the whole second.
sl23 wrote: July 1st, 2024, 4:25 pmWell, that's the goal
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth