It is currently September 8th, 2024, 12:16 am

Audio Peak Level not dropping

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Audio Peak Level not dropping

Post by Yincognito »

sl23 wrote: July 9th, 2024, 10:37 am The decrease isn't so much of an issue really, it's mainly the increase. When louder volumes are given, the peak meters don't quite respond quickly enough. So the RMS VU meters exceed the Peak volume, which obviously shouldn't happen.
They also, occasionally 'stick' when maxed out for over the delay time.

I was just hoping that maybe this could be updated (not fixed :p ) so it could be used to properly gauge the peaks. :welcome:
I think updating the plugin itself is highly unlikely, but the basics of it are perfectly achievable.

For example, like I repeatedly said before (to no avail), some simple changes to the "Value Increase" variant I wrote earlier do some of what you mentioned, except the gradual decrease to the current RMS level (which is why I said it was the main issue to solve):

Code: Select all

[Variables]
Update=25
TimeMax=1000

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

---Measures---

[CurrValue]
Measure=Plugin
Plugin=AudioLevel

[TimeValue]
Group=Toggle
Paused=1
Measure=Calc
Formula=((TimeValue+#Update#>=#TimeMax#)||(CurrValue>HoldValue)?0:TimeValue+#Update#)
IfCondition=(TimeValue=0)
IfTrueAction=[!TogglePauseMeasureGroup Toggle]
IfConditionMode=1

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

[PeakValue]
Measure=Plugin
Plugin=AudioLevel
Parent=CurrValue
Type=Peak

---Meters---

[Result]
Meter=String
FontFace=Consolas
MeasureName =CurrValue
MeasureName2=HoldValue
MeasureName3=PeakValue
NumOfDecimals=5
Text=Curr Value = %1#CRLF#Hold Value = %2#CRLF#Peak 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,([CurrValue]*150),16 | StrokeWidth 0 | Stroke Color 0,0,0,0 | Fill Color 255,0,0,255
Shape3=Rectangle 0,16,([HoldValue]*150),16 | StrokeWidth 0 | Stroke Color 0,0,0,0 | Fill Color 0,255,0,255
Shape4=Rectangle 0,32,([PeakValue]*150),16 | StrokeWidth 0 | Stroke Color 0,0,0,0 | Fill Color 0,0,255,255
DynamicVariables=1
Desktop_2024_07_10_15_28_38_842.gif
The PeakValue measure is included just for reference and comparison, as the HoldValue measure is the value you look for. As you can see, the latter does hold for the TimeMax interval and is always greater than CurrValue aka RMS, but it is lower than the PeakValue (don't ask me why, I didn't add other options, just the minimal), since it's basically just a periodical maximum of the RMS. And, obviously, it doesn't gradually "fall" nicely like in the spectrum analyzer of the players you mentioned. I didn't even try to do the gradual fall, because:
sl23 wrote: July 9th, 2024, 10:37 am but then I doubt it'll ever be how I would like it. :Whistle
and I don't like to do pointless things. So, it's just a minimal attempt, not even bothering with the Type=Peak values other than illustrating them for comparison purposes. I used the first 30 seconds of Cypress Hill - Insane In The Brain as a testing track, by the way.

By the way, if curious, eclectic-tech tackled the gain (not the hold, as far as I could see from the preview) thing, so maybe that helps too:
https://forum.rainmeter.net/viewtopic.php?t=44295
You do not have the required permissions to view the files attached to this post.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1600
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Audio Peak Level not dropping

Post by sl23 »

Thanks, I'll take a closer look.

I know you've tried, repeatedly, to help, it's just that you've done so much and I just don't understand how to do what you're saying to do. Believe me, I've tried. My 'programming' skills virtually non-existent. What I know about such things is extremely minimal. I may have found my way around Rainmeter code, but it's more copy and paste and seeing how others did it, more copy and paste. I don't know the reason why certain things work, like an issue in the past where I was needing a number value despite being given a numeric string value. I didn't understand that whoever was explaining meant that in the About window, which I never used at the time, I needed to use the Number value, but they didn't explain that. I feel bad keep asking you to help. So I'm just trying to make things clear to both you and eclectic-tech what it is that's 'wrong' in my opinion.

It's been a very steep learning curve and as it's an occasional er, hobby? I never remember too much from one 'session' to the next. It's like trying to explain to a Chinese person how to build a car, but only knowing a few words and not knowing how sentences are structured. O.O

I feel I'm being too picky over something that is only me complaining about and that isn't really meant for monitoring purposes anyway. I was just hoping maybe I could get it to do what I wanted. :)

I did see et's version, just haven't gotten round to replying yet. I think there's some confusion about what he thinks I'm trying to achieve?

Thanks to both of you for your help. :thumbup:
57686174 77696C6C 6265 77696C6C 6265
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Audio Peak Level not dropping

Post by Yincognito »

Yeah, no worries, just saying - you can't work on something if you don't understand how, and you can't understand how if you don't keep some basic things in mind or ask for details / explanations of what some posted code actually does. Otherwise it's like talking to walls, really. Obviously, you probably don't have much fault in it, I'm just saying that it's a bit difficult to transmit things if they don't "hold" / "stick" somewhere (just like these measures). No, now it's mostly clear what you wanted, it's just that eclectic-tech worked on something related - at least that's how I see it. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1600
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Audio Peak Level not dropping

Post by sl23 »

Thanks for your patients and understanding. :)

I just get fed up keep asking at every step and don't like harassing people when it gets overly complex. Even though I have sorta did that here... and there! :oops: :lol:

Thanks for the solution. Believe me, I wish I could do this on my own, that's sort of the whole point of this app isn't it? get creative and try things for yourself. I'm not one for downloading other people's skins to use, even the really nice looking ones. I want to know how things work. With programming, I'm missing a large chunk of fundamental knowledge. I keep trying to learn more though. I found a great PDF from someone who had issues starting, the way I have, it's helped understand a few things.

:thumbup:
57686174 77696C6C 6265 77696C6C 6265
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Audio Peak Level not dropping

Post by Yincognito »

sl23 wrote: July 10th, 2024, 2:41 pmI just get fed up keep asking at every step and don't like harassing people when it gets overly complex.
From my point of view, there's a difference between asking how a code I wrote works (which doesn't bother me at all, if done in one compact post covering everything that's unclear immediately afterwards), and jumping with many questions about this or that when not really related to the actual subject (which I do mind, as it makes the thread and the replies be all over the place). I typically don't explain the code (unless asked to) in case the user gets the idea, because it saves some of my time (e.g. if I explain something that the user already understood, then the time was wasted, since the explanation wasn't necessary in the first place). Oh, and, of course, repeating things I already said to the same user is not my cup of tea either. :D
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1600
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Audio Peak Level not dropping

Post by sl23 »

:great:
57686174 77696C6C 6265 77696C6C 6265
User avatar
sl23
Posts: 1600
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Audio Peak Level not dropping

Post by sl23 »

:oops: Just wondering if ActionTimer could be used when the HoldValue timer is up? To fade the PeakHold down like when hovering/leaving over a skin to enlarge/shrink it.
Trouble is, I don't understand how your formulas work:
((TimeValue+#Update#>=#TimeMax#)||(CurrValue>HoldValue)?0:TimeValue+#Update#)
I get the first part, then two || mean OR, but get lost at the ?0: What does it mean? Tried that regex site you pointed to, but gives error with the ?
Also, does && mean AND?
57686174 77696C6C 6265 77696C6C 6265
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Audio Peak Level not dropping

Post by Yincognito »

((TimeValue+#Update#>=#TimeMax#)||(CurrValue>HoldValue)?0:TimeValue+#Update#)
IF TimeValue+#Update#>=#TimeMax# OR CurrValue>HoldValue:
- THEN return 0
- ELSE return TimeValue+#Update#
Reference:
https://docs.rainmeter.net/manual/formulas/#Conditional

So basically TimeValue will continue counting time (the ELSE branch) until it surpasses TimeMax or the RMS is greater than the Hold-ed value (the IF part), at which point TimeValue will be reset to 0 (the THEN branch). This 0 value is used in HoldValue to start counting time (if also the RMS is not greater than the Hold-ed value) and in TimeValue to stop counting time, by inverting the state of these two measures with opposite paused states. In other words, you either start counting and pause the hold value, or finish / reset / pause counting and pick the next value to hold (essentially, the current RMS).

Yes, && means AND. And yes, ActionTimer can be used to gradually decrease (which is what I already mentioned earlier as a possbility). That being said, the decrease can be achieved without ActionTimer too, if the decrease time is included in the hold time, and then some value is subtracted from the hold value until the former reaches the RMS value (aka CurrValue).
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1600
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Audio Peak Level not dropping

Post by sl23 »

So it's like a shorthand IfCondition? Didn't realise that was in the manual: <condition> ? <expr. if true.> : <expr. if false.>.
But then, I wouldn't have connected it to this!

Yes, I do remember, you did mention ActionTimer, wasn't sure if that related to this code or previous though, or doesn't matter?
...decrease can be achieved without ActionTimer too, if the decrease time is included in the hold time, and the some (did you mean 'then some' or 'the same'? The latter I assume) value is subtracted from the hold value until the former reaches the RMS value (aka CurrValue).
Not sure I follow...? I mean, I get it in principal, but how this is achieved I can't figure out where to start. I tried but failed miserably as usual! :lol:
57686174 77696C6C 6265 77696C6C 6265
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Audio Peak Level not dropping

Post by Yincognito »

Yes, a shorthand IfCondition.

I meant 'then some', or even 'some' alone - that was a remnant of rephrasing.

I might think about it in the following days, if I'm in the mood. A slightly different approach might be needed in such a case (e.g. subtracting 0 for the first second, then subtract some non 0 value for the following second or similar). So probably the pausing would have to be applied only to the timer when it reaches the max time or 0.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth