Old 07-07-2015, 12:06 PM   #1
Human being with feelings
Breeder's Avatar
Join Date: Nov 2010
Location: Croatia
Posts: 2,284
Default Lua: Load JS BPM Calculator with action (toolbar or shortcut)


The idea is quite simple. I've created JS plugin BPM Calculator, but the problem is that we usually don't want to think of it as a separate plugin loaded on some track, but as an independent tool on its own.
So I've created a simple Lua script which will load BPM Calculator on the Master track and unload it as soon as the FX window is closed (or the script is terminated):

What you will need and a few details on usage:

My JS BPM Calculator: https://stash.reaper.fm/v/7838/BPM%20Calculator
Special Lua script: https://stash.reaper.fm/v/24512/Util...e%20cursor.lua

Simply follow installation procedure for JS BPM Calculator and then import supplied Lua script into REAPER. After that, put it on your toolbar (or assign it a shortcut) and calculate away
To use this Lua scripts in REAPER, you will also need the to install SWS extension

When you try to turn off the BPM calculator by re-running the script for the first time, you will get prompted if you want to terminate or load new instance of the script. Simply terminate it and remember your answer. Like this:

Note that script depends on the name of JS BPM Calculator plugin. If by any chance you plan on renaming the plugin, script will no longer work. You can quickly fix that by chancing this line in the script so it's the same as your renamed JS BPM Calculator:
local g_fxName      = "BPM Calculator"

Change the position where BPM calculator gets loaded

If you don't like the fact that BPM Calculator is moved to mouse cursor, simply comment out (by prefixing the line with --) or delete this line from the script:
reaper.Main_OnCommand(reaper.NamedCommandLookup("_BR_MOVE_WINDOW_TO_MOUSE_H_M_V_T"), 0)
On the other hand, if you want for BPM Calculator to get loaded at different position from mouse cursor, change that line to some other SWS/BR action that moves window to mouse cursor. Like this:

A lot of effort has been invested in this. If you seriously use it, please consider supporting the developer. Thanks!

I don't mind if someone puts these in ReaPack, but please include my donation link, forum nickname and link to this thread and thread for a specific script in the description if you do so.

REAPER ReWorked: An elegant and self-sufficient all-around REAPER configuration
Other stuff

Last edited by Breeder; 01-11-2020 at 07:25 PM.
Breeder is offline   Reply With Quote
Old 07-07-2015, 04:36 PM   #2
Human being with feelings
X-Raym's Avatar
Join Date: Apr 2013
Location: France
Posts: 6,330

Nic ! and thanks for the detailed infos about it
X-Raym is offline   Reply With Quote
Old 07-07-2015, 05:46 PM   #3
Human being with feelings
daxliniere's Avatar
Join Date: Nov 2008
Location: London, UK
Posts: 1,952

Dax Liniere
London's newest premium studio complex! (Facebook)
[i7-4790K, 12Gb RAM, Win8.1x64, NVidia GT710, UAD2-OCTO, FireFaceUFX, REAPER x64]
daxliniere is offline   Reply With Quote
Old 11-02-2015, 12:38 PM   #4
Human being with feelings
Join Date: Apr 2011
Posts: 1,595

Thank you Breeder!

Win7 x64, Reaper 5.04, SWS 2.8.1 : the toggle does not work here. Have a look:

Any ideas why?
amagalma is offline   Reply With Quote
Old 11-04-2015, 11:51 AM   #5
Human being with feelings
Join Date: Apr 2011
Posts: 1,595

I tried it on a fresh portable install of Reaper and it does not work there either. Is it some bug of v5.04?
amagalma is offline   Reply With Quote
Old 11-04-2015, 06:03 PM   #6
Human being with feelings
ericzang's Avatar
Join Date: Mar 2014
Location: Phoenix, AZ
Posts: 373

So cool Breeder, thanks again! It is so simple to customize this for any plugin, such as a frequency analyzer. In the script I simply replaced BPM Calc with another uniquely named plugin (as would work when adding an effect with the Console command "x").

PS Amagalma, seems to be working properly for me. Same specs as you.

Curiously the action with a shortcut via MIDI message can only open the plugin, but not toggle it closed. Keyboard shortcut works no problem.

Last edited by ericzang; 11-04-2015 at 06:57 PM.
ericzang is offline   Reply With Quote
Old 11-05-2015, 04:20 AM   #7
Human being with feelings
Join Date: Apr 2011
Posts: 1,595

I tried it in all ways: via a toolbar button, via "run" in the action list and by assigning a key to it.. no luck! :/
And all this in a clean portable install of R5..
amagalma is offline   Reply With Quote
Old 02-13-2020, 03:12 PM   #8
Human being with feelings
grandfougue's Avatar
Join Date: Sep 2016
Posts: 186

toggle does not work on portable install he open many instance

Last edited by grandfougue; 02-14-2020 at 03:27 PM.
grandfougue is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -7. The time now is 04:16 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.