Module:Xenpaper: Difference between revisions

Ganaram inukshuk (talk | contribs)
Created page with "local mos = require('Module:MOS') local rat = require('Module:Rational') local p = {} -- TODO: -- - Add support for ascending and descending scales -- Create a Xenpaper link..."
 
ArrowHead294 (talk | contribs)
mNo edit summary
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
local mos = require('Module:MOS')
local rat = require('Module:Rational')
local p = {}
local p = {}
local mos = require("Module:MOS")
local rat = require("Module:Rational")


-- TODO:
-- TODO:
Line 32: Line 33:
for i = 1, #step_pattern + 1 do
for i = 1, #step_pattern + 1 do
if i ~= #step_pattern + 1 then
if i ~= #step_pattern + 1 then
text = text .. string.format('%d--_', i - 1)
text = text .. string.format("%d--_", i - 1)
else
else
text = text .. string.format('%d---', i - 1)
text = text .. string.format("%d---", i - 1)
end
end
end
end
text = "xenpaper.com/#" .. text
text = "https://www.luphoria.com/xenpaper/#" .. text
return text
return text
Line 45: Line 46:
-- Create a Xenpaper link for a mode of a mos
-- Create a Xenpaper link for a mode of a mos
-- TODO: support step sizes of c (L-s), A (L+c), and d (s-c) for modmosses
-- TODO: support step sizes of c (L-s), A (L+c), and d (s-c) for modmosses
function p.mosstep_pattern_to_xenpaper_link(input_mos, abstract_step_pattern, step_ratio)
function p.mosstep_pattern_to_xenpaper_link(abstract_step_pattern, step_ratio, equave)
local input_mos = input_mos or mos.new(5, 2)
local abstract_step_pattern = abstract_step_pattern or "LLLsLLs"
local abstract_step_pattern = abstract_step_pattern or "LLLsLLs"
local step_ratio = step_ratio or { 2, 1 }
local step_ratio = step_ratio or { 2, 1 }
local equave = equave or 2
local L_size = step_ratio[1]
local L_size = step_ratio[1]
Line 63: Line 64:
end
end
local equave = input_mos["equave"]
return p.step_pattern_to_xenpaper_link(step_pattern, equave)
return p.step_pattern_to_xenpaper_link(step_pattern, equave)
Line 85: Line 85:
local ratio_as_text = rat.as_ratio(ratios[i], "%2F")
local ratio_as_text = rat.as_ratio(ratios[i], "%2F")
if i ~= #ratios then
if i ~= #ratios then
text = text .. string.format('%d--_', i - 1)
text = text .. string.format("%d--_", i - 1)
else
else
text = text .. string.format('%d---', i - 1)
text = text .. string.format("%d---", i - 1)
end
end
end
end
text = "xenpaper.com/#" .. text
text = "https://www.luphoria.com/xenpaper/#" .. text
return text
return text
end
end
return p
return p