The Elvish languages have the same general stress rule as Latin [1]:
stress falls on the penultimate syllable if that is heavy (contains a
long vowel, a diphthong, or a vowel followed by two or more consonants),
otherwise on the antepenultimate syllable. For Latin, espeak-ng
implements this by declaring “penultimate syllable” as the general
stress rule in espeak-ng-data/, and then adding rules in dictsource/
that match light syllables and move the primary stress to the previous
syllable, i.e. the antepenultimate one. We use the same basic principle
for the Elvish languages here (but using the terms “heavy” and “light”
rather than “weak” and “strong” like in the Latin files).
Note that this doesn’t fully implement the stress rules yet: we have no
concept of diphthongs, long vowels aren’t really properly handled yet,
and we also still count ⟨ch⟩, ⟨dh⟩, ⟨th⟩ as two consonants rather than
one as it should be. This will be improved separately (I prefer doing
this in small incremental steps).
[1]: https://menegroth.github.io/stress-in-sindarin.html
This prepares the languages of Quenya and Sindarin, setting up their
infrastructure without declaring a lot of rules yet – just enough for
“Eä” (a Quenya word, but I can’t think of a similarly simple one for
Sindarin). Phonemes are inherited from Esperanto for now.