Module:Interval edo approximation: Difference between revisions
trying to automate table generation (im learning how to wiki dont yell at me) |
m bug fixing |
||
| Line 1: | Line 1: | ||
-- EDO Approximations Module | -- EDO Approximations Module | ||
-- Calculates EDO approximations for just intervals | -- Calculates EDO approximations for just intervals | ||
-- Usage: {{#invoke: | -- Usage: {{#invoke:EDO_Approximation|main|interval=3/2|tolerance=9|min_edo=10|max_edo=60}} | ||
local p = {} | local p = {} | ||
| Line 7: | Line 7: | ||
-- Convert a frequency ratio to cents | -- Convert a frequency ratio to cents | ||
local function cents(ratio) | local function cents(ratio) | ||
return 1200 * math.log( | return 1200 * math.log(2) | ||
end | end | ||
| Line 31: | Line 31: | ||
end | end | ||
-- Calculate all EDO | -- Calculate all EDO approximation within tolerance for a given ratio | ||
local function calculate_edo_approximations(ratio, tolerance, min_edo, max_edo) | local function calculate_edo_approximations(ratio, tolerance, min_edo, max_edo) | ||
local ratio_cents = cents(ratio) | local ratio_cents = cents(ratio) | ||