Blog · · 4 min read

DRAFT: not reviewed yet. Hidden from search engines and the sitemap until draft: false.

How AI follows Quran recitation word by word (and why it runs on your phone)

You open the mushaf, start reciting, and the word you are on lights up. Turn the page in your head and the screen turns with you. Start in the middle of Surah Al-Kahf with the app showing Al-Fatiha, and a few words later it has found you. That is what a Quran recitation tracker does. This post explains how ours works, in recite.nabilmh.com and in the Naml tracker code, and why none of it needs a server.

Two jobs: hear, then place

A tracker does two separate things.

  1. Hear. A speech model turns audio into symbols: letters, or the phonetic units of tajweed. It does not know where in the Quran you are; it only writes down what it heard, a fraction of a second after you said it.
  2. Place. A tracker compares that stream of symbols with the text of the Quran and decides which word you are on. This is where the Quran helps: unlike general dictation, the text is known in advance. The question is never "what did they say?" but "where in these 6,236 ayahs are they?".

Keeping the two apart is what makes the system small. The model does not have to be a perfect transcriber, because the tracker only needs enough evidence to tell one place from another.

Hearing: a streaming model

Our models (Naml Tajweed, Naml Letters and Naml Letters Plus) are streaming FastConformer models. Every 0.32 seconds they take the newest slice of audio, look 0.16 seconds ahead, and emit what they heard. They remember the last 5.6 seconds of context in a cache, so each step only computes the new part.

You can watch this happen on the model demo: three rows of output growing as the recording plays, with the time each step took. On one server CPU core a step takes about 15 ms out of its 320 ms budget. On a budget Android phone it is about 18 ms, which is roughly 6% of real time. That headroom is the reason it can run in a browser tab while the phone does everything else.

Naml Tajweed, the default, does not output plain letters. It outputs 77 tajweed phoneme units: a madd of 2, 4 or 6 counts, a doubled consonant for shadda, the nasal sounds of ghunna, ikhfa and iqlab. Those units match how the Quran is actually recited, which helps the tracker and makes tajweed feedback possible later (how the units work).

Placing: alignment, search and page turns

The tracker keeps a window of recent symbols and aligns it against the expected text around your current position. If the alignment is strong, the cursor moves forward word by word. If it weakens (you paused, coughed, repeated an ayah, or jumped), it widens the search. In Search mode it looks through the whole Quran from your first words.

A few behaviours matter in practice:

The tracker demo replays all of this from a phone recording of Al-Mulk: you can see the cursor lock on in the first seconds and follow to the end of the page.

Why on the phone, not in the cloud

Sending recitation to a server works, and many apps do it. Running it on the device is better in four ways.

The cost of on-device is size: the model has to be small. Ours store each weight in 2 bits (−1, 0 or +1 times a scale), so a model is about 17 MB (why ternary works). They run on a hand-written WebAssembly SIMD core rather than a general runtime (WebAssembly vs WebGPU).

What it still gets wrong

Honesty about limits matters more than a demo.

Try it

Open recite.nabilmh.com, press Start and recite from anywhere. If you are building an app, the models are free under CC BY 4.0 and the tracker code that runs the site is for sale.