Module:Infobox ET: Difference between revisions

This should be able to automate categories
Try automating some categories and internal refactoring using octave and twelfth
Line 48: Line 48:
local tuning = frame.args['tuning']
local tuning = frame.args['tuning']
local et = ET.parse(tuning) or ET.parse('12edo')
local et = ET.parse(tuning) or ET.parse('12edo')
local prime = ""
local prime = ""
if u.is_prime(et.size) then
if u.is_prime(et.size) then
prime = " (prime)"
prime = " (prime)"
if rat.eq(et.equave, 2) then
categories = categories .. '[[Category:Prime EDO]]'
end
end
end
Line 69: Line 73:
local step_size = ET.cents(et, 1)
local step_size = ET.cents(et, 1)
local fifth = ET.approximate(et, 3/2)
local fifth_error = ET.cents(et, fifth) - i._to_cents(3/2)
local dual_fifth = math.abs(fifth_error) > step_size / 3
local note_12edo = ''
local note_12edo = ''
if rat.eq(et.equave, 2) and et.size == 12 then
if rat.eq(et.equave, 2) and et.size == 12 then
Line 79: Line 79:
local octave = ET.approximate(et, 2)
local octave = ET.approximate(et, 2)
local A1 = 7 * fifth - 4 * octave
local twelfth = ET.approximate(et, 3)
local m2 = 3 * octave - 5 * fifth
local fifth = -octave + twelfth -- 3/2 = [-1 1>
local fifth_error = ET.cents(et, fifth) - i._to_cents(3/2)
local dual_fifth = math.abs(fifth_error) > step_size / 3
 
local A1 = -11 * octave + 7 * twelfth -- 2187/2048 = [-11 7>
local m2 = 8 * octave - 5 * twelfth -- 256/243 = [8 -5>
local A1_cents = u._round(ET.cents(et, A1), 4)
local A1_cents = u._round(ET.cents(et, A1), 4)
local m2_cents = u._round(ET.cents(et, m2), 4)
local m2_cents = u._round(ET.cents(et, m2), 4)
Line 93: Line 99:
if ET.is_highly_composite(et) then
if ET.is_highly_composite(et) then
text = text .. '[[Highly composite equal division|highly composite]]'
text = text .. '[[Highly composite equal division|highly composite]]'
if rat.eq(et.equave, 2) then
categories = categories .. '[[Category:Highly composite EDO]]'
end
end
end
if is_zeta ~= false and ET.is_zeta(et) then
if is_zeta ~= false and ET.is_zeta(et) then