{"id":50518156,"url":"https://github.com/marty1885/kokoro-server","last_synced_at":"2026-06-05T03:01:22.419Z","repository":{"id":361627762,"uuid":"1253584915","full_name":"marty1885/kokoro-server","owner":"marty1885","description":"Serving Kokoro with CPU and RK3588 NPU support","archived":false,"fork":false,"pushed_at":"2026-05-31T14:04:29.000Z","size":67,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-05-31T16:08:06.775Z","etag":null,"topics":["cpp-web-services","rk3588","rknn","rknpu2","tts","tts-api"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marty1885.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-29T16:02:10.000Z","updated_at":"2026-05-31T14:04:33.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/marty1885/kokoro-server","commit_stats":null,"previous_names":["marty1885/kokoro-server"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/marty1885/kokoro-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marty1885%2Fkokoro-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marty1885%2Fkokoro-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marty1885%2Fkokoro-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marty1885%2Fkokoro-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marty1885","download_url":"https://codeload.github.com/marty1885/kokoro-server/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marty1885%2Fkokoro-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33844686,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-02T02:00:07.132Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp-web-services","rk3588","rknn","rknpu2","tts","tts-api"],"created_at":"2026-06-03T01:31:50.234Z","updated_at":"2026-06-03T01:31:50.894Z","avatar_url":"https://github.com/marty1885.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kokoro-infer\n\nFast, lightweight end-to-end inference engine and server for Kokoro-82M TTS, optimized for CPU, CUDA, and Rockchip RK3588 NPU.\n\nIt provides both a Python prototyping pipeline (infer.py) and a production-ready C++ implementation (libkokoro, kokoro-cli, kokoro-server) with an OpenAI-compatible API.\n\n## Features\n\n- RK3588 NPU Acceleration: Run the Kokoro decoder on the Rockchip RK3588 NPU at ~2.5× RTF (via custom graph rewrites: fixed-stat normalization, Horner minimax Sin approximation, operator folding, and deconv-to-conv transform).\n- Native C++ Library (libkokoro): Zero Python dependency, using ONNX Runtime (CPU/CUDA/TensorRT) or RKNN for inference.\n- English G2P Frontend: Integration with misaki-cpp (English G2P frontend) and espeak-ng.\n- OpenAI-Compatible Server: High-performance HTTP/WebSocket server using Drogon, offering:\n  - POST /v1/audio/speech (OpenAI-compatible TTS)\n  - POST /api/v1/synthesise (one-shot text/phonemes -\u003e opus, pcm, wav, raw)\n  - WS /api/v1/stream (streaming real-time audio)\n  - GET /api/v1/voices (list available voices)\n- Built-in Web UI: A lightweight demo web interface served directly by kokoro-server.\n\n## Project Structure\n\n- build.py: Host-side compilation and graph surgery (PyTorch -\u003e ONNX -\u003e RKNN)\n- infer.py: Board-side Python reference runner (ORT + rknnlite)\n- src/: Native C++ library (libkokoro)\n- cli/: C++ CLI utility (kokoro-cli)\n- server/: C++ Web/API Server (kokoro-server)\n- misaki-cpp/: English G2P submodule\n- NOTES.md: Detailed design \u0026 NPU optimization notes\n\n## Python Quick Start (Prototyping / Board)\n\n### 1. Compile RKNN Model (Host)\nPrepare Kokoro weights and kokoro-src, then run:\n```bash\npython3 build.py\n```\nOutputs: onnx/kokoro_encoder.onnx, onnx/har_generator.onnx, onnx/kokoro_decoder.rknn, and voices_npy/.\n\n### 2. Run Inference (Board)\nCopy outputs and run:\n```bash\n# English text (needs misaki: pip install \"misaki[en]\")\npython3 infer.py --text \"Hello world.\" --voice af_heart --out hello.wav\n\n# Or raw IPA phonemes directly\npython3 infer.py --phonemes \"həlˈO wˈɜɹld\" --voice af_heart --out hello.wav\n```\n\n## C++ Quick Start\n\n### 1. Requirements\nEnsure the following dependencies are installed:\n- ONNX Runtime C++ API (or RKNN runtime librknnrt)\n- espeak-ng\n- OpenBLAS (for iSTFT sgemm)\n- fmt, spdlog, nlohmann_json\n- For Server: Drogon, Opus, soxr\n\n### 2. Build\n```bash\nmkdir build \u0026\u0026 cd build\ncmake .. -DCMAKE_BUILD_TYPE=Release \\\n         -DUSE_RKNN=ON \\             # Enable RK3588 NPU acceleration\n         -DBUILD_SERVER=ON \\\n         -DBUILD_CLI=ON\nmake -j$(nproc)\n```\n\n### 3. Run C++ CLI\n```bash\n./kokoro-cli --text \"Hello from C++.\" --voice af_heart --out out.wav\n```\n\n### 4. Run C++ Server\n```bash\n./kokoro-server \\\n  --encoder onnx/kokoro_encoder.onnx \\\n  --har-gen onnx/har_generator.onnx \\\n  --decoder onnx/kokoro_decoder.rknn \\\n  --vocab Kokoro-82M/config.json \\\n  --voices-dir voices_npy \\\n  --port 8848\n```\nVisit http://localhost:8848/ in your browser for the Web UI.\n\n## Optimizations \u0026 Performance\nFor full technical details about fixed-stat normalization, Horner minimax polynomial approximation for Sin, Pow-to-Mul substitution, Snake1d Conv folding, and custom ConvTranspose padding rewrites, see the ON_RKNN_HACKING.md file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarty1885%2Fkokoro-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarty1885%2Fkokoro-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarty1885%2Fkokoro-server/lists"}