It is currently December 4th, 2020, 5:55 pm

## Visual BPM Counter

Help with creating, editing & fixing problems with skins
dooey123
Posts: 8
Joined: May 5th, 2019, 1:04 pm

### Visual BPM Counter

I've tried searching but I cannot find a skin that works as a visual BPM counter. There are apps in the microsoft store that do this but I'd prefer something running in rainmeter.

In my mind it should be very simple to make: a square that jumps left to right 4 times then back to the beginning (4/4 time signature) but at a speed that I can set. I've tried manipulating other skins that show the seconds of a clock where a dot moves left to right but I've not been able to adjust the speed of the time measure.

Does anyone have any ideas how I can go about making this or something that already exists please?
balala
Rainmeter Sage
Posts: 11857
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

### Re: Visual BPM Counter

dooey123 wrote: May 5th, 2019, 1:16 pm In my mind it should be very simple to make: a square that jumps left to right 4 times then back to the beginning (4/4 time signature) but at a speed that I can set. I've tried manipulating other skins that show the seconds of a clock where a dot moves left to right but I've not been able to adjust the speed of the time measure.

Does anyone have any ideas how I can go about making this or something that already exists please?
To achieve this, you need a Time measure which returns the seconds, then have to use its value to control the position of a meter (for example an Image meter).
So, add the following Time measure:

Code: Select all

``````[MeasureSec]
Measure=Time
Format=%S``````
Then add the following Image meter. See its X option, which uses the value of the [MeasureSec] measure, to control the position.

Code: Select all

``````[MeterBPM]
Meter=Image
SolidColor=220,220,220
X=(25*([MeasureSec]%4))
Y=3R
W=30
H=30
DynamicVariables=1``````
A more or less complete code is the following one:

Code: Select all

``````[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeasureTime]
Measure=Time
Format=%H:%M

[MeasureSec]
Measure=Time
Format=%S

[MeterSecond]
Meter=String
MeasureName=MeasureTime
MeasureName2=MeasureSec
X=0
Y=0
FontSize=12
FontColor=220,220,220
SolidColor=47,47,47,255
AntiAlias=1
Text=%1:%2
InlineSetting=Size | 8
InlinePattern=^.*:(\d{2})\$

[MeterBPM]
Meter=Image
SolidColor=220,220,220
X=(25*([MeasureSec]%4))
Y=3R
W=30
H=30
DynamicVariables=1``````
Please check this code and let me know if it does what you want.
dooey123 wrote: May 5th, 2019, 1:16 pm I've tried searching but I cannot find a skin that works as a visual BPM counter. There are apps in the microsoft store that do this but I'd prefer something running in rainmeter.
Could you please post an example of a such program?
eclectic-tech
Rainmeter Sage
Posts: 4194
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

### Re: Visual BPM Counter

Here is the basis for a simple digital metronome (20~120 bpm). Feel free to modify it to your needs.

Code: Select all

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

Name=Metranome
Author=Eclectic Tech
Information=Adjustable digital metranome that display 20 to 120 beats per minute with a 4-step bar display.
Version=1.2019.05.05

[Variables]
BPM=60
Beat=0

[MeasureTime]
Measure=Time
AverageSize=20

[MeasureTimeCalc]
Measure=Calc
Formula=(MeasureTime%60)/60

[MeasureBPM]
Measure=Calc
Formula=Trunc(MeasureTimeCalc*#BPM#)
OnChangeAction=[!SetVariable Beat ((#Beat#+1)%#BPM#)][PlayStop][Play "C:\Windows\Media\Windows Navigation Start.wav"]
DynamicVariables=1
MinValue=0
MaxValue=(#BPM#-1)

[Background]
Meter=Shape
Shape=Rectangle 0,0,200,60,5 | StrokeWidth 2 | Stroke Color 220,220,220,255 | Fill Color 47,47,47,255

[BPM]
Meter=String
X=25
Y=15
FontSize=12
FontColor=220,220,220
AntiAlias=1
Text=Beats per Minute: #BPM#
DynamicVariables=1
LeftMouseUpAction=!CommandMeasure "MeasureInputText" "ExecuteBatch 1-2"
TooltipText="Set BPM (20~120)"

[Bar]
Meter=Image
X=40
Y=8R
W=120
H=5
SolidColor=22,22,22,255
LeftMouseUpAction=[!TogglePauseMeasure MeasureBPM]
TooltipText="Toggle Pause"

[Beats]
Meter=Image
X=(40+(30*(#Beat#%4)))
Y=r
W=30
H=5
SolidColor=220,220,220
AntiAlias=1
NumOfDecimals=0
Text=#Beat#
DynamicVariables=1

[MeasureInputText]
Measure=Plugin
Plugin=InputText
InputLimit=0
InputNumber=0
X=155
Y=15
W=25
H=18
Command1=!WriteKeyValue Variables BPM (Clamp("\$UserInput\$",20,120))
Command2=!Refresh #CURRENTCONFIG#
DefaultValue=#BPM#
FocusDismiss=1
``````
Using JSMorley's time measures from Sweep Second Clock
The sound WAV file used is "C:\Windows\Media\Windows Navigation Start.wav" in Windows 10 (Change if a step is silent)

Click text to enter a new BPM value
Click the display bar to toggle pause the metronome
Note: Values are clamped in the skin to 20~120. Higher rates are not reliable.
Other activity in Windows/Rainmeter that monopolize the CPU can cause the timing to stutter

metronome.png
You do not have the required permissions to view the files attached to this post.
dooey123
Posts: 8
Joined: May 5th, 2019, 1:04 pm

### Re: Visual BPM Counter

That is fantastic, Thanks very much!
eclectic-tech
Rainmeter Sage
Posts: 4194
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

### Re: Visual BPM Counter

Happy to help. Have fun!