TIM TECHLOR // REAPER LUA TOOL — WEB EDITION
BPM2MS2HZ
Note values from the project tempo as milliseconds and Hz — for delay times, LFO rates, release and sidechain settings. Dotted values and triplets included. The original reads the tempo from REAPER; here you simply type it in.
+-------------------------------------------+ | TIM TECHLOR / BPM2MS2HZ CALCULATOR | | Tempo: 128.000 BPM 1 Beat = 468.75 ms | +-------------------------------------------+ NOTE MS HZ ------------------------------- 1/1 1875.0 0.533 …
Delay Times
Read the MS column and type the value into your delay plugin for
tempo-synced echoes without host sync. At 128 BPM a 1/4 is
468.8 ms; dotted 1/8. (351.6 ms) is the classic
ping-pong spacing.
LFO Rates
The HZ column drives LFO speeds: 1/4 = 2.133 Hz,
1/16 = 8.533 Hz at 128 BPM. Auto-pan, tremolo and filter
sweeps lock straight to the grid.
Release & Sidechain
Whole bars come as seconds: 1 bar = 1.875 s at 128 BPM.
A compressor release of one bar keeps the pump breathing with the track instead of
choking it.
Variants
1/4— plain, one beat1/4.— dotted, ×1.51/4T— triplet, ×2/3
Bar lengths assume 4/4.
Popup Mode
Pin the calculator next to your DAW: a compact window with input and live table — the console, without the rest of the page.
The REAPER Original
Same table, straight from the project tempo: Master_GetTempo() →
REAPER console. Actions → Show action list → Load ReaScript…
--[[==================================================================
TIM TECHLOR / BPM2MS2HZ CALCULATOR (console edition)
====================================================================
Reads the project tempo and prints a table of all note values as
durations in milliseconds and frequencies in Hz - for delay times,
LFO rates, release and sidechain settings.
ms = 60000 / BPM * beats (1 beat = 1 quarter note)
Hz = 1000 / ms
Variants: 1/4 plain
1/4. dotted (x 1.5)
1/4T triplet (x 2/3)
Bar lengths assume 4/4.
====================================================================]]
--------------------------------------------------------------------
-- Configuration
--------------------------------------------------------------------
local DIVISIONS = { 1, 2, 4, 8, 16, 32 } -- note values 1/1 to 1/32
local BAR_COUNTS = { 1, 2, 4, 8, 16, 32 } -- bar lengths 1 to 32 bars
local VARIANTS = {
{ suffix = "", factor = 1 }, -- plain
{ suffix = ".", factor = 1.5 }, -- dotted
{ suffix = "T", factor = 2 / 3 }, -- triplet
}
--------------------------------------------------------------------
-- Helpers
--------------------------------------------------------------------
local function out(text)
reaper.ShowConsoleMsg(text .. "\n")
end
-- Frame around the header lines (width adapts to the longest line)
local function print_box(lines)
local width = 0
for _, line in ipairs(lines) do
width = math.max(width, #line)
end
local border = "+" .. string.rep("-", width + 4) .. "+"
out(border)
for _, line in ipairs(lines) do
out(string.format("| %-" .. width .. "s |", line))
end
out(border)
end
local function print_table_header(col1, col2, col3)
out("")
out(string.format(" %-8s %10s %10s", col1, col2, col3))
out(" " .. string.rep("-", 31))
end
--------------------------------------------------------------------
-- Tables
--------------------------------------------------------------------
-- All note values: duration in ms, frequency in Hz
local function print_notes(beat_ms)
print_table_header("NOTE", "MS", "HZ")
for _, division in ipairs(DIVISIONS) do
local beats = 4 / division
for _, variant in ipairs(VARIANTS) do
local ms = beat_ms * beats * variant.factor
local label = "1/" .. division .. variant.suffix
out(string.format(" %-8s %10.1f %10.3f", label, ms, 1000 / ms))
end
end
end
-- Whole bars (4/4): duration in seconds, frequency in Hz
local function print_bars(beat_sec)
print_table_header("BARS", "SEC", "HZ")
for _, count in ipairs(BAR_COUNTS) do
local sec = beat_sec * 4 * count
local label = (count == 1) and "1 bar" or (count .. " bars")
out(string.format(" %-8s %10.3f %10.3f", label, sec, 1 / sec))
end
end
--------------------------------------------------------------------
-- Main
--------------------------------------------------------------------
local function main()
reaper.ClearConsole()
local bpm = reaper.Master_GetTempo()
if not bpm or bpm <= 0 then
reaper.ShowConsoleMsg("No valid project tempo found.")
return
end
local beat_ms = 60000 / bpm
print_box({
"TIM TECHLOR / BPM2MS2HZ CALCULATOR",
string.format("Tempo: %.3f BPM 1 Beat = %.2f ms", bpm, beat_ms),
})
print_notes(beat_ms)
print_bars(60 / bpm)
out("")
end
main()