Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 804

Sound, Music and Visualizers • RMS Bars w/Automatic Gain Level Setting

$
0
0
Member sl23 has been discussing how he would like PEAK levels to be displayed using a PEAK HOLD for a few seconds to indicate the media level is above 0db and is being clipped. Several media players have that type of PEAK display.

Several attempts have been made to display PEAK values this way, but all have issues. A feature for PEAK display hold would most likely involve modifying the plugin. (see this thread).

My input regarding this...
Here is a skin that will indicate clipping for a set time and automatically control the GAIN value to optimize the visualizer display.

The AudioLevel plugin uses a GAIN value to set levels for RMS and PEAK display values. Those display levels can vary greatly depending on the media player volume setting and the actual media volume.

NOTE: GAIN only controls RMS/PEAK levels, while SENSITIVITY controls FFT/Band levels.

For this reason, being able to set the GAIN value to maximize your display is important; to little GAIN and the visualization is small, but too much GAIN and the visualization will display a constant maximum.

The skin automatically checks the maximum RMS/PEAK values and adjust the GAIN value to prevent clipping and optimize the visualizer display. It will take a several seconds to find the optimum GAIN value that prevents clipping. When the media is being clipped a red square will display for 1 second as an indicator; the indicator duration can be adjusted.

The RMS and PEAK shape displays are constantly updated while the clip indicator is timed.

Optionally you can scroll on the skin to quickly, manually set the GAIN value.

The skin will increase the GAIN when the peak levels are below 0.25 (very quiet media sound) and reset to 3 when no sound is present for several seconds.

The range of the GAIN control is 0 to a maximum of 3.

Preview showing automatic adjustment of the GAIN to optimize the visualizer display.
{35 second GIF of 'Close to the Edit' by Art of Noise}
As media levels increase the GAIN is reduced from 3 to 1.4 to continually optimize the display.
holdpeak.gif
Skin Code:

Code:

[Rainmeter]Update=#SkinUpdate#BackgroundMode=2SolidColor=255,255,255,20AccurateText=1MiddleMouseUpAction=[!Refresh][Metadata]Author=Eclectic-Tech (based on sl23 request)Description=RMS VU Metre that displays clip indicator (clip indicator hold time is selectable in seconds). Designed to maximize visualizer display based on the media player volume level setting and the plugin's audio clipping. || Skin will automatically reduce the gain to eliminate clipping. || Scroll mouse over the skin to manually adjust gain level until clipping is eliminated.Version=1.2024.07.09[Variables]AquaDark=0,255,255,200Green=128,255,0Orange=255,170,0OrangeDark=255,128,0Red=255,100,100White20=255,255,255,20ActiveGainLevel=3; Needed to calculate time in seconds based on Update rate for the skin.SkinUpdate=25; Hold time is in SecondsHoldTime=1; ========================================; Measures; ========================================[mAudio]Measure=PluginPlugin=AudioLevelPort=OutputRMSAttack=25RMSDecay=300RMSGain=#ActiveGainLevel#PeakAttack=50PeakDecay=10000PeakGain=#ActiveGainLevel#DynamicVariables=1[mLeft]Measure=PluginPlugin=AudioLevelParent=mAudioType=RMSChannel=L[mPeakLeft]Measure=PluginPlugin=AudioLevelParent=mAudioType=PeakChannel=L[mMaxL]Measure=CalcFormula=Round(Max([&mLeft],[&mPeakLeft]),3)DynamicVariables=1[mAutoGainL]Measure=CalcFormula=[&mMaxL]IfCondition=([&mMaxR] >= 1.0)IfTrueAction=[!SetVariable ActiveGainLevel (Clamp(#ActiveGainLevel#-0.1,0,3))][!EnableMeasure mHoldTimeL][!UpdateMeasure mHoldTimeL]IfCondition2=([&mMaxR] < 0.25)IfTrueAction2=[!SetVariable ActiveGainLevel (Clamp(#ActiveGainLevel#+0.1,0,3))]IfConditionMode=1DynamicVariables=1[mHoldTimeL]Measure=CalcFormula=mHoldTimeL + 1IfCondition=(mHoldTimeL < (#HoldTime#*(1000/#SkinUpdate#)))IfTrueAction=[!PauseMeasure mAutoGainL][!ShowMeter ClippedL][!Redraw]IfFalseAction=[!UnpauseMeasure mAutoGainL][!HideMeter ClippedL][!Redraw][!DisableMeasure mHoldTimeL][!UpdateMeasure mHoldTimeL]DynamicVariables=1Disabled=1[mRight]Measure=PluginPlugin=AudioLevelParent=mAudioType=RMSChannel=R[mPeakRight]Measure=PluginPlugin=AudioLevelParent=mAudioType=PeakChannel=R[mMaxR]Measure=CalcFormula=Round(Max([&mRight],[&mPeakRight]),3)DynamicVariables=1[mAutoGainR]Measure=CalcFormula=[&mMaxR]IfCondition=([&mMaxR] >= 1.0)IfTrueAction=[!SetVariable ActiveGainLevel (Clamp(#ActiveGainLevel#-0.1,0,3))][!EnableMeasure mHoldTimeR][!UpdateMeasure mHoldTimeR]IfCondition2=([&mMaxR] < 0.25)IfTrueAction2=[!SetVariable ActiveGainLevel (Clamp(#ActiveGainLevel#+0.1,0,3))]IfConditionMode=1DynamicVariables=1[mHoldTimeR]Measure=CalcFormula=mHoldTimeR + 1IfCondition=(mHoldTimeR < (#HoldTime#*(1000/#SkinUpdate#)))IfTrueAction=[!PauseMeasure mAutoGainR][!ShowMeter ClippedR][!Redraw]IfFalseAction=[!UnpauseMeasure mAutoGainR][!HideMeter ClippedR][!Redraw][!DisableMeasure mHoldTimeR][!UpdateMeasure mHoldTimeR]DynamicVariables=1Disabled=1; ========================================; Meters; ========================================[MouseActionBG]Meter=ImageW=#CurrentConfigWidth#H=#CurrentConfigHeight#SolidColor=0,0,0,1MouseScrollUpAction=[!SetVariable ActiveGainLevel (Clamp(#ActiveGainLevel#+0.05,0,3))][!Update] MouseScrollDownAction=[!SetVariable ActiveGainLevel (Clamp(#ActiveGainLevel#-0.05,0,3))][!Update]DynamicVariables=1TooltipType=0TooltipWidth=200Tooltiptext=Active Gain Level: [#ActiveGainLevel]#CRLF#Left Level: [&mMaxL]#CRLF#Right Level: [&mMaxR]; -------------------------------------[OutBarL]Group=BarsMeter=BarMeasureName=mLeftBarOrientation=HorizontalBarColor=#Green#,70SolidColor=#White20#W=200H=5Y=0[PeakLeft]Meter=ShapeShape=Rectangle 0,0,2,5 | StrokeWidth 0X=([OutBarL:XW]*[mPeakLeft])DynamicVariables=1[ClippedL]Meter=ShapeShape=Rectangle 200,0,5,5 | StrokeWidth 0 | Fill Color #Red#Hidden=1 ; -------------------------------------[OutBarR]Group=BarsMeter=BarMeasureName=mRightBarOrientation=HorizontalBarColor=#Green#,70SolidColor=#White20#W=200H=5Y=7[PeakRight]Meter=ShapeShape=Rectangle 0,0,2,5 | StrokeWidth 0X=([OutBarR:XW]*[mPeakRight])Y=rDynamicVariables=1[ClippedR]Meter=ShapeY=rShape=Rectangle 200,0,5,5 | StrokeWidth 0 | Fill Color #Red#Hidden=1 

Statistics: Posted by eclectic-tech — Today, 3:31 am



Viewing all articles
Browse latest Browse all 804

Trending Articles