Module:Infobox ET: Difference between revisions

Implement a cleaner and more futureproof solution to navigation arrows
Only show the fifth and the semitones when the equave is the octave; otherwise show the twelfth cuz there's no octave reduction
Line 92: Line 92:
local next_one = '[[' .. (et.size + increment) .. et.suffix .. '|' .. (et.size + increment) .. et.suffix .. ' →]]'
local next_one = '[[' .. (et.size + increment) .. et.suffix .. '|' .. (et.size + increment) .. et.suffix .. ' →]]'


-- octave, twelfth, and fifth sizes
-- step size
local step_size = ET.cents(et, 1)
local step_size = ET.cents(et, 1)
local note_12edo = ''
local note_12edo = ''
Line 98: Line 98:
note_12edo = '<sup>by definition</sup>'
note_12edo = '<sup>by definition</sup>'
end
end
 
-- octave, twelfth, and fifth sizes
local octave = ET.approximate(et, 2)
local octave = ET.approximate(et, 2)
local twelfth = ET.approximate(et, 3)
local twelfth = ET.approximate(et, 3)
Line 111: Line 112:
local m2_cents = u._round(ET.cents(et, m2), 4)
local m2_cents = u._round(ET.cents(et, m2), 4)


-- display
local infobox_data = {}
local infobox_data = {}
table.insert(infobox_data, {
table.insert(infobox_data, {
Line 127: Line 129:
approximation(et, 2)
approximation(et, 2)
})
})
end
if not rat.eq(et.equave, 3) then
table.insert(infobox_data, {
if not rat.eq(et.equave, rat.new(3, 2)) then
'Twelfth',
approximation(et, 3)
})
end
else
table.insert(infobox_data, {
table.insert(infobox_data, {
'Fifth',
'Fifth',
approximation(et, 3/2)
approximation(et, 3/2)
})
})
end
table.insert(infobox_data, {
 
table.insert(infobox_data, {
'Semitones (A1:m2)',
'Semitones (A1:m2)',
A1 .. ':' .. m2 .. ' (' .. A1_cents .. '¢ : ' .. m2_cents .. '¢)'
A1 .. ':' .. m2 .. ' (' .. A1_cents .. '¢ : ' .. m2_cents .. '¢)'
})
if dual_fifth and et.size > 0 then
table.insert(infobox_data, {
'Dual sharp fifth',
approximation(et, 3/2, 1)
})
table.insert(infobox_data, {
'Dual flat fifth',
approximation(et, 3/2, -1)
})
local sharp = ET.approximate(et, 3/2, 1)
local flat = ET.approximate(et, 3/2, -1)
table.insert(infobox_data, {
'Dual major 2nd',
approximation(et, 9/8, 0, sharp + flat - octave)
})
})
if dual_fifth and et.size > 0 then
table.insert(infobox_data, {
'Dual sharp fifth',
approximation(et, 3/2, 1)
})
table.insert(infobox_data, {
'Dual flat fifth',
approximation(et, 3/2, -1)
})
local sharp = ET.approximate(et, 3/2, 1)
local flat = ET.approximate(et, 3/2, -1)
table.insert(infobox_data, {
'Dual major 2nd',
approximation(et, 9/8, 0, sharp + flat - octave)
})
end
end
end
 
local consistency = tonumber(frame.args['Consistency'])
local consistency = tonumber(frame.args['Consistency'])
if consistency == nil then
if consistency == nil then