Neural speech synthesis (Text-to-Speech) is a foundational technology for digital accessibility and human-machine interaction. Yet low-resource languages like Macedonian are routinely neglected by major commercial tech vendors or trapped behind expensive proprietary cloud APIs that bill per character, impose network round-trip latency, and log user telemetry. This project delivers an open-source, local-first text-to-speech engine for Macedonian engineered to execute on affordable edge hardware with zero external dependencies.

Piper TTS & VITS End-to-End Neural Architecture

Rather than relying on legacy two-stage pipelines (which generate intermediate mel-spectrograms before feeding a computationally heavy vocoder), our system builds upon Piper TTS and the VITS (Variational Inference with adversarial learning for end-to-end Text-to-Speech) architecture: - Unified Differentiable Network: VITS unifies a Variational Autoencoder (VAE), normalizing flows, and an adversarial HiFi-GAN based vocoder into a single end-to-end differentiable model. - Monotonic Alignment Search (MAS): During training, MAS discovers the alignment between input phonemes and target speech representations automatically, removing the need for labor-intensive, millisecond-level manual audio segment labeling. - ONNX Runtime & INT8 Quantization: Trained checkpoints are exported to ONNX format and quantized using 8-bit integer weights. The model footprint is compressed to under 48 MB, allowing it to be pinned in RAM even on low-cost embedded systems without swapping.

Algorithmic Phonetic IPA Rules for Macedonian

Acoustic models trained on multilingual corpora fail when presented with raw Macedonian Cyrillic text without an explicit phonetic bridge. We developed an open, deterministic grapheme-to-phoneme (G2P) transpiler mapping Cyrillic orthography to the International Phonetic Alphabet (IPA):

  1. Palatal Stops & Affricates:
  2. Accurate discrimination of palatal plosives /ɟ/ (ѓ) and /c/ (ќ) rather than softening dental consonants.
  3. Clean synthesis of complex affricates: /t͡s/ (ц), /t͡ʃ/ (ч), /d͡ʒ/ (џ), and the distinctive Macedonian voiced alveolar affricate /d͡z/ (ѕ).
  4. Palatal sonorants: dedicated modeling for /ʎ/ (љ) and /ɲ/ (њ).

  5. Vocalic Syllabic 'r' (/r̩/):

  6. Macedonian syllabic 'r' governs distinct phonological contexts: when occurring word-initially before a consonant (e.g. ’рбет, ’рѓа, ’ржи) or inter-consonantally (e.g. прст, дрво, крв, брзо), the engine tags the phoneme as syllabic /r̩/, preventing the neural vocoder from introducing synthetic schwa vowels.

  7. Antepenultimate Stress Rule (Третосложен акцент):

  8. Standard Macedonian features fixed antepenultimate word stress: on trisyllabic and polysyllabic words, stress consistently falls on the third syllable from the word ending (e.g., пла́нината, воде́ница, рабо́тилница), while on disyllabic words it falls on the penultimate syllable (e.g., ку́ќа, ри́дот).
  9. The transpiler performs syllabification and injects IPA primary stress markers (ˈ), ensuring speech preserves correct natural cadence and melodic prosody.

Zero-Cloud Local Edge Inference

The defining engineering achievement of this pipeline is its speed and total network independence: - Real-Time Factor (RTF): Running on a stock quad-core Raspberry Pi 4 (ARM Cortex-A72 at 1.5 GHz), the engine achieves a Real-Time Factor (RTF) of ~0.15. A 5-second sentence is synthesized in just 750 milliseconds. On modern x86/ARM laptop CPUs, RTF drops below 0.04. - Sub-180ms Time-to-First-Audio: The pipeline streams synthesized PCM audio chunks to playback hardware within 180 ms of receiving text input. - Total Privacy & Zero SaaS Overhead: The daemon runs locally over a UNIX domain socket or a lightweight localhost REST endpoint. Text never leaves the edge device, providing ironclad privacy for sensitive documentation or off-grid field deployments.

Real-World Applications in the Open Lab

We integrate the voice engine directly into our physical and civic projects: - Spoken Solar Telemetry: Off-grid solar stations and mountain mesh repeaters announce battery reserves, energy harvest figures, and severe weather warnings aloud to visitors and hikers. - Accessible Open Education: Automatically transforming open technical handbooks, civic documents, and workshop tutorials into audiobooks for visually impaired community members. - Open Codebase: All training pipelines, phonetic dictionary tables, and quantized ONNX checkpoints are freely accessible in our git repository under open-source licenses.