This is a private module sandbox of Thadh, for their own experimentation. Items in this module may be added and removed at Thadh's discretion; do not rely on this module's stability.
local export = {}
local m_IPA = require("Module:IPA")
local lang = require("Module:languages").getByCode("mus")
local rsub = mw.ustring.gsub
local rlower = mw.ustring.lower
local function phonetic(text)
text = rlower(text)
-- pitch
text = rsub(text, "é", "eH")
text = rsub(text, "ú", "uH")
text = rsub(text, "á", "aH")
text = rsub(text, "ó", "oH")
text = rsub(text, "í", "iH")
text = rsub(text, "́", "H")
text = rsub(text, "ê", "eL")
text = rsub(text, "û", "uL")
text = rsub(text, "â", "aL")
text = rsub(text, "ô", "oL")
text = rsub(text, "î", "iL")
text = rsub(text, "̂", "L")
-- nasality
text = rsub(text, "ṽ", "vN")
text = rsub(text, "ẽ", "eN")
text = rsub(text, "ũ", "uN")
text = rsub(text, "ã", "aN")
text = rsub(text, "õ", "oN")
text = rsub(text, "ĩ", "iN")
text = rsub(text, "̃", "N")
-- consonants
text = rsub(text, "c", "tʃ")
text = rsub(text, "r", "ɬ")
text = rsub(text, "())p()", "%1b%2")
text = rsub(text, "())t()", "%1d%2")
text = rsub(text, "())tʃ()", "%1dʒ%2")
text = rsub(text, "())k()", "%1ɡ%2")
text = rsub(text, "())f()", "%1v%2")
text = rsub(text, "())s()", "%1z%2")
text = rsub(text, "(oH?L?N?)h", "%1χ")
text = rsub(text, "χh", "χχ")
text = rsub(text, "y", "j")
text = rsub(text, "()%1", "%1ː")
text = rsub(text, "tʃtʃ", "tʃː")
end