It is currently February 26th, 2024, 7:50 am

## Peak on a ballistic trajectory sticks at the top of the meter

Get help with creating, editing & fixing problems with skins
Bekarfel
Posts: 217
Joined: May 16th, 2012, 5:38 am

### Re: Peak on a ballistic trajectory sticks at the top of the meter

May I try to explain my formula? I believe it's quite simple, but I could have a poor perspective on the formula
moshi wrote:there are many Rainmeter skins that aren't really useful, so let's add another one.
jsmorley wrote:I have good news and bad news.
First the bad news. [...] We would be happy to have this happen and would love to work with anyone who is feeling ambitious.
Now the good news.
I lied, there isn't any good news...
eclectic-tech
Rainmeter Sage
Posts: 5333
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

### Re: Peak on a ballistic trajectory sticks at the top of the meter

Yes, your thoughts on developing a formula are welcomed.

In use, I don't think there is an issue with your acceleration formula; I believe the "ballistic" reaction is due to how it is applied.

You add the acceleration to your audiolevel to get the initial value, but then on the next update, if the audiolevel is still higher, you take that sum (accleration AND audiolevel) and add acceleration and audiolevel again, effectively doubling the result. I think that is why we was seeing values up to 15 to 20 times the actual audiolevel.

There are several ways to get a slowly diminishing peak bar, and I would like to see you succeed in this idea.

Bekarfel
Posts: 217
Joined: May 16th, 2012, 5:38 am

### Re: Peak on a ballistic trajectory sticks at the top of the meter

The formula basically compares the current audio level (MeasureL) with the previous peak level (MeasureL_Peak) and adjusts the acceleration (MeasureL_Accel) accordingly. If the current audio level is higher than the previous peak level plus some threshold, then the formula sets the acceleration to be equal to the difference between them. If the current audio level is lower than that threshold, then the formula subtracts a constant gravity value from the acceleration. I've made a google doc simulator of this function to maybe help understand how it functions. You can edit the values in the MeasureL column to see its response. https://docs.google.com/spreadsheets/d/1vX-LFLPIm7NqsGekEeooVlopRXKG63XuhTuAd5pn6qQ/edit?usp=sharing
moshi wrote:there are many Rainmeter skins that aren't really useful, so let's add another one.
jsmorley wrote:I have good news and bad news.
First the bad news. [...] We would be happy to have this happen and would love to work with anyone who is feeling ambitious.
Now the good news.
I lied, there isn't any good news...
eclectic-tech
Rainmeter Sage
Posts: 5333
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

### Re: Peak on a ballistic trajectory sticks at the top of the meter

Sorry for the delay getting back here...

I had a chance to look at this and as far as I can tell, the cause for the "ballistic" reaction is due to your conditional statement nesting confusing Rainmeter.

If I bracket your nested tests with parenthesis, then the acceleration behaves as expected.

I changed the Formula for acceleration (this is for left) to:

Code: Select all

``````[MeasureL_Accel]
Measure = Calc
Formula = (1.0 <= MeasureL_Peak ? 0 - #Gravity# : (MeasureL >= MeasureL_Peak + ( MeasureL >= MeasureL_Peak ? MeasureL - MeasureL_Peak : MeasureL_Accel - #Gravity# ) ? MeasureL - MeasureL_Peak : MeasureL_Accel - #Gravity#))

[MeasureL_Peak]
Measure = Calc
Formula = Clamp(MeasureL_Accel + MeasureL_Peak,0,1)
``````
I did added a Clamp on [MeasureL_Peak] to prevent it from going negative, which would allow the peak bar to go below the current audio level.

This eliminates pinning the peak (unless you increase the RMSGain), but it may also not show enough of a reaction for your desired effect.
gravity.gif
Full code
You do not have the required permissions to view the files attached to this post.

Bekarfel
Posts: 217
Joined: May 16th, 2012, 5:38 am

### Re: Peak on a ballistic trajectory sticks at the top of the meter

That change works perfectly for the peak pinning. Thank you so much for your help Eclectic. I'll have to keep in mind the parentheses are required in nested conditionals. For reference, here's my peak with your fixes applied, and I think it works great! that first peak hit doesn't pin any more, and I went through the entire song and didn't get any peaks pinned to the top.
I've had a think about how to address the perceived unresponsiveness of the meter, and one thing I've noticed is that the AudioLevel meter doesn't always update every frame. My google doc simulation is influenced by small reductions in MeasureL, I think this is a result of some error in the threshold to determine if the peak is going to clip the Measure. I'm not sure what to do about AudioLevel or the apparent bug in my math, so I doubled the update time, doubled gravity, and it looks like this
Peak Performance.gif
You do not have the required permissions to view the files attached to this post.
moshi wrote:there are many Rainmeter skins that aren't really useful, so let's add another one.
jsmorley wrote:I have good news and bad news.
First the bad news. [...] We would be happy to have this happen and would love to work with anyone who is feeling ambitious.
Now the good news.
I lied, there isn't any good news...
eclectic-tech
Rainmeter Sage
Posts: 5333
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

### Re: Peak on a ballistic trajectory sticks at the top of the meter

That looks much better to me! I really like the motion you achieve with this acceleration/gravity method.

Tweaking the acceleration formula and skin variables should get you closer to the animation effect you are looking for...
I'll probably play with those to see if a better response can be achieved, but you have it working pretty well.

Bekarfel
Posts: 217
Joined: May 16th, 2012, 5:38 am

### Re: Peak on a ballistic trajectory sticks at the top of the meter

I made some changes to the formula to give it more of the effect that I wanted, especially where it was getting pinned at the top it behaves more realistically now. Let me know what you think. The meter on the left is the new one, meter on the right is the original
Peak pong.gif
You do not have the required permissions to view the files attached to this post.
moshi wrote:there are many Rainmeter skins that aren't really useful, so let's add another one.
jsmorley wrote:I have good news and bad news.
First the bad news. [...] We would be happy to have this happen and would love to work with anyone who is feeling ambitious.
Now the good news.
I lied, there isn't any good news...
eclectic-tech
Rainmeter Sage
Posts: 5333
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

### Re: Peak on a ballistic trajectory sticks at the top of the meter

Bekarfel wrote: March 3rd, 2023, 1:45 am I made some changes to the formula to give it more of the effect that I wanted, especially where it was getting pinned at the top it behaves more realistically now. Let me know what you think. The meter on the left is the new one, meter on the right is the original {clip Image}
The left looks a bit more responsive. It would be interesting to see your formula changes or the skin code...

Bekarfel
Posts: 217
Joined: May 16th, 2012, 5:38 am

### Re: Peak on a ballistic trajectory sticks at the top of the meter

Well, ya see, the first thing I did was to hard lock Rainmeter, as is tradition. Next I remembered, aha! parentheses! and rewrote the -MeasureL_Accel * 0.75 which crashes Rainmeter as (0 - MeasureL_Accel) * 0.75. This went into the sections that define the peak range limits: where 1.0 <= MeasureL_Peak, and where MeasureL_Peak <= MeasureL.

Formula = (1.0 <= MeasureL_Peak ? (0 - MeasureL_Accel) * 0.75 : (MeasureL >= MeasureL_Peak + ( MeasureL >= MeasureL_Peak ? MeasureL - MeasureL_Peak : MeasureL_Accel - #Gravity# ) ? Max(MeasureL - MeasureL_Peak,(0 - MeasureL_Accel) * 0.75) : MeasureL_Accel - #Gravity#))
moshi wrote:there are many Rainmeter skins that aren't really useful, so let's add another one.
jsmorley wrote:I have good news and bad news.
First the bad news. [...] We would be happy to have this happen and would love to work with anyone who is feeling ambitious.
Now the good news.
I lied, there isn't any good news...
eclectic-tech
Rainmeter Sage
Posts: 5333
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Thanks!