Sound changes
Anthologica Universe Atlas / Universes / The Allosphere / Vengic / Ziwanic / Sound changes

mode intelligent
open 'proto-vengic.txt' as LEXICON

C = p t c k q b d j g v z y ɣ f s x h m n ɳ ŋ l r w pʲ bʲ mʲ ʈ ɖ ʂ
A = a ã aː ãː
E = e ẽ eː ẽː
O = o õ oː õː
[IH] = ɪ ɪ̃ ɪː ɪ̃ː
[UH] = ʊ ʊ̃ ʊː ʊ̃ː
I = i ĩ iː ĩː
U = u ũ uː ũː

[VSHORT] = a  ã  e  ẽ  o  õ  ɪ  ɪ̃  ʊ  ʊ̃  i  ĩ  u  ũ
[VLONG]  = aː ãː eː ẽː oː õː ɪː ɪ̃ː ʊː ʊ̃ː iː ĩː uː ũː
[VORAL]  = a  aː e  eː o  oː ɪ  ɪː ʊ  ʊː i  iː u  uː
[VNASAL] = ã  ãː ẽ  ẽː õ  õː ɪ̃  ɪ̃ː ʊ̃  ʊ̃ː ĩ  ĩː ũ  ũː

V = [VSHORT] [VLONG] ɐ ь ъ  % reduced vowels

[PB] = p t c k q b d j g
P = p t c k q
B = b d j g
[SZ] = v z y ɣ f s ç x h
S = f s ç x h

% normalize ASCII
aa > aː
ee > eː
oo > oː
ii > iː
uu > uː
[VORAL]m > [VNASAL] / _C or _#
ng > ŋ
gh > ɣ

[VORAL]ɴ > [VNASAL] / _

% the sound changes in http://www.incatena.org/viewtopic.php?p=1049472#p1049472 are pretty out of date
% it's assuming sesquisyllabic (CV-)CVC, but Proto-Vengic was actually strict (C)V
% but we can't take this structure as representative of Ziwanic, because Vynyi "is" Ziwanic, by some bizarre standard
% so... let's take the *N split as representative of Ziwanic
% (and fricative reflexes of V < *B + plain-voiced reflexes of B < *MB, but that's everything except Zotic)
% ( + possibly some other early branches)

ɳ > mʲ / U_
ɳ > ɖ

% Length shift to handle CVVCVCV, which is otherwise difficult
[VLONG]C[VSHORT] > [VSHORT]C[VLONG] / _CV#

% Length rule
[VLONG] > [VSHORT] / [VLONG]C_

% now that we've defined Ziwanic, let's get Proto-Everything-But-Vynyi
% which *is* defined by the sesquisyllabic structure
% from earlier penultimate stress
% however, unlike in Hluic, long vowels attract stress
% specifically, the rightmost long vowel

% as usual, we'll use ʜ to represent stress...

% first, stress every long vowel
% if you do 0 > ʜ / [VLONG]_, it won't work word-finally for some reason
[VLONG] > [VLONG]ʜ / _

% then remove all stresses but the rightmost
ʜ > 0 / (CV)+_(CV)+ʜ

% assign regular penultimate stress
0 > ʜ / [VSHORT]_C[VSHORT]# not ʜ(CV)?_C[VSHORT]#

% stress all monosyllables (that aren't already stressed)
V > Vʜ / #C_#

% Proto-Vengic root structure:
% (C1{ă ĭ1 ŭ1})(C2){a e o i u}(C3({ă ĭ2 ŭ2}))
% C1 = p t c k ʔ f s x h m n
% C2 = any C or Pr Fr or labial + y
% C3 = any C except unvoiced non-glottal plosives
% Nasality contrast is lost in unstressed syllables.

% How can we get those clusters? Well, let's say unstressed a > schwa, shorter than all the other vowels, and is lost.
% I'm not too sure about this tho - you get height/length interactions elsewhere in Vengic:
% - in Vynyi, clusters [probably] come from lost *high* vowels
% - in Whatic, final -a is less prone to loss than other final vowels
% But I'd originally planned the C1 vowels to condition height mutation, and who needs that.
% So prestress vowels won't be e o i u, but rather a i u.

i u ĩ ũ > 0 / {[PB] [SZ]}_rVʜ
i ĩ > 0 / {p b f v m}_yVʜ

% Long vowels will interfere with this somehow, of course...
% they'll give you... disesquisyllabic words?
% So let's assign secondary stress.

V > Vʜ / _C{C}?VC{C}?Vʜ

a ã > ɐ / ʜC{C}?_
e ẽ o õ > ɐ / ʜC{C}?_
i ĩ u ũ > ь ь ъ ъ / ʜC{C}?_

a ã > ɐ / _C{C}?Vʜ
e ẽ > ь / _C{C}?Vʜ
o õ > ъ / _C{C}?Vʜ
i ĩ > ь / _C{C}?Vʜ
u ũ > ъ / _C{C}?Vʜ

% One more consonant shift...
g > k / #_
g > ŋ

% Good enough.
ʜ > 0
pʲ bʲ mʲ > py by my

% Not sure what this is. Is it contrastive?
w > v

% More orthographic stuff
z > ð

% Oh, drop length while we're at it.
[VLONG] > [VSHORT]

close LEXICON as 'proto-ziwanic.txt'