It is currently April 26th, 2024, 11:52 pm

AudioLevel

Get help with creating, editing & fixing problems with skins
Electro007
Posts: 5
Joined: October 27th, 2018, 12:37 pm

AudioLevel

Post by Electro007 »

I'm french, sorry for the english.

So I'm starting modifying some skin and I would like to unload and load a skin ( a visualizer ) depending if there is sound playing.

I started to create a skin, with the whole purpose of loading or unloading, but I can't even show the value of the RMS (AudioLevel plugin). I want to show the value only in a plain text skin, not advanced thing.
After that I would simply use a If condition (if lower than a certain value) to load the said visualizer, thats not the problem.

I'm still learning how rainmeter skin are built (measure, variable, etc...) and that here I probably failed

Code: Select all

[Rainmeter]
Update=15

[MeasureAudio]
Measure=Plugin
Plugin=AudioLevel
Channel=Sum
Port=Output
Type=RMS

[MeterString]
Meter=String
Text=[MeasureAudio]
Thx for the help.
Last edited by Electro007 on October 27th, 2018, 2:23 pm, edited 2 times in total.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5407
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: AudioLevel

Post by eclectic-tech »

There are some caveats in trying to control visualizer based on sound, the main one is that the plugin responds to all system sounds so alternate actions may be needed.

Here are some techniques I use to control visualizers: sound level monitoring and process monitoring.
This skin would run in the background and take actions based on sound and player process.

Code: Select all

[Rainmeter]
Update=1000

[Variables]
PlayerProcessExe=wmplayer.exe
DisableTestActive=0

; Loads/Unload config based on presence of sound
; Drawback is it will respond to any system sound
[MeasureAudio]
Measure=Plugin
Plugin=AudioLevel
Channel=Sum
Port=Output
Type=RMS
IfCondition=(MeasureAudio<0.0000001)
IfTrueAction=[!DeactivateConfig "youraudioskinconfigname"]
IfFalseAction=[!ActivateConfig "youraudioskinconfigname" "youraudioskin.ini"]
IfConditionMode=0

; Hides the meter when sound is not present
; Drawback is it will respond to any system sound
[MeterString]
Meter=String
MeasureName=MeasureAudio
Text=%1
Hidden=((MeasureAudio<0.0000001)?)

; Loads/Unloads based on if your defined audio player process is active (WMP default)
; You can then take any actions you want: show/hide meters, enable/disable measures, etc.
[MeasurePlayerActive]
Measure=Plugin
Plugin=Process
ProcessName=#PlayerProcessExe#
IfCondition=(#CurrentSection#=-1)
IfTrueAction=[!DeactivateConfig "youraudioskinconfigname"]
IfFalseAction=[!ActivateConfig "youraudioskinconfigname" "youraudioskin.ini"]
IfConditionMode=1
Disabled=#DisableTestActive#
AudioLevel plugin
Process plugin
IfCondition
Conditional statements

Feel free to ask about any of these... :welcome:
rxtd
Posts: 100
Joined: April 30th, 2017, 11:51 am

Re: AudioLevel

Post by rxtd »

Electro007 wrote: October 27th, 2018, 12:56 pm
Hi.
Your code actually captures volume as you want, it just doesn't show it.
Your code has 2 main issues:
1) Without DynamicVariables=1 your string meter won't update its value so that it will always show 0. But it's better to use MeasureName option when you want to show a measure value in string meter.
2) Formula [AudioMeter] by default shows only integer values, and AudioLevel always have value between 0 and 1. Use either NumOfDecimals=10 with MeasureName=MeasureAudio, or [MeasureAudio:10] to get string with higher presicion.

You could have avoided both issues if you used "About/Skins" page in Rainmeter instead of using String meter to show value. Try it, I think it's much more convenient! :)

Also, AudioLevel is a Parent-Child plugin. It seems like Parent measure behaves like Child measure, so your code works, but I wouldn't rely on this.
rxtd
Posts: 100
Joined: April 30th, 2017, 11:51 am

Re: AudioLevel

Post by rxtd »

eclectic-tech wrote: October 27th, 2018, 1:35 pm There are some caveats in trying to control visualizer based on sound, the main one is that the plugin responds to all system sounds so alternate actions may be needed.

Here are some techniques I use to control visualizers: sound level monitoring and process monitoring.
This skin would run in the background and take actions based on sound and player process.
I think it worth noting that there is also AppVolume plugin that can capture loudness from some certain process. If you have your player running all the time, regardless of whether it plays music, it can be quite helpful.
Electro007
Posts: 5
Joined: October 27th, 2018, 12:37 pm

Re: AudioLevel

Post by Electro007 »

Thank you for your quick reply.
eclectic-tech wrote: October 27th, 2018, 1:35 pm There are some caveats in trying to control visualizer based on sound, the main one is that the plugin responds to all system sounds so alternate actions may be needed.
I usualy play with youtube & Google Play Music, but adding a support for a specific player is nice as a feature, thanks for adding it.

I'll try to understand the code you wrote instead of just using it blindly.

Thank you a lot !
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5407
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: AudioLevel

Post by eclectic-tech »

Electro007 wrote: October 27th, 2018, 1:57 pm Thank you for your quick reply.


I usualy play with youtube & Google Play Music, but adding a support for a specific player is nice as a feature, thanks for adding it.

I'll try to understand the code you wrote instead of just using it blindly.

Thank you a lot !
The code as it is will not do anything until you edit the configname and sin.ini items in the bangs.
Electro007
Posts: 5
Joined: October 27th, 2018, 12:37 pm

Re: AudioLevel

Post by Electro007 »

rxtd wrote: October 27th, 2018, 1:47 pm I think it worth noting that there is also AppVolume plugin that can capture loudness from some certain process. If you have your player running all the time, regardless of whether it plays music, it can be quite helpful.
I don't have one player, that's why I prefer to be able to load when there's a sound or not. I understand that it will catch anything, but for now it's not a problem.
Electro007
Posts: 5
Joined: October 27th, 2018, 12:37 pm

Re: AudioLevel

Post by Electro007 »

eclectic-tech wrote: October 27th, 2018, 1:59 pm The code as it is will not do anything until you edit the configname and sin.ini items in the bangs.
Why do it need a config, a skin only would be fine no ? :???:

Edit : Im stupid, nevermind
Last edited by Electro007 on October 27th, 2018, 2:22 pm, edited 1 time in total.
rxtd
Posts: 100
Joined: April 30th, 2017, 11:51 am

Re: AudioLevel

Post by rxtd »

Electro007 wrote: October 27th, 2018, 2:03 pm I don't have one player, that's why I prefer to be able to load when there's a sound or not. I understand that it will catch anything, but for now it's not a problem.
Well, I myself don't use it for filtering. I just think that eclectic-tech's answer is incomplete without it.
By the way, with AppVolume you can monitor several apps' volume, if you wish so.
Electro007
Posts: 5
Joined: October 27th, 2018, 12:37 pm

Re: AudioLevel

Post by Electro007 »

Solved ! Thank you all.