Module:Infobox ET: Difference between revisions

Plumtree (talk | contribs)
m Refactoring
Plumtree (talk | contribs)
m 12edo step size: "by definition"
Line 52: Line 52:
end
end
local suffix = tuning:match('%d+(ed.+)')
local suffix = tuning:match('%d+(ed.+)')
local step_size = i._backslash_ratio('1\\' .. tuning)
local step_size = i._backslash_ratio('1\\' .. tuning)
local fifth = approximate(size, equave, 3/2)
local fifth = approximate(size, equave, 3/2)
local fifth_error = i._to_cents(i._backslash_ratio(fifth .. '\\' .. tuning)) - i._to_cents(3/2)
local fifth_error = i._to_cents(i._backslash_ratio(fifth .. '\\' .. tuning)) - i._to_cents(3/2)
local dual_fifth = math.abs(fifth_error) > i._to_cents(step_size) / 3
local dual_fifth = math.abs(fifth_error) > i._to_cents(step_size) / 3
local note_12edo = ''
if rat.eq(equave, 2) and size == 12 then
note_12edo = '<sup>by definition</sup>'
end
local octave = approximate(size, equave, 2)
local octave = approximate(size, equave, 2)
Line 70: Line 76:
table.insert(infobox_data, {
table.insert(infobox_data, {
'Step size',
'Step size',
i._to_cents(step_size, 6) .. '¢'
i._to_cents(step_size, 6) .. '¢' .. note_12edo
})
})
if not dual_fifth then
if not dual_fifth then