Module:Chord edo approximation: Difference between revisions

Pailiaq (talk | contribs)
No edit summary
Tag: Manual revert
Pailiaq (talk | contribs)
No edit summary
Line 7: Line 7:


-- ===== CONFIGURATION VARIABLES =====
-- ===== CONFIGURATION VARIABLES =====
local DEFAULT_ERROR_BASE = 5
local DEFAULT_ERROR_BASE = 10        -- Constant tolerance offset (%)
local DEFAULT_ERROR_PER_INTERVAL = 10
local DEFAULT_ERROR_QUADRATIC = 2.5  -- Multiplier on n·(n+1), where n = number of intervals
local DEFAULT_MIN_EDO = 5
local DEFAULT_MIN_EDO = 5
local DEFAULT_MAX_EDO = 60
local DEFAULT_MAX_EDO = 60
Line 99: Line 99:
     end
     end


    if not max_total_error then
if not max_total_error then
        max_total_error = DEFAULT_ERROR_BASE + DEFAULT_ERROR_PER_INTERVAL * (#notes - 1)
    local n = #notes - 1
    end
    max_total_error = DEFAULT_ERROR_QUADRATIC * n * (n + 1) + DEFAULT_ERROR_BASE
end


     local root = notes[1]
     local root = notes[1]