Slovak Audio Suite faster-whisper STT Phonon-2.5 MLX MarianMT sk-en Ollama Local LLM Tkinter & Textual TUI

A Laptop That Listens in Slovak

Félix Pupo Pérez Félix Pupo Pérez
November 8, 2026
16 min read
AI Systems & Audio Engineering
fpupoperez/slovak_translator Open Source

Companion open-source repository featuring local CPU and Apple Silicon speech recognition pipelines: hardware-rate PortAudio streaming, hysteresis phrase detection, faster-whisper, MarianMT, MLX Phonon-2.5, Ollama chat, four desktop and terminal front ends, and macOS Cocoa click swizzles.

Python 3.10+ faster-whisper MLX / PyTorch Tkinter & Textual
Slovak Audio Suite Textual Terminal UI with Live Slovak and English Transcription

Slovak is a West Slavic language, the official language of Slovakia and one of the twenty-four official languages of the European Union, with roughly five million speakers. Models are not worse at it because it is hard to hear; they are worse at it because most training corpora lean heavily toward English. Plenty of models can transcribe English with impressive confidence; give them Slovak and they start guessing. This project is my attempt to keep the whole loop on the laptop: press a button, speak Slovak, and watch the transcription or English translation appear without sending audio to a server.

Concretely, the repository holds a set of experiments in one narrow direction: live Slovak-to-English transcription and translation for people sitting in meetings held in Slovak. You might catch half of what is being said and need the other half in English before the topic moves on. This is not a conference interpreter or a production service. It is a small personal tool for following the discussion and getting through a meeting in a language you only partly understand, and that audience sets the priorities: short lines that arrive while the sentence is still relevant, and a transcript that stays scannable when nobody pauses for you.

The code lives in slovak_translator/, and the app has two modes: Transcribe (Slovak Only) and Translate to English. It also has four front ends. app.py is the desktop window; app_textual.py is the same pipeline in a terminal. app_phonon.py and app_textual_phonon.py swap the recognizer for a smaller Apple-Silicon-friendly model and let a local language model handle translation. There is a one-file CLI on each as well (--file clip.wav --mode translate), because debugging a microphone loop is much easier when the input is a known file.

app.py is built with Tkinter, Python's bundled GUI toolkit built on Tk, the underlying windowing toolkit, and ttk, its themed widget set. The terminal versions use Textual, a framework for building interactive terminal applications, and Rich, the terminal-rendering library that Textual uses for styled text.


01. Two Engines, One Shape

The default route is a two-step pipeline. faster-whisper, a reimplementation of OpenAI's Whisper speech model running on CTranslate2 (an inference engine for Transformer models), turns the audio into Slovak text. Then MarianMT, a family of encoder-decoder translation models, turns that text into English. The Marian model is loaded through Transformers, Hugging Face's library for running pretrained models, with PyTorch, the deep-learning tensor framework, doing the work underneath. Weights come from the Hugging Face Hub, the model host the app downloads from.

The alternative route uses Phonon-2.5, a compact multilingual speech-recognition model from Fermion Research, running through mlx-audio, the audio package that loads speech models onto MLX, Apple's array framework for Apple Silicon. Phonon only returns the spoken language, so English comes from Ollama, a local HTTP server that runs language models on your machine. No audio or text leaves the computer in either route.

Whisper's small checkpoint is the default. base is faster, but it drops Slovak words that small keeps, and on a normal sentence small finishes in roughly the time it took to say the phrase. That trade-off is the reason the model selector exists rather than a single hardcoded size.

02. The Architecture at a Glance

Every phrase follows a clean, single-direction pipeline from capture to ordered display:

[Microphone] ──> [sounddevice / PortAudio @ native Hz] ──> [phrase gate: take_speech_phrase]
                                                                     │
                                                              "finished phrase"
                                                                     │
[CLI: --file clip] ──[prepare_speech_audio: gate, trim, resample 16k, level]
                                  │
                            ┌─────+─────┐
                            │  ENGINE   │
                            └─────┬─────┘
                     ┌────────────┴────────────┐
                     │                         │
          [faster-whisper (CPU)]      [Phonon-2.5 on MLX (GPU)]
               (Slovak text)               (Slovak text)
                     │                         │
                     └────────────┬────────────┘
                                  │
                         ┌────────+────────┐
                         │ Translate Mode? │
                         └────────┬────────┘
                   ┌──────────────┴──────────────┐
                   │ "yes" (Whisper)             │ "yes" (Phonon)
                   │                             │
         [MarianMT sk->en (PyTorch)]      [Ollama Local LLM]
                   │                             │
                   └──────────────┬──────────────┘
                                  │
            [OrderedResults: strict spoken FIFO release]
                                  │
           [Desktop UI: Tkinter Window or Textual TUI]
                                  │
                               (on Stop)
                                  │
                     [transcripts/*.txt session log]

The microphone callback has two jobs: push blocks of audio into a queue and update a smoothed level for the meter. A phrase detector consumes those blocks and emits complete utterances. Recognition and translation run on background workers, and an ordering layer makes sure a fast later phrase never jumps ahead of a slow earlier one. Only then does the UI or the transcript writer see a line.

03. Capture at the Rate the Device Actually Runs

audio_input.py exists because opening a microphone at a hardcoded 16 kHz is a reliable way to break on macOS. sounddevice, a Python binding for PortAudio (the cross-platform C audio I/O library), is happy to open the device, but many Mac inputs prefer 44.1 or 48 kHz, and Bluetooth headsets change rate when they switch profiles. So the app asks PortAudio for the device's default sample rate and opens a mono float32 stream at that rate, in 250 ms blocks.

The device list is refreshed before every start, and a saved choice that no longer exists falls back to auto, which asks PortAudio for the system default. resolve_input_device maps a combo-box value back to a PortAudio index and returns None when the hardware is gone; open_input_stream then raises a single readable error instead of a stack trace from deep inside PortAudio.

Multi-channel input is reduced by to_mono, which keeps the channel with the highest mean energy. That sounds trivial until you plug in a stereo interface where the microphone is on the right channel and the left one is silent. NumPy, the array library that the whole audio path uses, makes both the energy calculation and the slicing cheap.

audio_input.py • Native Hardware Rate Audio Capture
Python
def to_mono(chunk: np.ndarray) -> np.ndarray:
    """Flatten an audio chunk to a 1D float32 array, picking the hottest channel."""
    arr = np.asarray(chunk, dtype=np.float32)
    if arr.ndim == 1:
        return arr
    if arr.ndim == 2:
        # If stereo, pick the channel with the highest mean squared energy
        energies = np.mean(arr ** 2, axis=0)
        best = int(np.argmax(energies))
        return arr[:, best].copy()
    return arr.reshape(-1)

def open_input_stream(device, callback, block_duration_sec: float = 0.25):
    """Open PortAudio InputStream at the device's native rate to avoid driver resampling bugs."""
    device_info = sd.query_devices(device, "input")
    sr = int(device_info.get("default_samplerate") or 16000)
    blocksize = int(sr * block_duration_sec)
    return sd.InputStream(
        samplerate=sr,
        blocksize=blocksize,
        device=device,
        channels=max(1, int(device_info.get("max_input_channels", 1))),
        dtype="float32",
        callback=callback,
    ), sr

The file CLI skips all of this. It reads the clip with soundfile, a binding to the libsndfile C library, and feeds the samples straight to the same preparation code.

04. Finding the End of a Sentence

A fixed timer is the wrong abstraction for live speech. Cut every three seconds and you cut a word in half; wait for a long silence and the app feels dead. speech_audio.take_speech_phrase instead keeps a small state machine per session: a buffer, a noise floor, a speech-frame counter, and a silence counter.

The detector starts by estimating the room. While nobody is speaking, it nudges the noise floor toward the current RMS with a 95/5 exponential average. The opening threshold is derived from that floor but clamped:

speech_audio.py • Adaptive Phrase Gate with Noise Floor Tracking
Python
open_at = max(0.004, min(ceiling, max(floor * 3.0, 0.004)))
is_speech = rms >= (open_at * 0.5 if speaking else open_at)

# 350 ms rolling pre-roll buffer ensures plosives and word onsets are never clipped
if not speaking:
    state["pre_roll"].append(chunk)
    if is_speech:
        state["speech_frames"] += 1
        if state["speech_frames"] >= int(0.2 / block_duration):
            state["is_speaking"] = True
            state["buffer"].extend(state["pre_roll"])
            state["pre_roll"].clear()

Once speech opens, the threshold drops to half, so a quiet syllable in the middle of a sentence does not close the phrase. To count as the start of speech, the signal has to stay above the line for 0.2 seconds. The buffer always keeps the last 0.35 seconds of pre-speech audio, which is why a word that begins just before the threshold is crossed still makes it into the clip, and why the same window can seed the next phrase.

From there the rule is simple: if the signal stays quiet for 0.7 seconds, or the buffer reaches eight seconds, the phrase is finished. A completed phrase must be at least 0.4 seconds long, otherwise it is discarded as a cough or a door. The 8-second ceiling matters more than it looks: without it, a noisy room or a stuck microphone could grow one buffer forever.

This gate is also the reason silence never reaches the model. Whisper and Phonon will both happily invent a sentence when handed a quiet clip that has been amplified into something speech-shaped.

05. Cleaning the Phrase Before Recognition

prepare_speech_audio runs on the recognition worker, after the phrase is complete. It does four things in order: decide whether there is speech, trim the quiet ends, resample to 16 kHz, and level the volume.

The speech check uses 20 ms frames. If the 90th-percentile frame RMS is below 0.005, or fewer than 15% of frames clear that line, the clip is treated as silence and an empty array is returned. This is stricter than “is the maximum sample loud?” and much less likely to be fooled by a single click.

Trimming is where a lot of Whisper hallucinations are prevented. The code computes per-frame RMS, finds the voiced region above max(quiet * 2.5, 0.006), and keeps it with 0.12 seconds of padding. A quiet tail is exactly where the model likes to add “thank you for watching”.

Resampling uses signal.resample_poly from SciPy, the scientific-computing library, with a Kaiser window. The rational ratio comes from the GCD of the capture rate and 16 kHz, so 48 kHz becomes a clean 3:1 conversion instead of a linear interpolation. The fallback is numpy.interp if SciPy is unavailable, which keeps the app working in a minimal environment.

speech_audio.py • Polyphase Resampling & Click-Resistant Peak Leveling
Python
def _resample_16k(audio: np.ndarray, sample_rate: int) -> np.ndarray:
    if sample_rate == 16000:
        return audio.astype(np.float32)
    divisor = math.gcd(sample_rate, 16000)
    up = 16000 // divisor
    down = sample_rate // divisor
    if signal and hasattr(signal, "resample_poly"):
        # Polyphase Kaiser filter (beta=14.0) prevents spectral aliasing
        return signal.resample_poly(audio, up, down, window=("kaiser", 14.0)).astype(np.float32)
    # Safe fallback if SciPy is not installed
    duration = len(audio) / sample_rate
    target_len = int(round(duration * 16000))
    x_old = np.linspace(0.0, duration, num=len(audio), endpoint=False)
    x_new = np.linspace(0.0, duration, num=target_len, endpoint=False)
    return np.interp(x_new, x_old, audio).astype(np.float32)

def _level(audio: np.ndarray) -> np.ndarray:
    """Bring speech up to 0.95 peak. A single mouse click must not set the gain."""
    magnitude = np.abs(audio)
    peak = float(np.max(magnitude))
    robust_peak = float(np.quantile(magnitude, 0.999))
    if peak < 1e-4:
        return audio
    reference = robust_peak if peak > robust_peak * 4.0 else peak
    gain = min(0.95 / max(reference, 1e-4), 6.0)
    return np.clip(audio * gain, -0.95, 0.95).astype(np.float32)

Finally, _level brings the phrase up to a 0.95 peak. It uses the 99.9th percentile as a reference when the true peak is more than four times larger, so a single spike does not crush the rest of the sentence, and it caps the gain at 6×. The output is clipped to ±0.95.

06. Whisper, with Guard Rails

engine.py loads faster-whisper with a few pragmatic choices: up to eight CPU threads, one worker, and a preference for int8 weights. If the model is already in the Hugging Face cache, the loader tries local_files_only=True first, then a different compute type, and only goes online if neither cached attempt works. That keeps a normal launch offline and makes a fresh machine show a download instead of a confusing failure.

Beam search is size-dependent. beam_size_for returns 5 for tiny, base, small, and any distilled checkpoint, but 1 for medium and large. A full large model spending several seconds on five beams stalls the live window; a distilled model with a single beam tends to mishear words. The rule is a compromise between latency and accuracy, not a universal truth.

transcribe_speech passes a deliberately boring decoding configuration: temperature 0, one best candidate, no VAD (the phrase gate already did that job), no conditioning on previous text, no timestamps. Then it filters segments that look unreliable: no_speech_prob above 0.85, avg_logprob below −1.1, or compression_ratio above 2.4 are dropped.

There is a second filter after decoding. _looks_invented normalizes the text by lowercasing it, stripping accents with Unicode NFKD, and collapsing punctuation to spaces. It then rejects a list of classic captions (“thanks for watching”, “subtitles by”, and their Slovak equivalents), prefixes such as “titulky” or “prelozil”, long runs of dashes, and text where fewer than a third of the words are unique. The accent folding is what lets ďakujem za pozornosť match dakujem za pozornost.

engine.py • Split-Lock Decode Pipeline & Accents Folding Filter
Python
# Accent-folding Unicode NFKD hallucination guard
def _looks_invented(text: str) -> bool:
    folded = unicodedata.normalize("NFKD", text).encode("ascii", "ignore").decode("ascii").lower()
    for phrase in BANNED_HALLUCINATIONS:
        if phrase in folded:
            return True
    words = folded.split()
    if len(words) >= 6 and (len(set(words)) / len(words)) < 0.34:
        return True  # Reject low-entropy hallucinated token loops
    return False

# Split-lock audio recognition and translation
def decode_audio(model, audio, sample_rate, task, translator, model_tag):
    with _RECOGNIZER_LOCK:
        recognize = "transcribe" if task == "translate" and translator is not None else task
        text = recognize_phrase(model, audio, sample_rate, recognize, model_tag)
    if task != "translate" or translator is None:
        return text
    with _TRANSLATOR_LOCK:
        return translate_phrase(translator, text)

The lock layout is worth stating once. Recognition and translation have separate locks. decode_audio first recognizes with the recognizer lock held, releases it, and only then translates with the translator lock. That means one phrase can be translated while the next one is being recognized. The UI still has to preserve spoken order, which is handled by the ordering layer below. If the translator failed to load, task="translate" falls back to Whisper's own translation path, and the footer says so instead of pretending everything is fine.

07. Translating Text Instead of Audio

Whisper can translate directly from audio with task="translate", and the app keeps that as a fallback, but it is not the primary path. The direct task tends to paraphrase: it produces a fluent English sentence that may not be a faithful rendering of the Slovak one. A Slovak transcript passed through MarianMT keeps the sentence structure and the named entities much more predictably.

translator.py splits the transcript on sentence-ending punctuation before translating. A short greeting gets its own tokenized batch instead of being glued to a long clause, which matters because the model has a maximum length and a tendency to merge unrelated ideas. Each sentence is tokenized, generated with max_length=256 under torch.no_grad(), and decoded with special tokens removed. The results are joined with spaces.

The loader checks the Hugging Face cache first and sets local_files_only when the model directory exists. If that path fails, it retries online once. It also silences the two warnings that would otherwise print over a terminal UI: the missing sacremoses recommendation and the unauthenticated-Hub notice.

08. Keeping Parallel Work in Spoken Order

Recognition is slower than the microphone, so two decode workers consume the queue. That immediately creates a race: phrase 2 may finish before phrase 1. Since the log puts each newly released line at the top, publishing results as they arrive would leave phrase 1 above phrase 2, which reads as if the speaker said them in reverse.

ordered_results.py is the smallest and most important piece of the project. OrderedResults.push stores a result by index and releases it only when every earlier index is already present:

ordered_results.py • Thread-Safe Spoken FIFO Ordering
Python
class OrderedResults(Generic[T]):
    def __init__(self):
        self._lock = threading.Lock()
        self._ready: dict[int, T] = {}
        self._next: int = 0

    def push(self, index: int, item: T) -> list[T]:
        with self._lock:
            self._ready[index] = item
            finished = []
            while self._next in self._ready:
                finished.append(self._ready.pop(self._next))
                self._next += 1
            return finished

An empty result counts as a result. That detail prevents a silent phrase from blocking every later line forever. The tests exercise exactly that case, along with the out-of-order arrival that motivated the class.

InFlight is the companion counter. Each phrase increments it before being queued, and each worker decrements it when the job finishes. The stop path waits on its threading.Event for up to 180 seconds after the microphone thread has been joined. Without that wait, pressing Stop would save the transcript while the last translations were still in the queue.

Workers never touch Tk widgets directly. Callbacks are scheduled with root.after (through _publish or _schedule), and lines that can finish out of order are first passed through OrderedResults. Textual uses its own message system and call_from_thread, but the ordering contract is identical.

09. The Phonon Branch

Phonon-2.5 is appealing because it is small (156 MB checkpoint) and because it runs on the Apple GPU through MLX. The checkpoint lives under ~/.cache/mlx_audio/phonon2; phonon_engine treats a directory as usable only when it contains both model.safetensors and config.json, and picks the most recently modified one if there are several.

Two MLX details shape the code. First, the graph is compiled lazily, so warm_phonon feeds the model 8,000 zero samples before the first real phrase. The result is discarded; the point is to pay the Metal (Apple's GPU API) compilation cost during loading, not during the first sentence. Second, MLX streams are thread-bound, so loading and decoding both happen on the same phonon worker thread. The UI only polls a result queue or receives a Textual message.

phonon_engine.py • Apple Silicon MLX GPU Graph Pre-Warming
Python
def warm_phonon(model) -> None:
    """Run an 8,000-sample dummy buffer to force Metal shader compilation upfront."""
    try:
        dummy = mx.zeros((8000,), dtype=mx.float32)
        model.transcribe(dummy)
    except Exception as exc:
        log.warning("Phonon warm-up pass skipped: %s", exc)

Phonon does not open the microphone and rejects an empty waveform, so the same prepare_speech_audio gate runs first. The model returns an object with a .text attribute; transcribe_phonon wraps the samples in mx.array, cleans the text, and reuses _looks_invented from the Whisper path. Recognition is serialized on one worker, which is fine because Phonon is fast and because concurrency would fight the thread affinity anyway.

Translation is where the pipeline becomes parallel again. Once Phonon produces Slovak text, the phrase goes into a translation queue as (index, slovak, model, terms). Two Ollama workers consume that queue and release English through another OrderedResults.

ollama_translate.py talks to http://127.0.0.1:11434/api/chat with a JSON body rather than pulling in an SDK. The request uses temperature 0, a 1,024-token context, a 30-minute keep_alive so the model stays resident between phrases, and a num_predict limit derived from the Slovak word count (24 to 80 tokens). It also sets think: false for model families that would otherwise emit a reasoning block.

The system prompt is intentionally narrow: translate the Slovak speech, reply with the English translation only, and keep any user-supplied names and terms exactly as written. The UI defaults to Bratislava, Košice because place names are a common place for a translation model to improvise.

Phonon Slovak Translator Tkinter GUI with Live Slovak and English Line Matching
Figure 1: app_phonon.py desktop interface running Phonon-2.5 on Apple Silicon GPU and Ollama translategemma:latest, with Slovak lines matched directly with English lines.

10. Four Front Ends, One Rulebook

ui_common.py holds the colors, the mode names, the mode-to-task mapping, and ActionButton for the Tk windows. The button is not a ttk.Button. On macOS a themed button can lose the click when a leave event or a combobox grab clears its pressed state before mouse-up, so ActionButton is a tk.Label that runs its command on <ButtonPress-1> and debounces repeat invocations to 0.3 seconds.

Both Tk windows share the same layout: a mode selector, a model or Ollama selector, a microphone picker, a volume meter, Start/Stop, and a scrolled transcript. Both terminal windows use Textual's Header, Footer, Select, and RichLog; the Phonon version adds an Input for glossary terms. The stylesheet hides the header, footer, and meter on short terminals.

Slovak Audio Suite Textual Terminal UI with Whisper Model
Figure 2A: app_textual.py • Terminal UI running faster-whisper + MarianMT with VU-meter and bilingual transcript.
Phonon Slovak Translator Textual Terminal UI with Ollama
Figure 2B: app_textual_phonon.py • Terminal UI running Phonon-2.5 MLX + Ollama with glossary term preserving inputs.

The log itself is newest-first. In the Tk windows, new text is inserted at "1.0": app.py goes through safe_write_text, and the Phonon window through _write. In Textual, _order.insert(0, ...) puts the newest row at the head of the list and _redraw rebuilds the RichLog. The Phonon windows and the Textual Whisper window show the Slovak line as soon as recognition finishes; the Tk Whisper window shows only the selected mode's line. Where both languages are shown, English sits underneath its Slovak sentence. The Tk Phonon window does this with a Tk mark named phrase_<index> and left gravity; if English arrives before the Slovak line, _pending_english holds it until the mark exists. The Textual windows keep rows in a dictionary and append the English line to the row.

Terminal apps have one extra problem: Textual draws through the real terminal, not sys.stdout, while libraries such as Hugging Face's Transformers can print progress. Both Textual apps replace sys.stdout and sys.stderr with a _Quiet object on mount and restore them on unmount, so a download bar cannot erase the screen.

11. Why the Start Button Needed Objective-C

The macOS click fixes in click_macos.py are the least portable and most necessary code in the repository. Python launched from an IDE or a script is often an accessory process, so Cocoa, Apple's application framework, never makes its window key and throws away the click that should have activated it. Tk 8.6 also leaves acceptsFirstMouse: off, and it sets mouseInResizeArea on pointer enter, after which left clicks are discarded while hover still works.

The fix uses PyObjC, the Python bridge to Objective-C frameworks, plus ctypes, Python's standard foreign-function interface, to swizzle Tk's tkProcessMouseEvent: method. The replacement checks for a left mouse-down, clears setMouseInResizeArea:, and, if the app is not active, converts the event location to screen coordinates and queues the click through root.after. _queue_click_at finds the widget under the pointer, walks up to an ActionButton, and invokes it. The original implementation is always called afterward, so normal Tk behavior is preserved.

click_macos.py • Objective-C tkProcessMouseEvent Swizzling
Python
def swizzle_tk_mouse_event(root) -> bool:
    """Swizzle Tk's tkProcessMouseEvent: to unstick mouseInResizeArea and deliver first-clicks."""
    try:
        from Foundation import NSClassFromString
        from objc import selector

        cls = NSClassFromString("TKApplication")
        if cls is None:
            return False

        orig = cls.tkProcessMouseEvent_

        def replacement(self, event):
            event_type = event.type()
            # LeftMouseDown = 1
            if event_type == 1:
                window = event.window()
                if window is not None and hasattr(window, "setMouseInResizeArea_"):
                    window.setMouseInResizeArea_(False)
                app = NSApplication.sharedApplication()
                if not app.isActive():
                    _queue_click_at(root, event)
            return orig(self, event)

        cls.tkProcessMouseEvent_ = selector(replacement, selector=orig.selector, signature=orig.signature)
        return True
    except Exception as exc:
        log.warning("Cocoa swizzle skipped: %s", exc)
        return False

The module also patches the procedures behind the combobox popdown with Tcl, the scripting language underneath Tk, because a grab that survives after the popup closes swallows the next click. release_dead_grabs runs on every left press and again every 400 ms, releasing grabs held by menus or invisible widgets. Editing that layer was not something I expected to do for a speech app, but here we are.

12. Saving the Session

session_log.py writes a UTF-8 file into transcripts/ only when the window contains at least one [English] or [Slovak] line. The name is transcript_YYYYMMDD-HHMMSS.txt, with a numeric suffix if two sessions start in the same second. A session that only contains system messages is not saved, because an empty log is worse than no log.

The file mirrors what the window shows, with no separate reordering step. The transcript directory is created on demand, so a fresh clone does not need an empty placeholder.

13. Shipping It & Standalone Packaging

app.spec is a PyInstaller spec, PyInstaller being the tool that packages a Python program and its dependencies into a standalone application. It collects faster-whisper's data files, CTranslate2's dynamic libraries, the Transformers package, and the icon, then produces a SlovakAudioSuite bundle. The spec targets app.py; the terminal and Phonon variants are run from source.

The important constraint is the usual one: build on the platform you intend to ship. PyInstaller does not cross-compile a macOS app from Linux. Model weights are not bundled; the first launch of a given size downloads them, and later launches stay on disk. That keeps the installer small and makes the first-run message (“downloading speech and translation weights”) an honest one.

14. Unit Tests Without Live Audio

The suite uses unittest, Python's standard testing framework, so there is no pytest dependency. The tests are mostly about logic rather than model quality: synthetic tones and hiss exercise the phrase gate, a one-sample spike checks the gain calculation, and a fake Whisper segment checks that a hallucinated caption is dropped. OrderedResults is tested with deliberately reversed indices, and InFlight is tested by having one thread wait while another finishes jobs.

The window tests create a withdrawn Tk root and patch root.after to collect callbacks, which makes it possible to assert insertion order without a visible window or a real microphone. The Textual tests use its test harness to press buttons and inspect the transcript. The Phonon tests fake the model and assert that loading happens on the same thread that later decodes. None of these need a live model or a working microphone.

15. Closing & Technical References

The interesting part of this project was not picking a model. It was building the boring machinery around it: a microphone path that respects the hardware, a phrase gate that knows when a sentence ends, a set of filters that refuse to print invented captions, and an ordering layer that keeps concurrent work honest. The two engines share that machinery, which is why adding Phonon did not require rewriting the app four times.

Audio & Numerics

Speech Recognition & MLX

Translation & Local LLMs

Interfaces & Platform

Explore the Full Architecture & Repository

Inspect the visual topology diagrams, interactive screenshot gallery, and multi-threaded worker queues on the companion project showcase.


Félix Pupo Pérez

Félix Pupo Pérez

Senior AI & Embedded Systems Architect

Over 20 years of experience building bare-metal firmware, real-time audio and speech pipelines, industrial IoT telemetries, and grounded AI systems.