Module:MOS intervals: Difference between revisions

ArrowHead294 (talk | contribs)
mNo edit summary
ArrowHead294 (talk | contribs)
m Undo. Function constantly times out.
Tag: Undo
Line 5: Line 5:
local et = require("Module:ET")
local et = require("Module:ET")
local tamnams = require("Module:TAMNAMS")
local tamnams = require("Module:TAMNAMS")
local he = require("Module:Harmonic entropy")
local interval_extension = require("Module:Interval_extension")
local p = {}
local p = {}


Line 70: Line 70:
.. string.format("|| %s " , mos.interval_as_string(current_bright_interval))
.. string.format("|| %s " , mos.interval_as_string(current_bright_interval))
.. string.format("|| %.1f¢ ", cents)
.. string.format("|| %.1f¢ ", cents)
.. string.format("|| ~%.4f nats ", he.harmonic_entropy(cents))
.. string.format("|| ~%.4f nats ", interval_extension.harmonic_entropy_with_lookup_table(cents))
.. string.format("|| ~%.4f nats\n", he.harmonic_entropy(cents))
.. string.format("|| ~%.4f nats\n", interval_extension.harmonic_entropy_with_lookup_table(cents))
else
else
-- Calculate the best and average harmonic entropies
-- Calculate the best and average harmonic entropies
Line 80: Line 80:
for i = 1, #step_ratios do
for i = 1, #step_ratios do
local step_ratio = step_ratios[i]
local step_ratio = step_ratios[i]
local he_dark = he.harmonic_entropy(mos.interval_to_cents(current_dark_interval, input_mos, step_ratio))
local he_dark = interval_extension.harmonic_entropy_with_lookup_table(mos.interval_to_cents(current_dark_interval, input_mos, step_ratio))
local he_bright = he.harmonic_entropy(mos.interval_to_cents(current_bright_interval, input_mos, step_ratio))
local he_bright = interval_extension.harmonic_entropy_with_lookup_table(mos.interval_to_cents(current_bright_interval, input_mos, step_ratio))
he_dark_average = he_dark_average + he_dark / #step_ratios
he_dark_average = he_dark_average + he_dark / #step_ratios
he_bright_average = he_bright_average + he_bright / #step_ratios
he_bright_average = he_bright_average + he_bright / #step_ratios