It is currently October 18th, 2024, 5:17 am

Measure Audio Level

Get help with creating, editing & fixing problems with skins
User avatar
Rooky_89
Posts: 69
Joined: September 21st, 2024, 4:57 pm
Location: Germany, in the stone cave

Measure Audio Level

Post by Rooky_89 »

Hello, I'm back with a new case :bow: :p

I try to hide a String, with the Measure of the Audio Level.. Well it is working but not perfect i have sometimes a little issue in my opinion. :(
It´s difficult to discribe. The audio level is measured, and if it is greater than 0.01 [sound is played] then the conditions are executed. However, if the sound falls too quickly and rises again within seconds, then the skin or measurement value does not update quickly enough and the text no longer disappears. [look at the GIF].

Code: Select all

;
[MeasureAudioRaw]
Measure=Plugin
Plugin=AudioLevel

;Sound Left
[MeasureAudioRMS_L]
Measure=Plugin
Plugin=AudioLevel
Parent=MeasureAudioRaw
Channel=L
Type=RMS
IfCondition=MeasureAudioRMS_L > 0.01
IfTrueAction=[!HideMeter Str1][!UpdateMeasure MeasureAudioRMS_L][!Redraw][!Update]
IfFalseAction=[!Delay 100][!ShowMeter Str1][!UpdateMeasure MeasureAudioRMS_R][!Redraw][!Update]

;Sound Right
[MeasureAudioRMS_R]
Measure=Plugin
Plugin=AudioLevel
Parent=MeasureAudioRaw
Channel=R
Type=RMS
IfCondition=MeasureAudioRMS_R > 0.01
IfTrueAction=[!HideMeter Str1][!UpdateMeasure MeasureAudioRMS_R][!Redraw][!Update]
IfFalseAction=[!Delay 100][!ShowMeter Str1][!UpdateMeasure MeasureAudioRMS_R][!Redraw][!Update]
MediaPlay_.rmskin
error.gif
You do not have the required permissions to view the files attached to this post.
Last edited by Rooky_89 on October 1st, 2024, 6:26 pm, edited 1 time in total.
User avatar
sl23
Posts: 1835
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Measure Audio Level

Post by sl23 »

Have you tried increasing the measured volume to 0.1?
57686174 77696C6C 6265 77696C6C 6265
User avatar
balala
Rainmeter Sage
Posts: 16669
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Measure Audio Level

Post by balala »

Rooky_89 wrote: September 30th, 2024, 6:32 pm The audio level is measured, and if it is greater than 0.01 [sound is played] then the conditions are executed. However, if the sound falls too quickly and rises again within seconds, then the skin or measurement value does not update quickly enough and the text no longer disappears.
Hard to say something meaningful, because I can't replicate the issue (don't know what sound to use for this), however:
  • It's a complete non-sense to have two different IfConditions, into two different measures, both showing / hiding the same meter ([Str1] in this case). There will be cases when one IfCondition will have to hide, while the other will have to show the meter. Such approaches always (or almost always) create confusion. I'd either:
    • Decide with which channel to work (left or right) and would get only the appropriate IfCondition, removing the other. Basically doesn't really matter if you're choosing the left or the right channel, important is not tu hide / show the meter based on both.
    • If you want to keep both, create a Calc measure calculate the sum of the values returned by the above two measures and apply the IfCondition only to this Calc measure.
  • Besides this, remove the [!UpdateMeasure MeasureAudioRMS_X] and [!Update] bangs from the IfTrueAction and IfFalseAction options of the measure on which you keep them (no matter if that's the above created Calc measure, or [MeasureAudioRMS_L] and [MeasureAudioRMS_R]). Keep only the [!HideMeter Str1] / [!ShowMeter Str1] and the [!Redraw] bangs (do the same):

    Code: Select all

    ;Sound Left
    [MeasureAudioRMS_L]
    ...
    IfCondition=MeasureAudioRMS_L > 0.01
    IfTrueAction=[!HideMeter Str1][!Redraw]
    IfFalseAction=[!Delay 100][!ShowMeter Str1][!Redraw]
    
    ;Sound Right
    [MeasureAudioRMS_R]
    ...
    IfCondition=MeasureAudioRMS_R > 0.01
    IfTrueAction=[!HideMeter Str1][!Redraw]
    IfFalseAction=[!Delay 100][!ShowMeter Str1][!Redraw]
    
    OR

    Code: Select all

    [MeasureAudioRMS]
    Measure=Calc
    Formula=( MeasureAudioRMS_L + MeasureAudioRMS_R )
    IfCondition=(#CURRENTSECTION#>0.01)
    IfTrueAction=[!HideMeter Str1][!Redraw]
    IfFalseAction=[!Delay 100][!ShowMeter Str1][!Redraw]
    
One more, related to the second above point: You should never put together the [!Update] and the [!Redraw] bangs, because when you update the skin (by the [!Update] bang), you get a redraw of the skin as well. The redrawing being a more or less expensive operation in terms of required resources, doesn't worth to get a double redraw, one by the [!Update] and the other by the [!Redraw] bang.
User avatar
Rooky_89
Posts: 69
Joined: September 21st, 2024, 4:57 pm
Location: Germany, in the stone cave

Re: Measure Audio Level

Post by Rooky_89 »

balala wrote: September 30th, 2024, 7:23 pm I can't replicate the issue (don't know what sound to use for this)
If you listen to an Audio - Podcast where people are speaking and it comes to a short pause the Audio level goes down.

IfCondition=MeasureAudioRMS_L > 0.01
IfTrueAction=[!HideMeter Str1][!UpdateMeasure MeasureAudioRMS_L][!Redraw][!Update]
IfFalseAction=[!Delay 100][!ShowMeter Str1][!UpdateMeasure MeasureAudioRMS_R][!Redraw][!Update]


The IfFalse Section starts to work [while no sound is incoming]... But the talker begins again now to speak the audio level is going quickly high, so quickly that after 5 secs delay the String is showing up. Thats the result in the Gif Image.

Also you can try to play a Song press short Pause one till two seconds and immediately press play. It's Tricky..
--------------------------
Have you tried increasing the measured volume to 0.1? I try it tomorrw
Last edited by Yincognito on September 30th, 2024, 8:56 pm, edited 1 time in total.
Reason: Fixed post syntax
User avatar
balala
Rainmeter Sage
Posts: 16669
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Measure Audio Level

Post by balala »

Rooky_89 wrote: September 30th, 2024, 8:45 pm Also you can try to play a Song press short Pause one till two seconds and immediately press play. It's Tricky..
Alright, got now.
Try removing the IfConditions from the [MeasureAudioRMS_L] and [MeasureAudioRMS_R] measures, create a Calc measure and add the IfCondition to that measure, as said in my previous reply:

Code: Select all

;Sound Left
[MeasureAudioRMS_L]
Measure=Plugin
Plugin=AudioLevel
Parent=MeasureAudioRaw
Channel=L
Type=RMS
;IfCondition=MeasureAudioRMS_L > 0.01
;IfTrueAction=[!HideMeter Str1][!UpdateMeasure MeasureAudioRMS_L][!Redraw][!Update]
;IfFalseAction=[!Delay 100][!ShowMeter Str1][!UpdateMeasure MeasureAudioRMS_R][!Redraw][!Update]

;Sound Right
[MeasureAudioRMS_R]
Measure=Plugin
Plugin=AudioLevel
Parent=MeasureAudioRaw
Channel=R
Type=RMS
;IfCondition=MeasureAudioRMS_R > 0.01
;IfTrueAction=[!HideMeter Str1][!UpdateMeasure MeasureAudioRMS_R][!Redraw][!Update]
;IfFalseAction=[!Delay 100][!ShowMeter Str1][!UpdateMeasure MeasureAudioRMS_R][!Redraw][!Update]

[MeasureAudioRMS]
Measure=Calc
Formula=( MeasureAudioRMS_L + MeasureAudioRMS_R )
IfCondition=(#CURRENTSECTION#>0.01)
IfTrueAction=[!HideMeter Str1][!Redraw][!HideMeter Str1]
IfFalseAction=[!Delay 100][!ShowMeter Str1][!Redraw]
Note that I commented out the IfConditions in the initially existing [MeasureAudioRMS_L] and [MeasureAudioRMS_R] measures. Make sure not to forget this. Also see that I added two !HideMeter bangs to the IfTrueAction option of the newly created [MeasureAudioRMS] measure.
User avatar
Yincognito
Rainmeter Sage
Posts: 8485
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Measure Audio Level

Post by Yincognito »

Rooky_89 wrote: September 30th, 2024, 6:32 pmThe audio level is measured, and if it is greater than 0.01 [sound is played] then the conditions are executed. However, if the sound falls too quickly and rises again within seconds, then the skin or measurement value does not update quickly enough and the text no longer disappears.
This seems simpler to me than a bunch of channel measures and IfConditions (the [Visualizer] meter is rudimentar, just for demonstration purposes):

Code: Select all

[Rainmeter]
Update=50
AccurateText=1
DynamicWindowSize=1

---Measures---

[MeasureAudioRaw]
Measure=Plugin
Plugin=AudioLevel
RMSAttack=15
RMSDecay=250
RMSGain=1.5

---Meters---

[Visualizer]
Meter=Bar
W=100
H=20
SolidColor=128,128,128,255
BarColor=0,255,0,255
BarOrientation=Horizontal
MeasureName=MeasureAudioRaw

[MediaPlay]
Hidden=([MeasureAudioRaw:]>0.01?0:1)
Meter=String
X=50
y=10
W=100
H=20
StringAlign=CenterCenter
AntiAlias=1
Text=MediaPlay
DynamicVariables=1
Feel free to adjust or remove the RMS options if needed. Works for me in podcasts or audios having short no sound breaks, like this one at the 00:07 time:

Everything is done in the Hidden option from [MediaPlay], with the help of a conditional. Doesn't use delays though.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1835
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Measure Audio Level

Post by sl23 »

Super song! Now we know what you get up to on those cold lonely nights! ;-) 8-)
57686174 77696C6C 6265 77696C6C 6265
User avatar
Yincognito
Rainmeter Sage
Posts: 8485
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Measure Audio Level

Post by Yincognito »

Yeah, it makes me...
Image
... want to party! :lol:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Rooky_89
Posts: 69
Joined: September 21st, 2024, 4:57 pm
Location: Germany, in the stone cave

Re: Measure Audio Level

Post by Rooky_89 »

balala wrote: September 30th, 2024, 9:05 pm
...create a Calc measure and add the IfCondition to that measure...

Code: Select all

[MeasureAudioRMS]
Measure=Calc
Formula=( MeasureAudioRMS_L + MeasureAudioRMS_R )
IfCondition=(#CURRENTSECTION#>0.01)
IfTrueAction=[!HideMeter Str1][!Redraw][!HideMeter Str1]
IfFalseAction=[!Delay 100][!ShowMeter Str1][!Redraw]
Thanks for reply, Yes balala, you a right, it's truly the better solution, agreed with you :thumbup: :bow: :p :rosegift:
Last edited by Rooky_89 on October 1st, 2024, 4:07 pm, edited 1 time in total.
User avatar
Rooky_89
Posts: 69
Joined: September 21st, 2024, 4:57 pm
Location: Germany, in the stone cave

Re: Measure Audio Level

Post by Rooky_89 »

Yincognito wrote: September 30th, 2024, 9:06 pm

Feel free to adjust or remove the RMS options if needed. Works for me in podcasts or audios having short no sound breaks
Thank you Incognito, your code is useful too. :bow: Nice Music demonstration, sounds like in Time where Cellphone ringtones were cool. ohh dear long time before. You should try this :rolmfao: :rofl: :p :Whistle. Enjoy it :rosegift:




Image