Module:Infobox ET: Difference between revisions

+1
Tag: Reverted
These all looked too dumb tbh
Tag: Undo
Line 105: Line 105:
-- step size in cents
-- step size in cents
local step_size = ET.cents(et, 1)
local step_size = ET.cents(et, 1)
if step_size and step_size > 100 then
if step_size > 100 then
categories = categories .. "[[Category:Macrotonal|" .. string.rep("#", string.len(et.size)) .. "]]"
categories = categories .. "[[Category:Macrotonal|" .. string.rep("#", string.len(et.size)) .. "]]"
end
end
Line 118: Line 118:


local fifth = -octave + twelfth -- 3/2 = [-1 1>
local fifth = -octave + twelfth -- 3/2 = [-1 1>
local fifth_error = (step_size and ET.cents(et, fifth) or 0) - rat.cents(rat.new(3, 2))
local fifth_error = ET.cents(et, fifth) - rat.cents(rat.new(3, 2))
local is_dual_fifth = step_size and math.abs(fifth_error) > step_size / 3 or false
local is_dual_fifth = math.abs(fifth_error) > step_size / 3


local A1 = -11 * octave + 7 * twelfth -- 2187/2048 = [-11 7>
local A1 = -11 * octave + 7 * twelfth -- 2187/2048 = [-11 7>
local m2 = 8 * octave - 5 * twelfth -- 256/243 = [8 -5>
local m2 = 8 * octave - 5 * twelfth -- 256/243 = [8 -5>
local A1_cents = step_size and utils._round(ET.cents(et, A1), 4) or 0
local A1_cents = utils._round(ET.cents(et, A1), 4)
local m2_cents = step_size and utils._round(ET.cents(et, m2), 4) or 0
local m2_cents = utils._round(ET.cents(et, m2), 4)


-- display
-- display
Line 136: Line 136:
table.insert(infobox_data, {
table.insert(infobox_data, {
"Step size",
"Step size",
step_size and (utils._round(step_size, 6) .. "{{c}}" .. note_12edo .. " ") or "n/a",
utils._round(step_size, 6) .. "{{c}}" .. note_12edo .. " ",
})
})