Module:Infobox ET: Difference between revisions
ArrowHead294 (talk | contribs) mNo edit summary Tag: Reverted |
Fixes for 0edo Tag: Reverted |
||
| 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 > 100 then | if step_size and 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 119: | Line 119: | ||
local fifth = -octave + twelfth -- 3/2 = [-1 1> | local fifth = -octave + twelfth -- 3/2 = [-1 1> | ||
local fifth_error = ET.cents(et, fifth) - rat.cents(rat.new(3, 2)) | local fifth_error = ET.cents(et, fifth) - rat.cents(rat.new(3, 2)) | ||
local is_dual_fifth = math.abs(fifth_error) > step_size / 3 | local is_dual_fifth = step_size and math.abs(fifth_error) > step_size / 3 or false | ||
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 = utils._round(ET.cents(et, A1), 4) | local A1_cents = step_size and utils._round(ET.cents(et, A1), 4) or 0 | ||
local m2_cents = utils._round(ET.cents(et, m2), 4) | local m2_cents = step_size and utils._round(ET.cents(et, m2), 4) or 0 | ||
-- display | -- display | ||
| Line 136: | Line 136: | ||
table.insert(infobox_data, { | table.insert(infobox_data, { | ||
"Step size", | "Step size", | ||
utils._round(step_size, 6) .. "{{c}}" .. note_12edo .. " ", | step_size and (utils._round(step_size, 6) .. "{{c}}" .. note_12edo .. " ") or "n/a", | ||
}) | }) | ||