--- license: cc-by-4.0 language: - uz pipeline_tag: text-to-speech library_name: onnx base_model: kyutai/pocket-tts tags: - tts - onnx - uzbek - edge - gapiring --- # Gapiring v2 — Uzbek text-to-speech in two sizes: a narrator, roles and manners, English words as written Uzbek text-to-speech in two sizes. **Gapiring Edge v2** (110M parameters, 117 MB) runs on an ordinary CPU or entirely in a web browser, with no GPU and no server. **Gapiring Large v2** (336M parameters) suits a server or a desktop. Both speak in two voices, `f1` (female) and `m1` (male), take a **role** and a **manner** of speech by name, and stream audio as it is made. Built on Kyutai's Pocket TTS. Demo Space (Edge in the browser): `islomov/gapi-uz-gapiring-v2`. Libraries: `pip install gapiring`, `npm install gapiring`, Android (Maven), iOS (Swift package: https://github.com/Islomov49/gapiring-ios). Gapiring v1 stays at `islomov/gapi-uz-gapiring-v1`. A third, far smaller model for single-board computers, Gapiring Nano (31 MB, one voice), has a repository of its own, `islomov/gapi-uz-gapiring-nano-v1`; the pip and npm libraries load it as `"nano"`. ## New in v2 - **Narrator.** The role `narrator` reads a longer text aloud in one of four genres: `book`, `article`, `news`, `tale`. - **English words as written.** English words, brand names and abbreviations inside Uzbek text (Google Lens, Power BI, eSIM, check-in, IELTS) are read from their ordinary spelling. The dictionary of v1 is gone: nothing to load, nothing to respell. - **Serious.** The manner `serious` for `operator`, `assistant` and `assistant_formal`; the narrator's `article` and `news` take `serious=True`. - **Pace.** `pace="slow"` or `pace="fast"`. - **Hesitations are a switch.** The lively `assistant` now speaks fluently; `hesitant=True` brings back the small hesitations of live speech that it had in v1. - Everything v1 did stays: the roles and manners of v1 by the same names, the emotional mode, sounds in the text. ## Coming from v1 Code written for v1 runs on v2 as it is. The libraries from 0.2 on use Gapiring v2 by default, and what v1 code asks for is mapped to v2: | v1 | In v2 | | --- | --- | | the roles `operator`, `assistant`, `assistant_formal`, `emotional` and all their manners | the same names; `assistant` is fluent now, `hesitant=True` is how it spoke in v1 | | the dictionary of English words (`dictionary=True`, `lexicon=...`, `Lexicon`) | ignored with a warning: English words are read as they are written | | the models `"edge"` and `"large"`, `precision="full"` | the same sizes, now Gapiring v2; the v1 models stay in `islomov/gapi-uz-gapiring-v1` and in `gapiring<0.2` | Nothing of this raises an error. ## Use it ### Python CPU, no PyTorch. Large (the cleaner sound) or Edge (about a third of the download, faster), fetched once. The text normaliser is on: numbers, dates and money are read out, English words go as written. ```bash pip install gapiring ``` ```python from gapiring import Gapiring tts = Gapiring() # Large; Gapiring("edge") is the small model, Gapiring("nano") the tiny one tts.save("hello.wav", "Assalomu alaykum! Namuna kompaniyasining virtual yordamchisiman, sizga qanday yordam bera olaman?", voice="f1", role="assistant", manner="warm") tts.save("chapter.wav", open("chapter.txt").read(), voice="m1", role="narrator", manner="book") # any length for chunk in tts.stream("Assalomu alaykum! Namuna kompaniyasining virtual yordamchisiman, sizga qanday yordam bera olaman?", voice="m1", role="operator", manner="calm", pace="slow"): play(chunk) # float32, 24 kHz mono, as it is made ``` ### JavaScript Browser and Node, WebAssembly. The model is fetched once. ```bash npm install gapiring ``` ```js import { Gapiring } from "gapiring"; const tts = await Gapiring.load(); for await (const chunk of tts.stream("Assalomu alaykum! Namuna kompaniyasining virtual yordamchisiman, sizga qanday yordam bera olaman?", { voice: "f1", role: "assistant", manner: "warm" })) { play(chunk); // Float32Array, 24 kHz mono, as it is made } const news = await tts.speak(article, { voice: "m1", role: "narrator", manner: "news" }); // any length ``` ### Android The model is inside the library (about 100 MB): no network, Android 7.0 and later. ```kotlin // settings.gradle.kts dependencyResolutionManagement { repositories { google(); mavenCentral() maven("https://huggingface.co/islomov/gapi-uz-gapiring-v2/resolve/main/android/maven") } } // app/build.gradle.kts dependencies { implementation("uz.gapi:gapiring:0.2.0") } ``` ```kotlin import uz.gapi.gapiring.Gapiring val tts = Gapiring.create(context) // off the main thread: unpacks the model on the first run tts.play("Assalomu alaykum! Namuna kompaniyasining virtual yordamchisiman, sizga qanday yordam bera olaman?", voice = "f1", role = "assistant", manner = "warm") tts.play(chapter, voice = "m1", role = "narrator", manner = "book") // any length ``` ### iOS The model is inside the Swift package (about 150 MB in an app): no network. iOS 15.1 and later, macOS 14 and later on Apple silicon. ```swift // Xcode: File > Add Package Dependencies... and enter https://github.com/Islomov49/gapiring-ios // or in Package.swift: .package(url: "https://github.com/Islomov49/gapiring-ios.git", from: "0.2.0") ``` ```swift import Gapiring let tts = try Gapiring() // off the main thread tts.play("Assalomu alaykum! Namuna kompaniyasining virtual yordamchisiman, sizga qanday yordam bera olaman?", voice: "f1", role: "assistant", manner: "warm") tts.play(chapter, voice: "m1", role: "narrator", manner: "book") // any length ``` ## From the files of this repository ```bash pip install numpy onnxruntime tokenizers soundfile python runtime/pocket_onnx.py --bundle large --suffix _int8 --voice f1 --role operator --manner calm --normalize literary \ --text "Uchrashuv 25-noyabr soat 14:30 da, to'lov Payme orqali, narxi 1 250 000 so'm." --out hello.wav ``` ```python import sys; sys.path.insert(0, "runtime") import numpy as np, soundfile as sf from pocket_onnx import PocketONNX tts = PocketONNX("large", suffix="_int8", normalize="literary") # or PocketONNX("edge", ...) chunks = tts.speak("Assalomu alaykum! Namuna kompaniyasining virtual yordamchisiman, sizga qanday yordam bera olaman?", voice="f1", role="assistant", manner="warm") sf.write("hello.wav", np.concatenate(list(chunks)), 24000) # chunks arrive as they are made: play them as they come story = tts.speak(open("chapter.txt").read(), voice="m1", role="narrator", manner="book") # a text of any length ``` In the browser, with onnxruntime-web (`runtime/web/`, the Edge graphs): ```js import { PocketTTS } from "./pocket_tts.js"; const tts = new PocketTTS(); await tts.load("edge/"); // a folder or a URL that holds the Edge graphs await tts.say("Assalomu alaykum!", (audio) => play(audio), { voice: "f1", role: "operator", manner: "calm", pace: "slow" }); ``` ## Roles and manners | `role` | `manner` | | --- | --- | | `operator` | `neutral` `warm` `cheerful` `empathetic` `calm` `dictation` `persuasive` `brisk` `serious` | | `assistant` | `neutral` `warm` `cheerful` `empathetic` `calm` `dictation` `soothing` `serious` | | `assistant_formal` | `neutral` `warm` `cheerful` `empathetic` `calm` `dictation` `soothing` `serious` | | `narrator` | `book` `article` `news` `tale` | | `emotional` | `angry` `upset` `irritated` `worried` `tired` `sceptical` `confused` `hurried` `joking` `grateful` `curious` `friendly` `calm` `elderly` | - `assistant` is a lively helper; `assistant_formal` is the same helper in an even, measured delivery: choose it for announcements, voice menus, instructions, and wherever every take should sound the same. - `emotional` is a person on the phone speaking with a feeling: angry, upset (sad), worried, tired, sceptical, and more; it suits call-practice simulators, games and stories. - `narrator` reads a text of any length; its manner is the genre, `book` when none is given. Every other role speaks `neutral` when no manner is given. The default role is `assistant`. One optional mark at a time goes with the role and the manner: | Mark | With | | --- | --- | | `pace="slow"`, `pace="fast"` | `operator` with `neutral`, `warm`, `cheerful`, `calm`, `persuasive` | | `pace="slow"`, `pace="fast"` | `assistant` with `neutral`, `warm`, `cheerful`, `calm` | | `pace="slow"`, `pace="fast"` | `assistant_formal` with `neutral`, `warm`, `cheerful`, `calm` | | `pace="slow"` | `narrator` with `article` | | `pace="fast"` | `narrator` with `news` | | `serious=True` | `narrator` with `article` or `news` (the other roles have the manner `serious`) | | `hesitant=True` | `assistant` with any manner but `serious` | Sounds go inside the text: `[laugh]`, `[pause]`, `[breath]`, `[sigh]`. The model speaks one piece at a time: a sentence or two for the dialogue roles, a short paragraph for the narrator. The Python runtime (`speak`), the pip package and the libraries split a longer text into such pieces themselves, and read the apostrophe variants of o' and g' (ʻ, ʼ, ‘, ’) as the plain one. ## Text normalisation `normalize="literary"` (or `--normalize literary`) runs the text through the normaliser (`runtime/text_front.py`, `runtime/frontend/`, Python standard library only): numbers, dates, times, money, percentages, ranges, units and phone numbers become words; Cyrillic becomes Uzbek Latin; markdown, emoji and quotes are cleaned; the sound tags stay. English words, brands and abbreviations pass through as they are written. `normalize="conversational"` also turns written forms into the Tashkent spoken ones. Without `normalize` the text goes to the model as written. In the pip package the normaliser is on by default (`literary`); `normalize=None` switches it off. `Gapiring()` there loads Large int8; `Gapiring("edge")` the small model. The browser and mobile libraries have no normaliser: give them text with numbers as words. | Written | Spoken (`literary`) | | --- | --- | | Narxi 1 250 000 so'm, QR kodni skaner qiling 😊 | Narxi bir million ikki yuz ellik ming so'm, QR kodni skaner qiling. | | +998 90 123 45 67 raqamiga qo'ng'iroq qiling. | Plyus to'qqiz yuz to'qson sakkiz, to'qson, bir yuz yigirma uch, qirq besh, oltmish yetti raqamiga qo'ng'iroq qiling. | | Uchrashuv 25.11.2026 soat 14:30 da | Uchrashuv yigirma beshinchi noyabr ikki ming yigirma oltinchi yil soat o'n to'rt o'ttizda. | | Bugun 50% chegirma, yetkazib berish 3-5 kun, narxi $120 | Bugun ellik foiz chegirma, yetkazib berish uch-besh kun, narxi bir yuz yigirma dollar. | | Hisobotni Power BI orqali tekshirdim, Wi-Fi parolini SMS qilib yubordim, 3 ta fayl. | Hisobotni Power BI orqali tekshirdim, Wi-Fi parolini SMS qilib yubordim, uchta fayl. | ```python import sys; sys.path.insert(0, "runtime") from text_front import prepare prepare("Narxi 1 250 000 so'm, Payme orqali to'lang, CRMga o'zi tushadi") # "Narxi bir million ikki yuz ellik ming so'm, Payme orqali to'lang, CRMga o'zi tushadi." ``` ## Models and files | | Edge v2 | Large v2 | | --- | --- | --- | | Folder | `edge/` | `large/` | | Transformer layers | 6 | 24 | | Parameters | 110M | 336M | | Graphs | int8, 117 MB | full precision, 1.3 GB; int8, 346 MB | | For | CPU, browser, phone | server, desktop | Each folder holds the four graphs (`text_conditioner`, `flow_lm_main`, `flow_lm_flow`, `mimi_decoder`), `bundle.json` (state manifests and sampling constants), `tokenizer.json` and `voices/` (the two voices, `.npy` and raw float32 `.bin`). `android/maven/`: the Android library (the model inside). The runtime takes the full-precision graphs when a folder has them; `PocketONNX("large", suffix="_int8")` takes the int8 ones. `runtime/pocket_onnx.py`, `runtime/text_front.py` and `runtime/frontend/`: the generation loop and the normaliser with numpy + onnxruntime + tokenizers, no PyTorch. `runtime/web/`: the same loop for onnxruntime-web, with a tokenizer that matches the Python one id for id. `examples/`: the clips below. Synthesis runs on the device and sends nothing anywhere. Recent ONNX Runtime builds report usage to Microsoft by default; the Python runtime and the Android library switch that off (`ORT_DISABLE_TELEMETRY=1`, set before ONNX Runtime loads; a value you set yourself is left alone). The browser build of ONNX Runtime has no such reporting. ## Performance v2 keeps the architecture of v1, so the speed is the one measured on Gapiring v1: CPU, onnxruntime 1.23, desktop Intel i5-13600KF, 23 operator and assistant lines (about 3 minutes of speech), one process per setting. Audio is 24 kHz mono, streamed: the first frame is decoded alone for the first audio, then chunks of 240 ms. | Model | Threads | First audio, median (max) | Speed | Peak memory | | --- | --- | --- | --- | --- | | Edge, int8 | 1 | 31 ms (49) | 6.9x real time | 283 MB | | Edge, int8 | 2 | 21 ms (31) | 9.7x real time | 281 MB | | Edge, int8 | 4 | 27 ms (39) | 7.3x real time | 281 MB | | Large, int8 | 1 | 102 ms (174) | 2.8x real time | 744 MB | | Large, int8 | 2 | 68 ms (116) | 3.8x real time | 748 MB | | Large, int8 | 4 | 67 ms (133) | 3.8x real time | 724 MB | | Large, full precision | 2 | 166 ms (275) | 1.8x real time | 1.9 GB | Not measured yet: phones and ARM CPUs. ## Quality Character error rate of an Uzbek speech recogniser on the generated audio (lower is clearer), 450 test lines in both voices, text given as written: | Lines | Edge v2, int8 | Large v2, int8 | Large v2, full precision | | --- | --- | --- | --- | | Operator, assistant and emotional lines of the kinds v1 speaks (150) | 3.36 % | 3.65 % | 3.75 % | | Narrator passages (51) | 0.68 % | 0.84 % | 0.68 % | | Lines with English words, brands and abbreviations (145) | 1.25 % | 1.60 % | 1.46 % | | Serious manner and pace (49) | 0.38 % | 0.49 % | 0.64 % | | Lines that open with an uncommon first word (55) | 0.39 % | 0.40 % | 0.59 % | The recogniser is an Uzbek one, so on lines with English words part of the count may be its own. ## Examples Spoken by each model, int8 (`examples/edge/`, `examples/large/`, texts and settings in `examples/examples.jsonl`). First what is new: the narrator in its four genres, English words as written, the serious manner, one line at three paces, one greeting by the lively assistant, the same assistant with hesitations, and the formal assistant. Then the examples of v1: lines a voice agent would say and callers in the emotional mode. | Voice | Role | Manner | Mark | Text | Edge v2 | Large v2 | | --- | --- | --- | --- | --- | --- | --- | | f1 | narrator | book | | Kuzning salqin oqshomida hovlidagi keksa o'rik daraxti ostiga sarg'aygan yaproqlar unsiz to'kilardi. Dilshod ayvon ustuniga suyangan ko'yi uzoqlarga termularkan, ko'ksida anchadan beri tinchlik bermayotgan ajib bir sog'inch uyg'ondi. Shu payt ichkaridan onasining mayin qadam tovushlari eshitildi va u o'g'lining yelkasiga iliq ro'mol tashlab qo'ydi. "Havo sovib qoldi, bolam, uyga kira qol," dedi onasi past ovozda. Bu oddiy so'zlardan yigitning ko'ngli yorishib, atrofdagi kuzgi g'amginlik bir zumda tarqab ketgandek bo'ldi. | | | | m1 | narrator | article | | Inson xotirasi shunchaki o'tmishdagi voqealarni saqlaydigan ombor emas, balki muntazam yangilanib turadigan murakkab va tirik tizimdir. Biz tunda chuqur uyquga ketganimizda, miyamiz kunduzi olingan son-sanoqsiz ma'lumotlarni saralab, eng muhimlarini uzoq muddatli xotiraga ko'chiradi. Agar odam yetti yoki sakkiz soat to'yib uxlamasa, bu tabiiy jarayon izdan chiqib, diqqatni jamlash qiyinlashadi. Shuning uchun ham yangi bilimlarni mustahkamlashda sokin va sifatli dam olish xuddi mutolaa qilish kabi katta ahamiyatga ega. | | | | m1 | narrator | news | | Bugun erta tongda Ko'ksoy vodiysining tog'oldi hududlarida joylashgan ikkita qishloqni bog'lovchi yangi ko'prik foydalanishga topshirildi. Uzunligi sakson besh metr bo'lgan ushbu mustahkam inshoot bahorgi sel paytida qatnov uzilib qolishi muammosiga butunlay chek qo'yadi. Qurilish ishlari olti oy davom etib, unda mahalliy ustalar va muhandislar faol ishtirok etishdi. Kelasi haftadan boshlab mazkur yo'nalish bo'ylab kuniga o'n ikkita jamoat transporti qatnovi yo'lga qo'yilishi rejalashtirilgan. Hozirda yo'l chetlariga tungi yoritish chiroqlarini o'rnatish ishlari yakunlanmoqda. | | | | f1 | narrator | tale | | Bir bor ekan, bir yo'q ekan, qadim zamonda keng o'rmon chekkasida mittigina oq quyoncha yashagan ekan. U har kuni tong saharda uyg'onib, maysalar ustidagi shudring tomchilarini tomosha qilishni juda yaxshi ko'rar ekan. Kunlarning birida quyoncha eski chinor kovagidan taralayotgan oltindek mayin yog'duni ko'rib, hayratdan qotib qolibdi. Sekingina yaqinlashib qarasa, kovak ichida qanotlari kumushdek tovlanadigan jajji bir kapalak shirin qo'shiq kuylab o'tirgan ekan. Quyoncha bunday mo'jizani birinchi marta ko'rgani uchun quvonchdan quloqlarini dikkaytirib, sehrli ohangga mahliyo bo'libdi. | | | | m1 | operator | brisk | | Assalomu alaykum, siz Namuna qo'llab-quvvatlash markaziga bog'landingiz. Sizning CRM profilingizda Apple Pay hamda PayPal orqali o'tkazilgan uchta to'lov muvaffaqiyatli tasdiqlangan. | | | | f1 | assistant | warm | | Safaringiz oldidan telefoningizda eSIM sozlamalarini yoqib qo'ydim. Aeroportda online check-in qilish va begona yozuvlarni Google Lens orqali o'qish juda qulay. | | | | m1 | assistant_formal | neutral | | IELTS imtihoniga tayyorlanish bo'yicha barcha vazifalarni ertangi deadline tugaguncha topshirishingiz so'raladi. O'qituvchilar har bir tinglovchiga batafsil feedback yozib qoldiradilar. | | | | m1 | operator | brisk | | To'lovni Payme yoki Click orqali online o'tkazsangiz, CRM tizimida ko'rinadi, keyin Telegram guruhda feedback qoldirarsiz. | | | | m1 | operator | serious | | Hurmatli mijoz, Namuna xavfsizlik qoidalariga binoan maxfiy tasdiqlash kodini hech kimga aytmang. Shartnoma bo'yicha to'lov muddati ikki kundan keyin yakunlanadi. | | | | f1 | assistant_formal | serious | | Diqqat, bugun havo harorati qirq darajagacha ko'tarilishi kutilmoqda. Quyosh tig'ida uzoq yurmaslikni va kun davomida ko'proq toza suv ichishni unutmang. | | | | f1 | operator | neutral | | Buyurtmangiz Namuna omboridan yo'lga chiqdi va ikki soat ichida manzilingizga yetkaziladi. Kuryer yetib borishidan o'n besh daqiqa oldin qo'ng'iroq qiladi. | | | | f1 | operator | neutral | pace slow | Buyurtmangiz Namuna omboridan yo'lga chiqdi va ikki soat ichida manzilingizga yetkaziladi. Kuryer yetib borishidan o'n besh daqiqa oldin qo'ng'iroq qiladi. | | | | f1 | operator | neutral | pace fast | Buyurtmangiz Namuna omboridan yo'lga chiqdi va ikki soat ichida manzilingizga yetkaziladi. Kuryer yetib borishidan o'n besh daqiqa oldin qo'ng'iroq qiladi. | | | | f1 | assistant | warm | | Assalomu alaykum! Namuna kompaniyasining virtual yordamchisiman, sizga qanday yordam bera olaman? | | | | f1 | assistant | warm | hesitant | Assalomu alaykum! Namuna kompaniyasining virtual yordamchisiman, sizga qanday yordam bera olaman? | | | | f1 | assistant_formal | warm | | Assalomu alaykum! Namuna kompaniyasining virtual yordamchisiman, sizga qanday yordam bera olaman? | | | | m1 | assistant | cheerful | | Ajoyib yangilik, buyurtmangiz bugun kechgacha yetib boradi [laugh], kuryerimiz allaqachon yo'lga chiqqan! | | | | f1 | assistant | soothing | | Hech xavotir olmang, kartangizdan yechilgan pul yo'qolmaydi, hoziroq tekshirib muammoni hal qilib beramiz. | | | | m1 | operator | persuasive | | Bugun obunani rasmiylashtirsangiz, birinchi oy uchun to'liq ellik foiz chegirma beriladi, imkoniyatni qo'ldan boy bermang. | | | | f1 | operator | dictation | | Tasdiqlash kodini yozib oling: to'rt, yetti, ikki, to'qqiz, nol, besh. Tayyor bo'lsangiz, davom etamiz. | | | | f1 | operator | empathetic | | Yetkazib berish kechikkani uchun chin dildan uzr so'rayman [pause], hozir ombor bilan bog'lanib, aniq vaqtini aytaman. | | | | m1 | emotional | angry | | Nimaga kartamdan pulni ikki marta yechib oldinglar? Yarim soatdan beri telefon qilaman, hech kim ko'tarmaydi-ku! | | | | f1 | emotional | upset | | Oyimning tug'ilgan kuniga sovg'a buyurtma qilgandim, [sigh] vaqtida olib kelmadinglar, rosa xafa bo'ldim to'g'risi. | | | | m1 | emotional | irritated | | Kuryeringiz ikki soatdan beri yetib kelmayapti, [sigh] issiq ovqatim muzlab qoldi-ku, buyurtmani hoziroq bekor qilinglar! | | | | f1 | emotional | worried | | Kartamdan hozirgina uch million so'm o'z-o'zidan yechilib ketdi, [breath] iltimos, uni tezroq bloklab qo'yinglar, juda qo'rqib ketyapman! | | | | f1 | emotional | sceptical | | Namuna do'konidagi bu kir yuvish mashinasi rostdan ham sifatlimi, [pause] yoki ikki haftada buzilib qoladigan arzon molmi? | | | | m1 | emotional | joking | | To'yxonangizga uch yuzta mehmon sig'adi degandingiz, [laugh] bu kichkina zalda qudalar bir-birining tizzasida o'tirib osh yeydimi endi? | | | | f1 | emotional | grateful | | Kechasi o'g'limning isitmasi chiqqanda shifokoringiz tez yetib kelib yordam berdi, klinika jamoasiga ming rahmat, baraka topinglar! | | | | m1 | emotional | elderly | | Bolam, ko'zim xiraroq ko'radi, [pause] shu elektr hisoblagichning raqamlarini senga sekin o'qib bersam, o'zing to'lovini yozib qo'yasanmi? | | | ## Limits and licence Two voices; Uzbek in Latin script (the normaliser converts Cyrillic). A piece longer than about 30 seconds of speech is cut short, so use `speak` or the libraries, which split the text, rather than feeding a long text to the model in one piece. Built on Kyutai Pocket TTS (CC-BY-4.0). Open source, free for any use, commercial use included. The code is under the MIT licence; the model files, voices and dictionary are under CC BY 4.0 (credit: Gapiring by Gapi, an adaptation of Kyutai Pocket TTS). Full text: `LICENSE`.