Cairo-TTS · كايرو
Fast Egyptian Arabic text-to-speech with English code-switching, live streaming and zero-shot voice cloning.
It runs on CPU or GPU, starts speaking in under 100 ms on a GPU, and includes 20 preset voices and a web studio.
Install · Python · Web studio · Colab · Space · Pronunciation · Preprocessing · Parameters
from cairo_tts import CairoTTS
tts = CairoTTS.from_pretrained() # downloads mohammedaly22/Cairo-TTS, runs on CPU
tts.save("ال meeting بكره الصبح بدري, ف يا ريت متتأخرش.", "out.wav", voice="malak")
✨ Features
| 🗣️ Egyptian Arabic | Trained on about 747 hours of Egyptian podcast speech. It reads everyday عامية naturally. |
| 🔀 Code-switching | English words inside Arabic sentences: «ال deadline بتاع ال project». |
| 🎙️ Zero-shot cloning | Clone any voice from a 5–10 s recording, or use one of the 20 preset voices (10 male, 10 female). |
| ⚡ Streaming | Audio comes out in 80 ms frames while it is generated: about 80 ms to first audio on a GPU. |
| 💻 CPU or GPU | About 100M parameters, faster than real time on a laptop CPU, with optional int8. |
| 🔢 Egyptian text frontend | Numbers, dates, times, money, %, phone numbers, emails, URLs, hashtags and acronyms are read the Egyptian way. |
| ✍️ Pronunciation control | Diacritics you write override the model's own reading. |
| 🎛️ Web studio | An RTL Arabic UI with generate and stream modes, voices, cloning, parameters, live waveform and metrics, and light/dark themes. |
📦 Install
pip install cairo-tts # Python API + CLI
pip install "cairo-tts[ui]" # + web studio (FastAPI)
From source:
git clone https://github.com/MohammedAly22/Cairo-TTS && cd Cairo-TTS
pip install -e ".[ui]"
- GPU: install the CUDA build of PyTorch first (pytorch.org). Cairo-TTS runs on the CPU by default; pass
device="cuda"(or--device cuda) to use the GPU, ordevice="auto"to pick it when available. - CPU only:
pip install torch --index-url https://download.pytorch.org/whl/cpukeeps the install small.
🐍 Python
from cairo_tts import CairoTTS
tts = CairoTTS.from_pretrained(
"mohammedaly22/Cairo-TTS", # or a local folder
device="cpu", # "cpu" (default) | "cuda" | "cuda:1" | "auto"
max_prompt_sec=10, # seconds of reference audio used for cloning
quantize=False, # int8 weights on CPU
num_threads=None, # CPU threads
)
# 1) generate: a float32 numpy array at 24 kHz
audio = tts.generate("النهارده الجو حلو اوي, ايه رأيك ننزل نتمشى شوية؟")
# 2) save straight to a file, with a preset voice
tts.save("عارف ايه اكتر حاجة بتخوفني.", "ahmed.wav", voice="ahmed")
# 3) clone any voice (zero-shot) from a short, clean recording
tts.save("ده صوتي انا, بس الموديل هو اللي بيتكلم.", "me.wav", voice="my_voice.wav")
tts.export_voice("my_voice.wav", "my_voice.safetensors") # instant to reload: voice="my_voice.safetensors"
# 4) stream: chunks arrive while audio is generated
for chunk in tts.stream("حاسس اني واقف مكاني. كل يوم نفس التاسكات, نفس ال meetings.", voice="sara"):
play(chunk) # your audio sink
# 5) metrics of the last call
m = tts.last_metrics
print(f"TTFA {m.ttfa*1000:.0f} ms · {m.audio:.1f}s audio in {m.total:.2f}s · {m.x_realtime:.1f}x real time · {m.device}")
# 6) see exactly what the model reads
print(tts.normalize("كلمني على 01012345678 الساعة 3:30 م"))
List the preset voices
for v in tts.voices():
print(v["id"], v["name_ar"], v["gender"], v["description_ar"])
| Male | Female | ||
|---|---|---|---|
mohamed |
محمد | sara |
سارة |
ahmed |
أحمد | mariam |
مريم |
ali |
علي | nour |
نور |
omar |
عمر | fatma |
فاطمة |
youssef |
يوسف | heba |
هبة |
mostafa |
مصطفى | yasmin |
ياسمين |
karim |
كريم | mona |
منى |
hassan |
حسن | rana |
رنا |
tarek |
طارق | dina |
دينا |
yehia |
يحيى | malak |
ملك |
Each voice has an Arabic and an English description (pitch, style, tone) in voices/voices.json. tarek is the default voice (used when voice is not given). The names are made up.
A complete script is in examples/infer.py.
Command line
cairo-tts say "ال meeting اتأجل لبكره." -o out.wav --voice ahmed
cairo-tts say "صوتي انا." -o me.wav --voice my_voice.wav --device cpu
echo "النص من ملف" | cairo-tts say - -o out.wav
cairo-tts voices # preset voices
cairo-tts normalize "الساعة 3:30 م" # → الساعة تلاتة ونص العصر
cairo-tts serve --port 8000 # web studio
🎛️ Web studio
pip install "cairo-tts[ui]"
cairo-tts serve # http://127.0.0.1:8000 (--device cpu|cuda, --host 0.0.0.0)
- Two modes: توليد كامل (generate the whole clip) and بث مباشر (live streaming, played while it is generated).
- Voices: a searchable dropdown of the 20 presets (descriptions, play/pause previews), or استنسخ صوت (clone a voice): upload a file or record from the microphone.
- Parameters: temperature, LSD steps, EOS threshold, frames after EOS, noise clamp, chunk size.
- Metrics after every run: server TTFA, browser TTFA, total time, audio length, × real time, RTF, chunks / characters, device.
- Pronunciation toolbar (فتحة، ضمة، كسرة، سكون، شدة), a random Egyptian sentence button, and a preview of the normalized text.
- A minimal Arabic, RTL, responsive layout with dark and light themes (
?theme=light|dark), a waveform that fills in while streaming, and a generation history. - Streaming plays through an AudioWorklet at the model's 24 kHz rate with a short pre-buffer, so chunks join without gaps or resampling clicks.
- A JSON API at
/api/docs:POST /api/generate,POST /api/stream(NDJSON PCM chunks),GET /api/voices,POST /api/voices/upload,POST /api/normalize.
Use it from Python (e.g. in your own app):
from cairo_tts import CairoTTS
from cairo_tts.server import create_app, serve
serve(CairoTTS.from_pretrained(device="cuda"), host="0.0.0.0", port=8000)
# or: app = create_app(tts) → mount / run with any ASGI server
📓 Colab notebooks
| Notebook | ||
|---|---|---|
| Quick start: load, preset voices, cloning, streaming, preprocessing, diacritics, parameters | 01_quickstart.ipynb |
|
| Web UI: the full studio inside Colab, no local install | 02_web_ui.ipynb |
Both download the public model from Hugging Face; no token is needed.
🤗 Hugging Face Space
The Space runs the same studio (Docker SDK, port 7860). To deploy your own:
python scripts/deploy_space.py --space <user>/Cairo-TTS --token-secret # uploads space/ + the package source
--token-secret stores your token as the Space's HF_TOKEN secret (only needed if you point it at a private model). Optional Space variables: CAIRO_TTS_MODEL, CAIRO_TTS_DEVICE, CAIRO_TTS_QUANTIZE=1.
✍️ Pronunciation control
The model adds diacritics on its own. Write them yourself only where it reads a word wrong:
| Write | Meaning | Example |
|---|---|---|
a vowel (َ ُ ِ) |
chooses between readings | نِفسَها (she wants) vs نَفسَها (herself) |
shadda ّ |
doubles the consonant | بَتمَشَّى |
sukun ْ |
no vowel | اتْحَرَجْت |
| Latin letters | English words | ال meeting, ال deal |
CEO, AI |
upper-case runs are spelled as English letters | → c e o, a i (write ceo to read it as a word) |
. , ، |
sentence end (long pause) / short pause; ? ! become . |
Hamza on alef: the model's vocabulary has only bare
ا, soأ إ آcannot reach it.إkeeps its vowel and becomesاِ;أandآbecomeا, and the model chooses the vowel (add one if needed:أُ→اُ).
ملاحظات بالمصري
- اكتب زي ما بتتكلم: «مش عارف»، «عشان كدة»، «إزيك». الفصحى بتشتغل بس العامية أحلى.
- الكلام الإنجليزي اكتبه بالحروف اللاتيني: «ال meeting»، «ال deadline».
- لو كلمة اتقرت غلط شكّلها بس هي: «نِفسَها» بدل «نفسها».
- الصوت المرجعي: ٥–١٠ ثواني نضيفة، صوت واحد، من غير مزيكا.
- لو آخر الجملة بيتقطع نزّل «حد النهاية» (
eos_threshold)، ولو الصوت مش ثابت قلل الحرارة.
🔢 Text preprocessing
preprocess_egyptian() runs before the model frontend. You can use it on its own:
from cairo_tts import preprocess_egyptian, prepare_text
preprocess_egyptian("كلمني على 01012345678 او ابعت على ahmed.ali@gmail.com")
# كلمني على زيرو واحد زيرو, واحد اتنين تلاتة اربعة, خمسة ستة سبعة تمانية, او ابعت على احمد دوت علي ات gmail دوت كوم
prepare_text("الاجتماع الساعة 3:30 م و السعر 250 جنيه بخصم 15%")[0]
# الاجتماع الساعة تلاتة ونص العصر و السعر ميتين وخمسين جنية بخصم خمستاشر في المية
| Input | Spoken |
|---|---|
01012345678, +20 10 … |
phone digits grouped 3-4-4: «زيرو واحد زيرو, …», «زائد اتنين زيرو …» |
ahmed.ali@gmail.com |
«احمد دوت علي ات gmail دوت كوم» (Arabic names typed in Latin letters are written in Arabic) |
www.youtube.com, https://… |
«w w w دوت youtube دوت كوم» |
3:30 م, 9:15, 10:45 pm |
«تلاتة ونص العصر», «تسعة وربع», «حداشر الا ربع بالليل» |
15/3/1998 |
«خمستاشر مارس سنة الف وتسعمية وتمانية وتسعين» |
250 جنيه, $99, 50 EGP, 1.5 € |
Egyptian amounts with currency names |
15%, 3.5 |
«خمستاشر في المية», «تلاتة فاصلة خمسة» |
5K, 2M, 3Bn |
«خمسة الف», «اتنين مليون», «تلاتة مليار» |
120 km/h, 5 kg, 64 GB |
units in Arabic |
د/ احمد, م/, ش., ج.م.ع |
«دكتور», «مهندس», «شارع», «جمهورية مصر العربية» |
CEO, #مصر, @user, & |
«c e o», «هاشتاج مصر», «user», «و» |
Numbers are verbalized in Egyptian (1994 → «الف وتسعمية واربعة وتسعين»). Runs of more than 9 digits are read digit by digit.
⚙️ Parameters
| Parameter | Default | |
|---|---|---|
voice |
default voice | preset id, an audio file (cloning), or an exported .safetensors |
temperature |
0.3 |
lower is steadier; higher is more expressive and less stable |
lsd_steps |
1 |
flow decoding steps per 80 ms frame |
eos_threshold |
-4.0 |
end-of-speech threshold: higher stops earlier, lower if the last word gets cut |
noise_clamp |
None |
clamps the sampling noise (e.g. 2.0) |
frames_after_eos |
auto | 80 ms frames kept after the end of speech |
max_letters |
160 |
long text is split at . then , into chunks of this many letters |
clarity |
1.0 |
correction of the model's measured high-frequency loss (0 = raw model output, 1 = full correction); see Audio quality |
stop |
None |
a threading.Event that stops streaming early |
🎧 Audio quality
Generated speech is compared with the reference it clones (20 voices × 3 sentences, long-term spectrum per third-octave band). The 1-step flow sampler loses some high-frequency detail: about −2 dB at 1–2.5 kHz and −5 to −7 dB at 3–6 kHz, which sounds slightly muffled. Cairo-TTS applies the inverse of that measured curve (cairo_tts.enhance.ClarityFilter):
- boosts only, nothing below 800 Hz, at most +6 dB;
- linear-phase, applied chunk by chunk with carried-over state, so streaming and full generation give identical samples;
clarity=0returns the raw model output.
| DNSMOS SIG | DNSMOS OVRL | DNSMOS BAK (noise) | UTMOS | bandwidth (99 % energy) | |
|---|---|---|---|---|---|
| raw model output | 3.548 | 3.336 | 4.170 | 3.215 | 5.9 kHz |
clarity=1 (default) |
3.570 | 3.359 | 4.168 | 3.212 | 8.0 kHz |
Audio is 24 kHz (the model's native rate); 16-bit WAV is transparent for it (−96 dBFS quantization, far below the model's own noise floor). The rest of the quality comes from the reference: the model copies its microphone and room, so use clean, wide-band recordings.
📊 Speed
Measured with this package after warm-up, on 7–11 s sentences:
| Device | Time to first audio | Throughput |
|---|---|---|
| NVIDIA GTX 1660 Ti (6 GB) | about 80 ms | about 2.2× real time |
| Intel i7-10750H laptop CPU | about 330 ms | about 2.6× real time |
🧠 Model
The model is a Pocket TTS (Kyutai) architecture: a causal transformer over Mimi latents with a 1-step flow head and a streaming Mimi decoder (24 kHz).
- A 24-layer teacher was fine-tuned on about 747 hours of Egyptian podcast speech, then distilled into this 6-layer student.
- Details are on the model card.
🗂️ Repository
src/cairo_tts/
├── model.py CairoTTS: loading, devices, voices, generate / stream / save, metrics
├── text/ Egyptian preprocessing + the model frontend (numbers, diacritics, ta marbuta)
├── server/ FastAPI app + static web studio (HTML / CSS / JS)
└── cli.py cairo-tts say | serve | voices | normalize
notebooks/ Colab quick start + web UI
examples/infer.py minimal script
space/ Hugging Face Space (Docker)
scripts/ upload_to_hub.py · deploy_space.py
tests/ text + inference + API tests (pytest)
⚖️ Responsible use
Cairo-TTS can imitate voices.
- Do not use it to impersonate anyone without their consent, to deceive, or to commit fraud.
- The preset voices are short clips of podcast speakers and are provided for research and demos only.
- Label synthetic audio when you publish it.
📜 License
- The code is MIT.
- The model weights are fine-tuned from Kyutai's Pocket TTS and follow its terms. See NOTICE.md and the model card.
Metadata
Release files for cairo-tts 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cairo_tts-0.2.0.tar.gz | 141.9 kB | Without provenance | Details for cairo_tts-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cairo_tts-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for cairo_tts-0.2.0-py3-none-any.whl |
Total release size: 281.1 kB
Release files / cairo_tts-0.2.0.tar.gz
| Download URL | cairo_tts-0.2.0.tar.gz |
|---|---|
| Size | 141.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7940f51af6f57388126397dd81e64dc33c8a94fe4f254be27462b9ddd4fa930c
|
|
BLAKE2b-256 checksum How to use checksums |
663efecc3939b6bba0dd454715db153139155d4fb4a552e5d739f87ed873a312
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.16
|
Release files / cairo_tts-0.2.0-py3-none-any.whl
| Download URL | cairo_tts-0.2.0-py3-none-any.whl |
|---|---|
| Size | 139.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e59ab0bbf27da07b5179e29c2d6f777026e4b9a5744c6489371580b08d090f76
|
|
BLAKE2b-256 checksum How to use checksums |
00aa0650ad650adde086c2addfe5c65ca6606288e8ba659f792d15f7408ab8e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.16
|
Security for cairo-tts 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.