MFA Quran Hafs

Forced alignment for recitation in the riwaya of Hafs. It times every phone of an ayah against its text, so madd, ghunnah and qalqalah can be measured, not only word boundaries.

Task
Forced alignment
Riwaya
Hafs 'an 'Asim
Phones
67, one per articulation
Dictionary
20,967 entries, phonetized from whole ayat
Rule index
93,430 tajweed positions
Training audio
About 110 hours, balanced by style, 40 of them mujawwad
Built with
Montreal Forced Aligner 3.4
Licence
Apache-2.0, open download

See it work

Al-Fatiha with its words and sounds drawn to scale on one time axis. A madd is as wide as it was held.

Word and sound timing Al-Fatiha 1 · 6.40 s
words
sounds
بِسمِللَااهِررَحمَاانِررَحِۦۦم

Why recitation needs its own aligner

General Arabic aligners fail on recitation. Madd vowels held for seconds, ghunnah, the melody of mujawwad and the reverberation of a mosque are far outside ordinary speech. This model was trained and measured on exactly those.

Two choices matter most. The dictionary phonetizes each ayah as a whole, with the joined forms and the idgham, ikhfa and iqlab that cross word boundaries; forms taken from isolated words measure 20.5% phone error, contextual ones 1.6%. And every articulation is one phone: a long vowel of any prescribed length is a single symbol, not a repeated one, which an aligner of this kind handles badly.

The training audio is balanced by style: ayah clips from QUL reciters checked against a human word count, extra examples of lazim and muttasil madd, and 40 hours of mujawwad. A corpus five times larger but unbalanced made mujawwad coverage worse, and a mujawwad-only model did worse than this one.

Measured

From the model card.

MeasureResult
Phone boundaries against landmarks in the signal (533 geminate stop releases, 4 reciters including mujawwad)10 to 20 ms median
Speech covered by no phone, murattal, reciters held out0.0 to 0.4%
Speech covered by no phone, mujawwad, a reciter held out5.0%
Madd length against the prescription, tempo-normalized: natural (2) and munfasil (4)2.1 / 4.8
Word boundary on a human-labelled mujawwad elongationwithin about 100 ms

Use it

One 16 kHz mono wav and one .lab file per ayah clip. The .lab holds the Uthmani text of the ayah in whole words; the dictionary does the phonetization.

Shell
mfa align CORPUS_DIR quran_hafs.dict quran_hafs_acoustic.zip OUT_DIR \
  --beam 40 --retry_beam 160

Keep every path in plain ASCII: OpenFST on Windows fails on other characters.

FileWhat it is
quran_hafs_acoustic.zipThe MFA acoustic model
quran_hafs.dictPronunciation dictionary, 20,967 contextual entries
tokens.txtPhone symbol table, 67 phones and a blank, for CTC integrations
rule_index.jsonlTajweed rule annotations per ayah: 93,430 positions, each with its governing rule and prescribed length

Measuring tajweed with it

  1. 1

    QUL's word timings start about 245 ms early against the physical start of the sound, a playback convention. Compare against landmarks in the signal instead.

  2. 2

    Trust spans that begin and end on obstruents. Boundaries inside a run of sonorants are less certain, so measure a rule's segment between obstruent anchors.

  3. 3

    Before a pause, breath and the decay of the room attach to the last phone. Trim the end of a madd by energy and voicing before measuring it.

Known limits

Measured, not hypothetical. From the model card.

  1. 1

    Hafs only.

    The phonetizer supports no other riwaya. Aligning Warsh or Qalun audio with it would mislabel exactly the features tajweed cares about.

  2. 2

    A stop in the middle of an ayah is not modelled.

    The Uthmani text carries no waqf marks, and a reciter who stops mid-ayah uses pausal forms the dictionary does not offer.

  3. 3

    Some sung sound counts as silence.

    In mujawwad, about 5% of the voice, mostly the fading end before a breath, is attributed to silence. Use trims on the signal side for duration work there.