Module:MOS gamut: Difference between revisions

Ganaram inukshuk (talk | contribs)
Undo revision 115790 by Ganaram inukshuk (talk) - colors are wip
Tag: Undo
Ganaram inukshuk (talk | contribs)
m Simplified comments
Line 22: Line 22:
-- - note_symbols - the note names entered as a string, such as "CDEFGAB"
-- - note_symbols - the note names entered as a string, such as "CDEFGAB"
-- - chroma_symbol - the symbol for the chroma used, such as "#" (for ascending chain) or
-- - chroma_symbol - the symbol for the chroma used, such as "#" (for ascending chain) or
--  "b" (for descending chain)
--  "b" (for descending chain), or & and @ for diamond-mos
-- - going_up - bool; whether the genchain is going up or down; true for up, false for down
-- - going_up - bool; whether the genchain is going up or down; true for up, false for down
function p.mos_genchain(input_mos, genchain_init, genchain_length, note_symbols, chroma_symbol, going_up)
function p.mos_genchain(input_mos, genchain_init, genchain_length, note_symbols, chroma_symbol, going_up)
Line 138: Line 138:
chroma_minus_symbol = "b"
chroma_minus_symbol = "b"
end
end
-- For a mos nxL nys with a given step ratio p/q, the gamut is such that every accidental
-- note (what would be the black keys) has at least one name within the edo nxp+nyq.
-- Start with the mode defined by the udp un|dn and, starting at the root (usu. C or J),
-- construct two generator chains that goes up u generators and d generators. For a
-- multi-period mos with n periods, there needs to be a separate genchain pair per period
-- for n genchain pairs.
-- Reconstruct the UDP up|dp (u times p pipe d times p)
-- Reconstruct the UDP up|dp (u times p pipe d times p)
Line 157: Line 150:
local gens_down_per_period = generators_down / periods
local gens_down_per_period = generators_down / periods
-- How long is the genchain extended for per period?
-- Get and simplify the step ratio
-- For nxL nys with a step ratio 2:1, extend the genchains by x generators for each period.
-- For any other step ratio p:q, extend by x(p-2)+y(q-1) gens per genchain per period.
-- If the step ratio p/q is such that p and q are not coprime and share a common
-- factor k, then the gamut produced is one of several gamuts shifted by up to k-1
-- edosteps up or down. For simplicity, this isn't included so the gamut will be that for
-- a step ratio p/q rather than kp/kq.
local kp = step_ratio[1]
local kp = step_ratio[1]
local kq = step_ratio[2]
local kq = step_ratio[2]
Line 176: Line 163:
-- How many esteps are in the equave? Gamut does not include any notes reached by
-- How many esteps are in the equave? Gamut does not include any notes reached by
-- increments smaller than a chroma, so if the step ratio is not simplified, the
-- increments smaller than a chroma, so if the step ratio is not simplified, the
-- gamut will be for a simplified step ratio
-- gamut returned will be for a simplified step ratio
local estedps_per_equave = input_mos.nL * num + input_mos.ns * den
local estedps_per_equave = input_mos.nL * num + input_mos.ns * den