TajweedFormer

A speech model Quran Lab is building to hear tajweed: the sound made, where it was made, how long it was held, and how it was coloured.

Status In training. Not released.

وَلَا ٱلضَّآلِّينَ

wa-laḍ-ḍāllīn from al-Fātiḥah 1:7
The last words of al-Fātiḥah, counted as a teacher counts them, right to left with the script. The ḍā before the doubled lām holds six counts. When the reciter stops, the lī may be held for two, four or six, and all three are correct. The alif of lā is written but not lengthened, because the next word begins with a letter at rest: its lām has merged into the ḍād.

Four things a teacher listens for

A teacher of tajweed hears four things in every letter, almost at once. TajweedFormer is being built to listen for the same four, from a phone's microphone, while the reciter is still reading. It is meant to describe what it heard against what the text and its rules allow, including both ways where the tradition allows two. It is not meant to invent mistakes, and it is not a teacher.

Which sound الحرف والحركة al-ḥarf wal-ḥarakah

Was it ṣād or sīn, ḍād or ẓāʾ, a fatḥah or a kasrah? A letter said in the wrong way can become another letter, and the meaning of the word can change with it.

The sound-identity output names each sound as it is spoken.

Where it was made المخرج al-makhraj

Each letter has one place in the throat, tongue, lips or nose. Two letters that sound close to an untrained ear, like the two hāʾ letters, come from different places.

There is no separate output for place: a letter made in the wrong place is a different sound, and the sound-identity output hears it as one.

How long it was held المد والغنة al-madd wal-ghunnah

Madd is counted in ḥarakāt, and so is the ghunnah of a doubled nun or mim. The count is relative to the reciter: what matters is whether six was six against that same reciter's two.

A timing output marks where each sound starts and how long it lasts, so lengths are measured, not guessed.

How it was coloured الصفات aṣ-ṣifāt

Heavy or light, whispered or voiced, with or without ghunnah, with or without the rebound of qalqalah. These qualities complete the letter once its place is right.

Letter-attribute outputs report ghunnah, qalqalah, tafkhīm and tarqīq, and the other qualities.

Where each letter is made

Ibn al-Jazari (died 833 AH, 1429 CE), the master of the readings, opens his short poem on tajweed with the places of articulation, the makhārij. He counts seventeen, in five regions, and every one of the twenty-nine letters belongs to exactly one of them. A reciter who puts a letter in the wrong place has made a different letter. Choose a letter to see its place, the posture of the tongue and lips, and its qualities, the ṣifāt.

Section of the head in profile, facing left The nasal passage, palate, tongue, teeth, lips and throat, with the seventeen points of articulation of Ibn al-Jazari marked. The selected point is shown in red.

qāf

Place 5 of 17, in al-lisān, the tongue

أقصى اللسان aqṣā al-lisān. The back of the tongue against the soft palate above it. Qaf is made deepest, close to the throat.

Qualities

  • jahr voiced
  • shiddah strong
  • istiʿlāʾ raised
  • infitāḥ open
  • iṣmāt restrained
  • qalqalah echo

Weight. Always heavy (tafkhīm).

Show the letters that are

 

The seventeen places, from the chest to the lips

  1. الجوف al-jawf, the open space of the mouth and throat

  2. الحلق al-ḥalq, the throat

  3. اللسان al-lisān, the tongue

  4. الشفتان ash-shafatān, the two lips

  5. الخيشوم al-khayshūm, the nasal passage

Nun and mim have two places: the body of the letter where the tongue or lips close, and its ghunnah in the khayshum, place 17. Waw and ya are made at the lips and the middle of the tongue as consonants, and in the jawf as letters of madd.

How long a sound is held

Madd is lengthening. Its unit is the count, a ḥarakah, the time of one short vowel. Each kind of madd has the lengths it allows, and those lengths are fixed in counts, not in seconds: a slow reciter's six counts last longer than a quick reciter's six. Where the tradition transmits more than one length, every one of them is correct.

Each row is one kind of madd; each bar is one permitted length, read right to left. A dashed bar is permitted only under a condition, given beside it when you choose the row.

Madd ʿāriḍ lis-sukūn

المد العارض للسكون, for a stop

Cause. A letter of madd before the last letter of a word, when the reciter stops on that word.

ٱلْحَمْدُ لِلَّهِ رَبِّ ٱلْعَٰلَمِينَ

al-ḥamdu lillāhi rabbi l-ʿālamīn al-Fātiḥah 1:2

The sukun exists only because of the stop. Read on without stopping and this is a plain two-count madd. At the stop, two, four and six are all transmitted.

 

Draws the longest permitted length at the pace you chose.

Nun and mim at rest

A nun with sukun, and the tanwīn that sounds like one, changes with the letter that follows it. Al-Jazari gives four outcomes: iẓhār, idghām, iqlāb, ikhfāʾ. Mim with sukun has three of its own. What a listener has to hear is small: whether the tongue closed, whether the lips closed, and whether sound went through the nose.

Choose the letter that comes next.

nūn sākinah, then bāʾ

iqlāb

 

Nūn sākinah and tanwīn

iẓhār إظهار

No added ghunnah, before

ء ه ع ح غ خ

Before the six letters of the throat, the nun is said plainly, with no added ghunnah.

صِرَٰطَ ٱلَّذِينَ أَنْعَمْتَ عَلَيْهِمْ

ṣirāṭa lladhīna anʿamta ʿalayhim from al-Fātiḥah 1:7

idghām with ghunnah إدغام بغنة

With ghunnah, before

ي ن م و

Before the four letters of yanmū, the nun merges into the next letter and its ghunnah is held. Inside a single word, as in dunyā, the nun stays clear.

فَمَن يَعْمَلْ مِثْقَالَ

fa-may-yaʿmal mithqāla from az-Zalzalah 99:7

تَرْمِيهِم بِحِجَارَةٍ مِّن سِجِّيلٍ

tarmīhim bi-ḥijāratim-min sijjīl al-Fīl 105:4

idghām without ghunnah إدغام بلا غنة

No added ghunnah, before

ل ر

Before lām and rāʾ, the nun disappears completely into the next letter, which is doubled.

وَلَمْ يَكُن لَّهُۥ كُفُوًا

wa-lam yakul-lahū kufuwan from al-Ikhlāṣ 112:4

iqlāb إقلاب

With ghunnah, before

ب

Before bāʾ, the nun turns into a mim, with its ghunnah, the lips closing lightly.

مِنۢ بَعْدِ مِيثَٰقِهِۦ

mim-baʿdi mīthāqihī from al-Baqarah 2:27

لَنَسْفَعًۢا بِٱلنَّاصِيَةِ

la-nasfaʿam-bin-nāṣiyah from al-ʿAlaq 96:15

ikhfāʾ إخفاء

With ghunnah, before

ت ث ج د ذ ز س ش ص ض ط ظ ف ق ك

Before the remaining fifteen letters, the nun is neither said plainly nor merged: the tongue does not close for it, and the sound passes through the nose while the mouth prepares the next letter.

إِنَّآ أَنزَلْنَٰهُ

innā anzalnāhu from al-Qadr 97:1

Mīm sākinah

ikhfāʾ shafawī إخفاء شفوي

With ghunnah, before

ب

Before bāʾ, the mim is hidden with ghunnah. Al-Jazari records this as the choice of the masters of performance.

تَرْمِيهِم بِحِجَارَةٍ

tarmīhim bi-ḥijāratin from al-Fīl 105:4

idghām shafawī إدغام شفوي

With ghunnah, before

م

Before another mim, the two merge into one doubled mim with ghunnah.

ٱلَّذِىٓ أَطْعَمَهُم مِّن جُوعٍ

aṭʿamahum-min jūʿ from Quraysh 106:4

iẓhār shafawī إظهار شفوي

No added ghunnah, before every other letter

Before every other letter, the mim is said plainly. Al-Jazari warns to keep it clear before wāw and fāʾ, where it is easiest to lose.

لَمْ يَلِدْ وَلَمْ يُولَدْ

lam yalid wa-lam yūlad al-Ikhlāṣ 112:3

Qalqalah, the echo

Five letters, gathered in the phrase quṭbu jad: ق ط ب ج د. Each is made by closing the mouth completely and then releasing it. When one of them carries sukun, the release is still heard as a small rebound, without a vowel after it. In the middle of a reading it is light. At a stop it is fuller, because the letter is the last sound the listener hears.

The rebound is short, and it is easy to hear a vowel that is not there or miss a rebound that is. This is one of the sounds the model is being trained to report directly from the audio.

لَمْ يَلِدْ وَلَمْ يُولَدْ

lam yalid wa-lam yūlad al-Ikhlāṣ 112:3

In the middle: the dāl of yalid, with the reading continuing.

قُلْ أَعُوذُ بِرَبِّ ٱلْفَلَقِ

qul aʿūdhu bi-rabbi l-falaq al-Falaq 113:1

At a stop: the qāf of al-falaq.

Sketch of loudness over time for a vowel, a closure, and the release of a qalqalah letter vowelclosurerelease
A sketch, read right to left: the vowel, the silence while the mouth is shut, then the short release that is the qalqalah.

Why this is hard for a machine

Two answers can both be right

The separated madd may be four counts or five. A stop on al-ʿālamīn may hold the yāʾ for two, four or six. A model that learns one canonical answer will mark correct reciters wrong. So the target for every such place is the whole set of transmitted faces, and the report names the face it heard.

The stop changes the rule

Read on from al-ʿālamīn into the next ayah and the final nun keeps its vowel and the madd before it is two counts. Stop there and the vowel goes, and the madd may grow. The rule depends on where this reciter chose to pause, which can only be known from the audio. A pause to breathe is not a mistake.

ٱلْحَمْدُ لِلَّهِ رَبِّ ٱلْعَٰلَمِينَ

al-ḥamdu lillāhi rabbi l-ʿālamīn al-Fātiḥah 1:2

Time arrives in 20 ms frames

The model hears audio as a stream of frames, each twenty milliseconds long. A count is not a fixed number of frames: at a pace of 0.4 s per count it is twenty frames, at 0.25 s it is about twelve. Lengths have to be measured against the same reciter's short vowels and natural madd, in the same breath.

Children, and phone microphones

The people who most need feedback are learners, many of them children, reciting into a phone in an ordinary room. Their voices are higher, rooms echo, and the sounds that decide a rule, a short release or a trace of nasal sound, are among the quietest in the recitation.

How it is being built

TajweedFormer is a streaming model: it reads the recitation in short pieces as they arrive, so it can answer while the reciter is still on the word. It is designed to run on the phone itself, in real time. Its encoder is a Zipformer, whose middle layers work at a slower frame rate than its outer ones; its authors designed it to be faster and lighter on memory than the encoders before it. On top of the encoder sit several small outputs, one for each kind of listening.

It reports the sounds it heard. Those sounds are then compared with the text, and with every face the rules allow at each place, so that a permitted reading is never reported as a mistake.

  1. Audio, in short pieces

    The microphone signal, cut into chunks and into frames of 20 ms.

  2. Zipformer encoder

    Six stacks; the middle ones see fewer, coarser frames, then the rate rises again.

  3. Outputs

    • Sound which phoneme, frame by frame
    • Timing where each sound starts and how long it lasts
    • Letter attributes ghunnah, qalqalah, tafkhīm and tarqīq, the ṣifāt
  4. The text and its rules

    Outside the model: the ayah being read, every face transmitted at each place, and the reciter's own stops.

  5. What was heard

    A description per place, with the face chosen, or a plain "unsure".

What it will report, and what it will not

It is being built to report

  • The sounds it heard, in order.

    As they were spoken, not as they are written.

  • What it heard at each rule, beside what the rules allow.

    For example: four counts were held here; two, four and six are all transmitted.

  • Which permitted face the reciter chose.

    Where the tradition allows more than one, naming the one heard is the answer.

  • Unsure, when the audio does not settle it.

    A phone in a noisy room will sometimes not carry enough sound to decide.

It will not report

  • A grade for the person.

    It describes a recitation. It does not score the reciter.

  • A permitted face as a mistake.

    Every transmitted length and reading at a place counts as correct.

  • A pause for breath as a mistake.

    The stop is described under the rules for stopping, and the reading continues from there.

  • A mistake it did not hear.

    Nothing is reported from the text alone.

  • What cannot be heard.

    Ishmām, the rounding of the lips without sound, is not judged from audio.

Tajweed is taken from a teacher, who took it from a teacher, back to the Prophet, peace be upon him. A model can help a learner hear their own recitation more clearly between lessons. It does not replace the one who teaches it.