Module:MOS interval HE: Difference between revisions

ArrowHead294 (talk | contribs)
mNo edit summary
ArrowHead294 (talk | contribs)
m Alphabetise dependencies
Line 1: Line 1:
local p = {}
local et = require("Module:ET")
local ie = require("Module:Interval extension")
local mos = require("Module:MOS")
local mos = require("Module:MOS")
local rat = require("Module:Rational")
local rat = require("Module:Rational")
local et = require("Module:ET")
local tamnams = require("Module:TAMNAMS")
local tamnams = require("Module:TAMNAMS")
local interval_extension = require("Module:Interval_extension")
local yesno = require("Module:Yesno")
local yesno = require("Module:Yesno")
local p = {}


-- Main function; to be called by wrapper
-- Main function; to be called by wrapper
Line 72: Line 73:
.. string.format("| %s " , tamnams.interval_quality(current_bright_interval, input_mos, "sentence-case", mos_prefix))
.. string.format("| %s " , tamnams.interval_quality(current_bright_interval, input_mos, "sentence-case", mos_prefix))
.. string.format("|| %.1f¢ ", cents)
.. string.format("|| %.1f¢ ", cents)
.. string.format("|| ~%.4f nats ", interval_extension.harmonic_entropy_with_lookup_table(cents))
.. string.format("|| ~%.4f nats ", ie.harmonic_entropy_with_lookup_table(cents))
.. string.format("|| ~%.4f nats", interval_extension.harmonic_entropy_with_lookup_table(cents))
.. string.format("|| ~%.4f nats", ie.harmonic_entropy_with_lookup_table(cents))
else
else
-- Calculate the best and average harmonic entropies
-- Calculate the best and average harmonic entropies
Line 82: Line 83:
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 = interval_extension.harmonic_entropy_with_lookup_table(mos.interval_to_cents(current_dark_interval, input_mos, step_ratio))
local he_dark = ie.harmonic_entropy_with_lookup_table(mos.interval_to_cents(current_dark_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))
local he_bright = ie.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