Module:Interval table: Difference between revisions

CompactStar (talk | contribs)
No edit summary
CompactStar (talk | contribs)
No edit summary
Line 7: Line 7:


--  Gets mapping of a monzo in a val
--  Gets mapping of a monzo in a val
local function mapping(monzo, val)
function p.mapping(monzo, val)
local result = 0
local result = 0
for k,v in pairs(val) do
for k,v in pairs(val) do
result = val[k] * (monzo[k] or 0)
result = result + val[k] * (monzo[k] or 0)
end
end
return result
return result
Line 38: Line 38:
-- Utility fuunction to get specific note name with ud.get_note_names_table
-- Utility fuunction to get specific note name with ud.get_note_names_table
-- (this is essentially what "Template:Ups and downs note name" does)
-- (this is essentially what "Template:Ups and downs note name" does)
local function ud_note(et, fifth, step)
local function ud_note(et, fifth, step)
return table.concat(ud.get_note_names_table(et, fifth)[step], ", "):sub(0, -1)
return table.concat(ud.get_note_names_table(et, fifth)[step], ", "):sub(0, -1)
Line 47: Line 46:
local et = ET.parse(tuning) or ET.parse('12edo')
local et = ET.parse(tuning) or ET.parse('12edo')
local patent_val = {
local patent_val = {
ET.approximate(et, 2),  
[2] = ET.approximate(et, 2),  
ET.approximate(et, 3),  
[3] = ET.approximate(et, 3),  
ET.approximate(et, 5),  
[5] = ET.approximate(et, 5),  
ET.approximate(et, 7),  
[7] = ET.approximate(et, 7),  
ET.approximate(et, 11),  
[11] = ET.approximate(et, 11),  
ET.approximate(et, 13),  
[13] = ET.approximate(et, 13),  
ET.approximate(et, 17),
[17] = ET.approximate(et, 17),
ET.approximate(et, 19),  
[19] = ET.approximate(et, 19),  
ET.approximate(et, 23),
[23] = ET.approximate(et, 23),
ET.approximate(et, 29),
[29] = ET.approximate(et, 29),
ET.approximate(et, 31),
[31] = ET.approximate(et, 31),
ET.approximate(et, 37),
[37] = ET.approximate(et, 37),
ET.approximate(et, 41),
[41] = ET.approximate(et, 41),
ET.approximate(et, 47),
[47] = ET.approximate(et, 47)
ET.approximate(et, 53),
ET.approximate(et, 59),
ET.approximate(et, 61)
}
}
Line 74: Line 70:
local dual_sharp_fifth = ET.approximate(et, 3/2, 1)
local dual_sharp_fifth = ET.approximate(et, 3/2, 1)
-- List of all ratios with numerator and denominator <= 60 and in the range 1/1 - 5/1
-- List of all ratios with numerator and denominator <= 50 and in the range 1/1 - 5/1
local ratios_list = get_ratios_list(60, 5)
local ratios_list = get_ratios_list(50, 5)


wikitext = wikitext .. '!Steps\n'
wikitext = wikitext .. '!Steps\n'