Module:Temperament data/Badness testing: Difference between revisions

CompactStar (talk | contribs)
No edit summary
CompactStar (talk | contribs)
No edit summary
Line 328: Line 328:
end
end
result = result:sub(0,-3)
result = result:sub(0,-3)
local c = 0
local c = 0.0
for i = 1, #mapping do
for i = 1, #mapping do
for j = 1, #mapping[1] do
for j = 1, #mapping[1] do
Line 335: Line 335:
end
end
c = c/(#mapping * #mapping[1])
c = c/(#mapping * #mapping[1])
local te_generator = get_te_generator(subgroup, comma_matrix, generators)
local tuning_matrix = matmul(te_generator, mapping)
local e = 0.0
for i = 1, #tuning_matrix[1] do
e = e + math.abs(mapping[i][j])
end
e = e/(#tuning_matrix)
local usb = c * e
result = result .. "\n\nUSB: " + u._round(usb, 7)
return result
return result
end
end


return p
return p