It is currently November 14th, 2019, 7:40 am

First Time Making A Visualizer

Help with creating, editing & fixing problems with skins
quaddi
Posts: 1
Joined: April 26th, 2019, 3:01 pm

First Time Making A Visualizer

quaddi » April 26th, 2019, 3:04 pm

I want to make a 'visualizer,' but all I want is to detect bass in a song and vibrate and image. I have zero idea where to start, do you guys have any suggestions on how I could go about doing that?
User avatar
eclectic-tech
Rainmeter Sage
Posts: 3596
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: First Time Making A Visualizer

eclectic-tech » April 27th, 2019, 3:35 am

Detecting only low frequencies does not always provide satisfactory results. I have found that a combination of measuring low frequencies and then detecting levels above the average sound provides better results.

In the code below, I use RMS and Peak (you can use either) values for frequencies in the 60-250hz range, then samples those values 25 times.

For a first example, I use the average peak beat; if the current level is above average, I set a variable to 1, and use that as the multiplier of 255 in the meter to show/hide the image.

For the second example, I use the actual RMS measurement (0~1), doubled, to control the Alpha value of the image.

These are the 2 most common ways to animate an image in response to audio levels. I would suggest tweaking the Peak/RMS attach/decay values to obtain the best response to your audio. The values I initially set give pretty good results, but "beauty is in the eye of the beholder".

audio2.gif

Code: Select all

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

; ========= Metadata ==========
[Metadata]
Name=
Author=
Information=
License=Creative Commons Share-Alike NC 4
Version=

; ========= Variables ==========
[Variables]
; Number of audio level samples used to obtain an average which is then used to detect beats (higher levels) ~ every 1/2 second
Samples=25
; Control variables: 1=visible / 0=invisible
BeatPeak=1
BeatRMS=1

; ========= Measures ==========
[MeasureAudioLevel]
Measure=Plugin
Plugin=AudioLevel
; Modify attach and decay to adjust RMS sensitivity 
RMSAttack=25
RMSDecay=50
RMSGain=1
; Modify attach and decay to adjust Peak sensitivity 
PeakAttack=25
PeakDecay=50
PeakGain=1
; Set low/high frequencies these are bass values
FreqMin=60
FreqMax=250
; Some rhythms are based on upper frequencies, so you can increase the Max and see if it changes the responsiveness... 16000?
Sensitivity=35
; Documentation: https://docs.rainmeter.net/manual-beta/plugins/audiolevel/

[MeasurePeak]
Measure=Plugin
Plugin=AudioLevel
Parent=MeasureAudioLevel
Channel=Sum
Type=Peak

[mBeatPeak]
Measure=Calc
Formula=MeasurePeak
AverageSize=#Samples#
IfCondition=MeasurePeak>#CurrentSection#
IfTrueAction=[!SetVariable BeatPeak 1]
IfFalseAction=[!SetVariable BeatPeak 0]
DynamicVariables=1

[MeasureRMS]
Measure=Plugin
Plugin=AudioLevel
Parent=MeasureAudioLevel
Channel=Sum
Type=RMS

[mBeatRMS]
Measure=Calc
Formula=MeasureRMS
AverageSize=#Samples#
IfCondition=MeasureRMS>#CurrentSection#
IfTrueAction=[!SetVariable BeatRMS 1]
IfFalseAction=[!SetVariable BeatRMS 0]
DynamicVariables=1


; ========= Meters ==========

; This meter shows/hides image based on peak beat detects
[meterForegroundPeak]
Meter=IMAGE
ImageName=crystal_ball.png
ImageTint=255,0,0
X=0
Y=R
ImageAlpha=(#BeatPeak#*255)
DynamicVariables=1

; This meter uses the actual RMS level to drive the image Alpha (visibility) Range:0~255
[meterForegroundRMS]
Meter=IMAGE
ImageName=crystal_ball.png
ImageTint=0,255,0
X=0
Y=R
ImageAlpha=(Clamp([MeasureRMS]*2*255,0,255))
DynamicVariables=1
Includes: the image (crystal_ball.png) I used to test. Copy the code and image into a new Skins folder and refresh to test.
You do not have the required permissions to view the files attached to this post.