The developer of Earu, a desktop video player for second-language listening practice, shares the key design decisions behind its core features. Source: dev.to.
Origins in Family Practice
Earu began as a tool to help the developer’s children practice listening to videos they already enjoyed. No textbooks were involved. Instead, the process was simple: loop a line, reorder the words, read aloud, and retest missed words after a few days.
The goal was clear: listening and speaking are the fastest paths to fluency. Without sufficient input, learners cannot produce spoken language. Many can read subtitles but still struggle to hear sentences. Earu turns casual viewing into active listening practice.
There is no fixed curriculum. The app adapts to the user’s interests. It only asks about the video the user selects. This makes learning feel personal and relevant.
Subtitles: Covered, Not Hidden
The first major design choice: subtitles in the target language are covered by default. Native-language subtitles remain visible.
Each subtitle layer has three states: shown, hidden, covered. The term ‘covered’ is intentional. A covered subtitle appears blurred, forming a soft fog that preserves the original layout. The width and line count stay unchanged, preventing visual jumps.
When the user moves the mouse over a covered subtitle, the fog parts. When the cursor stops, the fog retracts after about one-third of a second. This allows users to glance briefly without interrupting their listening flow.
During exercises, the target-language subtitle is always covered. Hovering does not reveal it. A deliberate click counts as a hint. Annotations like [music] are never covered.
Implementation Evolution
The original version used individual radial gradients for each mouse movement. A fast swipe created over a hundred gradient layers per element. Each was repainted at full size every frame, causing performance issues.
The fix: composite all mouse movements into a single small alpha bitmap per frame. This bitmap is stretched over the subtitle element. The cost per gust remains stable as font size scales.
Each frame uses the following steps:
- Generate a small grid mask, sized at approximately element width divided by (0.16 × font height).
- For each mouse ‘gust’, stamp a soft circle into the alpha grid.
- Set the blurred layer’s mask to ‘everything minus the gusts’.
- Set the clone layer’s mask to ‘only the gusts’.
WebKit engines load mask images asynchronously. Swapping masks every frame caused flickering. The solution: decode the next mask off-screen first. In unsupported environments, it falls back to gradients.
This approach significantly reduces computational load. Instead of creating hundreds of individual gradient layers, the system now performs a single compositing operation per frame. This ensures consistent performance across different text sizes and screen resolutions. The use of a pre-composed mask allows the browser to render the effect efficiently, even on older devices with limited GPU capabilities.
The developer tested this implementation on a range of devices, from older laptops to modern desktops. This improvement was critical for maintaining a smooth user experience during extended listening sessions.
Re-timing Subtitles Against Audio
Subtitles one or two seconds off are unusable. Many video files suffer from timing mismatches. Earu addresses this by analyzing the audio itself.
A voice-activity model runs in a Web Worker on 16 kHz mono audio blocks of 32 ms. It outputs a ‘someone is speaking’ probability for each block. Subtitle cues also serve as speech/no-speech signals.

The system finds the best-fit line: real_time = k × subtitle_time + b. This line aligns the audio and subtitle signals.
Key reliability choices:
- Scale factor only tries values near common frame-rate mismatches (e.g., 23.976 vs 24, 23.976 vs 25 and their inverses).
- Offset search is limited to about 10 seconds, with coarse and fine steps.
- The result must agree with itself across multiple checks.
The video is split into up to five segments. Each segment’s timing must be within a quarter-second of the global line. Otherwise, the result is discarded.
For clips under ten minutes, only the offset is fitted. Short clips produce fake scale values. Corrections under 0.15 to 0.2 seconds are ignored.
Tests on two real episodes showed that correct subtitles correlated with the audio at approximately 0.5, while subtitles from the wrong episode correlated at below 0.1; these thresholds are based on that gap.
When confident, the player applies the corrected timing and shows a small icon indicating the maximum shift. Clicking it restores the original timing. This prevents automatic fixes from becoming uncorrectable bugs.
Exercise Design: Sort and Dictation
Sort: Pre-placing Word Blocks
Sort splits a sentence into word blocks and asks users to reorder them. Long sentences are difficult to hear fully. So, some blocks are pre-placed.
On default difficulty, up to eight words get no placement. For each additional two words, one more block is placed.
Which blocks are pre-placed matters more than how many. Priority order:
- First and last words (anchors).
- Names (audible but hard to guess).
- Words rarer than the user’s difficulty level, rarest first (requires a word-frequency table).
- Remaining words, spread evenly by picking the farthest from already chosen.
The same sentence at the same difficulty level always has the same pre-placed words—even after ‘shuffle again’. This ensures consistency.
The shuffle uses a Fisher-Yates algorithm with one rule: if the shuffle lands on the correct order, swap the first two blocks. This ensures a two-word sentence always appears reversed.
Correctness is checked by word text, not by block identity. So if two ‘the’s appear, either can go in either slot.
Sort and Dictation share the same pre-placement code. A previous version showed different fixed words in both exercises. That felt wrong. Now, both exercises use the same pre-placed word set.
Dictation: Strict Spelling, Lenient Formatting
Dictation presents one box per word. Users type and press Enter. The system judges all at once.
Spelling is strict. Formatting is lenient:

- Case does not matter.
- Curly and straight apostrophes are treated as the same.
- Numbers match in either form.
- Adjacent number words like ‘twenty five’ merge into one box accepting both ’25’ and spelled-out versions.
- Sequences like ‘one two three’ are not merged—this is counting, not a number.
- A lone ‘hundred’ is not treated as a number.
Spanish has special rules: 1.000 equals 1000. Missing accents are accepted but marked yellow with the correct spelling. Wrong accents or missing ñ are errors.
The word boxes come from the same tokenizer used in scoring. This ensures the box count never exceeds the actual word count.
Read-Aloud: Scored by Word, Not by Sentence
Users listen to a line and then read it into the microphone. The system compares each word to the original.
Words return as green or red. The score is the percentage of correctly scored words, rounded down.
Some words are skipped: names and a short list of throwaway words. Recognizers often fail on these.
The default pass mark is 85. It can be adjusted between 70 and 100. The UI does not compute whether a user passed. It only receives the verdict and per-word results. This prevents the screen and scoring from drifting apart.
If a user misses the same sentence five times in a row, the app offers a new one. Silent or near-silent recordings are not counted as attempts.
Design Constraints and What Was Given Up
Points exist to give daily practice meaning. Each sentence has a difficulty level from L0 to L5.
L0 sentences contain only interjections, forms of address, or one- or two-word lines. Correct answers score zero. This prevents users from exploiting simple lines for points.
Instead of relying on AI to judge content, the developer implemented a rule-based system. When asked twice, the AI disagreed with itself, making it unsuitable for scoring.
Other limits include:
- Same sentence scored only once every 15 days across Sort and Dictation.
- Very fast answers are not counted.
- Short sentences are capped per day.
AI is not used to generate definitions. If a word is missing, the card says so. A missing entry is better than a wrong one that enters a user’s notebook.
These constraints ensure that practice remains meaningful and not easily gamed. For example, the 15-day cap prevents users from repeatedly practicing the same sentence to accumulate points, while the cap on short sentences avoids overloading users with low-value content.
Translation and Language Support
Native-language subtitles are generated by AI translation. Without safeguards, every user opening a popular video would repeat the same translation work.
Translation is keyed by a SHA-256 fingerprint of normalized subtitle lines. The client checks if a translation exists. If so, it uses it. Otherwise, it uploads the subtitle text (not the video) and polls for a result.
The fingerprint is versioned by changes to sentence-merging rules. When such rules change, old fingerprints can be computed. This preserves translations for unchanged sentences.

Files on cloud drives and home media libraries use a file fingerprint: a hash of file size and first 64 KB.
Feature names like Sort, Dictation, and Daily Quiz appear in many strings.
To avoid rework, there is now a single table of feature names. Each row corresponds to a language. All strings reference a tokenized name.
Locale files are loaded with a token substitution layer. Downstream code sees a normal string. A lint script fails the build if any locale file spells a feature name directly. A small allow-list permits names that look similar.
Languages with case or articles (e.g., German, French, Russian) include multiple forms—lowercase, past participle—of feature names. Renaming a feature requires only one row edit.
Static pages like the privacy policy cannot use tokens. A snapshot test identifies which ones need manual updates.
Why a Desktop App?
The first prototype ran in a browser tab. The developer wanted to play videos from a home NAS. Two issues arose:
- The page used HTTPS, while most NAS endpoints used plain HTTP. Browsers blocked this as mixed content.
- The NAS sent no cross-origin permissions, adding a second block.
Earu is now a desktop app for Windows and macOS. The architecture is intentionally thin. The Electron shell loads the web app and injects a small bridge object for native functions.
The web app treats the bridge as optional. If a method is missing, the feature is simply unavailable—no crash occurs. Rules for different builds are centralized in one field, not scattered across components.
This means interface updates can be deployed as normal web updates. Users don’t need to reinstall.
The desktop app model allows for greater control over file access and media playback. It also enables direct integration with local storage, ensuring that videos remain on the user’s device and are not uploaded to servers. This is especially important for privacy-conscious users or those with limited internet access.
What Was Given Up
Earu has no fixed curriculum. Ordering lessons from easy to hard may seem systematic, but it’s not feasible. Users must be willing to rewatch content. Earu only uses videos they already like.
CEFR levels were initially assigned based on speech rate. A picture book was rated C1, a 200-word-per-minute video as A2—opposite of real-world expectations. The developer replaced it with three coarse levels based on speech rate, tuned against blind ratings.
Earu plays videos from a built-in library, the user’s computer, cloud drives, and home media servers. Files stay on the user’s device. English is the most complete language.
The developer invites feedback, especially on areas where the app feels off. This iterative approach ensures that the product evolves in response to real user needs and behaviors.
Sources & further reading
Featured image: original publisher image. Via original publisher. Image source
