Module:Chord consistency: Difference between revisions

Dummy index (talk | contribs)
+distance parameter
Dummy index (talk | contribs)
+maxlen
Line 98: Line 98:
end
end


function p.consistent_edos(harmonics, distance)
function p.consistent_edos(harmonics, distance, ed, maxlen)
distance = distance or 1.0
ed = ed or 'edo'
maxlen = maxlen or 72
local all_interval = {}
local all_interval = {}


Line 113: Line 116:
local vals = {}
local vals = {}
for i = 1, 72 do
for i = 1, 72 do
local et = ET.parse('' .. i .. 'edo')
local et = ET.parse('' .. i .. ed)
local consistent = p.additively_consistent_int(et, all_interval, false, previous)
local consistent = p.additively_consistent_int(et, all_interval, false, previous)
if consistent then
if consistent then
Line 125: Line 128:
end
end
if up then
if up then
table.insert(vals, "[[" .. i .. "edo]]" .. string.rep("*", llevel))
table.insert(vals, "[[" .. i .. ed .. "]]" .. string.rep("*", llevel))
if #vals >= maxlen then
table.insert(vals, "...")
break
end
end
end
end
end
Line 190: Line 197:
end
end
cat = "(d >= " .. distance .. ") " .. p.consistent_edos(harmonics, distance)
cat = "(d >= " .. distance .. ") " .. p.consistent_edos(harmonics, distance, 'edo', 4)
--end
--end