It is currently April 24th, 2024, 2:13 am

Win7Audio audio range

Get help with creating, editing & fixing problems with skins
ItsJustRyan
Posts: 81
Joined: October 25th, 2019, 1:20 am

Re: Win7Audio audio range

Post by ItsJustRyan »

Hi!

A few questions.
1- How do i find that max value?
2- Right now its set to only 87Hz. How do i have it so that it finds the frequency with the highest intensity (volume) within a range.
3- Can you also briefly explain whats happening in this code? I've been looking at it and still am not super sure of whats happening.

Thanks!
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Win7Audio audio range

Post by mak_kawa »

Hi ItsJustRyan
How do i find that max value?
Sorry, I have missed it. Add MaxValue=0 line in [Variables] section. This variable is replaced when the [measureRandom] value is larger than currrent value of MaxValue. So, maximum value of [measureRandom] is stored in this variable.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Win7Audio audio range

Post by eclectic-tech »

ItsJustRyan wrote: December 8th, 2019, 10:14 am Hi!

A few questions.
1- How do i find that max value?
2- Right now its set to only 87Hz. How do i have it so that it finds the frequency with the highest intensity (volume) within a range.
3- Can you also briefly explain whats happening in this code? I've been looking at it and still am not super sure of whats happening.

Thanks!
1- Mak_kawa answered how to find the max value of a changing single value. You are asking to monitor a sample of the frequencies between FFTMin and FFTMax, which is going to be more complicated depending on how many samples you want to create in that range.

2 - You created only 1 band in the parent measure [MeasureAudio] which means you will only monitor one frequency. If you change FFTMIN/FFTMax values, the single frequency you monitor will change. To test more frequencies within the range FFTMin to FFTMax, you would need to create more bands, and compare each value to the next to find the max value.
Note that returning the frequency type is CPU intensive and should be removed once you know you have the FFTMin, FFTMax, and number of bands monitoring your desired range.

3 - I created a parent audio level measure that specifies to use the output audio and create 1 band that monitors 1 frequency (because there is only 1 band defined) between 30 hz and 250 hz. A child measure [MeasureFreq] pulls the frequency of the monitored band. The next child measure [MeasureRandom] returns the level (0.0 to 1.0) of that frequency and sets the variable #OldValue# to that reading. The code can probably be optimized as balala suggests :Whistle, bur I went with as few mods to your code as possible to not "muddy the waters".

What are you hoping to determine besides which of several low frequencies is the max? It can be done, but it would be good to know where you are headed with this in order to give the best answer. :???:
ItsJustRyan
Posts: 81
Joined: October 25th, 2019, 1:20 am

Re: Win7Audio audio range

Post by ItsJustRyan »

1- Mak_kawa answered how to find the max value of a changing single value. You are asking to monitor a sample of the frequencies between FFTMin and FFTMax, which is going to be more complicated depending on how many samples you want to create in that range.
[Indent]If i understand sample corretly, i only need one, as i want to basically have it see what the change in bass (overall) and then have the skin do something if it surpasses a certain value. Like a kind of rhythm thing.[/Indent]
ItsJustRyan
Posts: 81
Joined: October 25th, 2019, 1:20 am

Re: Win7Audio audio range

Post by ItsJustRyan »

Also, can i multiply directly the parent measure and it'l work for its "child" measure?
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Win7Audio audio range

Post by mak_kawa »

Hi ItsJustRyan

Parent and child measures of AudioLevel plugin have specific structure. See the Rainmeter document. Example code already provided by eclectic-tech gets intensity of the tonal range of 30-250 Hz ("center" value is 87 Hz).
And by my suggestion (= add 2 lines of IfCondition code to [measureRandom]), you can get maximum value of that tonal range.

I am not sure what you want any further... Please tell us what you can't achieve with that codes?
ItsJustRyan
Posts: 81
Joined: October 25th, 2019, 1:20 am

Re: Win7Audio audio range

Post by ItsJustRyan »

Oh that question was for something else. I have another skin thats a visualiser, but when i ecrease the volume on the music app, the visualiser bars are 'capped' i guess, so i just wanted it to not have that.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Win7Audio audio range

Post by mak_kawa »

Probably the "cap" you said is displayed using Type=Peak option in child measure of parent AudioLevel Plugin measure. Such measure do you find in that visualizer skin code?
ItsJustRyan
Posts: 81
Joined: October 25th, 2019, 1:20 am

Re: Win7Audio audio range

Post by ItsJustRyan »

Oh what i meant by peaked is that the volume of the app has decreased, so say from 100 to 50, so the visualiser bars are half of what it could have been.

Also, I wasnt able to figure out how to make the rhythm bar thing work
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Win7Audio audio range

Post by eclectic-tech »

ItsJustRyan wrote: December 9th, 2019, 12:58 pm Oh what i meant by peaked is that the volume of the app has decreased, so say from 100 to 50, so the visualiser bars are half of what it could have been.
You can adjust the "Sensitivity" value (25 is default) in the parent measure to control how sensitive the bars are to the sound level; generally, you can find a level that work with the volume setting of the player. Since you are monitoring the Output, the volume setting of the media player will affect the bar levels.
ItsJustRyan wrote: December 9th, 2019, 12:58 pmAlso, I wasn't able to figure out how to make the rhythm bar thing work
I have found that measuring the beat is a bit more involved than just monitoring the lower frequencies. You need to establish a baseline audio level over a time period and then compare the current low frequency level to see if it exceeds that average sound level; those are going to be the louder "beats". I have used this method on the entire frequency range to determine "beats" even if they are based on cymbals :sly:
You may need to adjust the 'AverageSize' or the 'AudioSensitivity' to obtain the best response if the volume of the media is louder or softer.

You can see it in action in my LaserLight Visualizer ;-)

Here is some code that will monitor just the low frequencies, and the RMS levels of your captured audio stream. It will then take and average of the RMS output over a number of updates (I use between 16 & 48 as the AverageSize) in [MeasureBeat] to obtain the best beat detection based on the music style. It is not perfect, but it is pretty accurate at detecting rhythms.

Hopefully, this will get you close to what you are looking for... :welcome:

Code: Select all

[Rainmeter]
Update=16
AccurateText=1
Group=#RootConfig#

[Variables]
Dir=1
AudioSensitivity=50

[mAudioLevel]
Measure=Plugin
Plugin=AudioLevel
Port=Output
FreqMin=20
FreqMax=200
Sensitivity=#AudioSensitivity#
RMSAttack=30
RMSDecay=300
RMSGain=1
; Peak disc attack/decay (These settings disable it)
PeakAttack=0
PeakDecay=0
PeakGain=1

[mAudioOut_RMS_Sum]
Measure=Plugin
Plugin=AudioLevel
Parent=mAudioLevel
Channel=Sum
Type=RMS

; Takes an average of the audio over 32 updates. If the value is higher than the average, that indicates a "beat"
; I use this to reverse the value of a variable #Dir# ('1' or '-1') used to flip the soundbar shape meter below
[mBeat]
Measure=Calc
Formula=mAudioOut_RMS_Sum
AverageSize=32
IfCondition=mAudioOut_RMS_Sum>#CurrentSection#
IfTrueAction=[!SetVariable Dir (-1*#Dir#)]
DynamicVariables=1

; Added a back for reference
[SoundbarBack]
Meter=shape
Shape=rectangle 0,0,100,5 | FillColor 64,64,64 | Strokewidth 0
Dynamicvariables=1

; Bar flips left/right based on value of measured "beat"
[Soundbar]
Meter=shape
X=(25+(#Dir#*25))
Shape=rectangle 0,0,50,5 | FillColor 255,255,255 | Strokewidth 0
Dynamicvariables=1

Click image to animate...
beat2.gif
You do not have the required permissions to view the files attached to this post.