Module:MOS degrees: Difference between revisions

Ganaram inukshuk (talk | contribs)
Step ratio limit increased to 5
Ganaram inukshuk (talk | contribs)
Added option to use ordinals (1st=unison, 2nd=1-step), specifically for 5L 2s
Line 30: Line 30:
-- Helper function
-- Helper function
-- Creates the columns for the degree name and note name
-- Creates the columns for the degree name and note name
function p.preprocess_degrees_and_note_names(input_mos, udp, note_symbols, sharp_symbol, flat_symbol, asc_chain_length, des_chain_length)
function p.preprocess_degrees_and_note_names(input_mos, udp, note_symbols, sharp_symbol, flat_symbol, asc_chain_length, des_chain_length, prefix, notation)
-- Test parameters
-- Test parameters
--[[
--[[
Line 70: Line 70:
-- Find the note name
-- Find the note name
local note_symbol = string.sub(note_symbols, mossteps + 1, mossteps + 1)
local note_symbol = string.sub(note_symbols, mossteps + 1, mossteps + 1)
local note_name = mosnot.mosstep_and_chroma_to_note_name(mossteps, chromas, note_symbol, sharp_symbol)
local note_name = mosnot.mosstep_and_chroma_to_note_name(mossteps, chromas, note_symbol, sharp_symbol, prefix, notation)
-- Find the degree name
-- Find the degree name
Line 118: Line 118:
-- If j is ever 1, then the mosdegree is the equave
-- If j is ever 1, then the mosdegree is the equave
-- This only happens if the current period is the last period
-- This only happens if the current period is the last period
-- If the equave is 2/1, that's the octave
if j == 1 then
if j == 1 then
degree_name = degree_name .. " (equave)"
if input_mos.equave == 2 then
degree_name = degree_name .. " (octave)"
else
degree_name = degree_name .. " (equave)"
end
end
end
Line 286: Line 291:
if string.len(frame.args['Flat Symbol']) > 0 then
if string.len(frame.args['Flat Symbol']) > 0 then
flat_symbol = frame.args['Flat Symbol']
flat_symbol = frame.args['Flat Symbol']
end
-- Get notational options
-- If the scale sig is 5L 2s, then use ordinal numbering and no mosprefix
-- Typing in "NONE" will have no prefix added
local degree_notation = "mosdegree"
local mos_prefix = "mos" -- TODO: add prefix lookup
if scale_sig == "5L 2s" then
degree_notation = "ordinal"
mos_prefix = ""
end
if string.len(frame.args['Degree Notation']) > 0 then
degree_notation = frame.args['Degree Notation']
end
if string.len(frame.args['MOS prefix']) > 0 then
mos_prefix = frame.args['Degree Notation']
elseif frame.args['MOS prefix'] == "NONE" then
mos_prefix = ""
end
end
Line 307: Line 330:


-- Get the degrees and note names
-- Get the degrees and note names
local degrees_and_note_names = p.preprocess_degrees_and_note_names(input_mos, udp, note_symbols, sharp_symbol, flat_symbol, asc_chain_length, des_chain_length)
local degrees_and_note_names = p.preprocess_degrees_and_note_names(input_mos, udp, note_symbols, sharp_symbol, flat_symbol, asc_chain_length, des_chain_length, mos_prefix, degree_notation)
-- Get the step and cent values
-- Get the step and cent values