{"_id":"kokoro-js","_rev":"6-02ca4fd907b76c285095c04b6f674bd1","name":"kokoro-js","dist-tags":{"latest":"1.2.1"},"versions":{"1.0.0":{"name":"kokoro-js","version":"1.0.0","keywords":["kokoro","tts","text-to-speech"],"author":{"name":"hexgrad","email":"hello@hexgrad.com"},"license":"Apache-2.0","_id":"kokoro-js@1.0.0","maintainers":[{"name":"xenova","email":"admin@xenova.com"}],"contributors":[{"name":"Xenova"}],"homepage":"https://github.com/hexgrad/kokoro","bugs":{"url":"https://github.com/hexgrad/kokoro/issues"},"dist":{"shasum":"d95794f49d5acc9dbafbe68f38c04fc9fb51cef7","tarball":"https://registry.npmjs.org/kokoro-js/-/kokoro-js-1.0.0.tgz","fileCount":23,"integrity":"sha512-BLLqa9fhJs7qpgAv8sQBBgTPim95bDiouGc9dm/DFtAIut9d5EOLlMUIWk1nifXzUjiIdgcSqYMgsq5kFJYI0g==","signatures":[{"sig":"MEUCIQDSLqckooYSiORJrJsfJDgz+1xZHEQEASY5wruLI0jspwIgBznSWefPx1x4JpS4s+gU5+EKy8/dbWrJnwnOx/IrFus=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":7904913},"type":"module","unpkg":"./dist/kokoro.web.js","browser":{"path":false,"fs/promises":false},"exports":{"node":{"import":"./dist/kokoro.js","require":"./dist/kokoro.cjs"},"types":"./types/kokoro.d.ts","default":"./dist/kokoro.web.js"},"gitHead":"c1ae2d95c9c1963c7b9ee9230f7865e7b16eb336","scripts":{"test":"vitest","build":"rm -rf dist types && rollup -c && tsc && cp ../LICENSE LICENSE","format":"prettier --write . --print-width 1000"},"_npmUser":{"name":"xenova","email":"admin@xenova.com"},"jsdelivr":"./dist/kokoro.web.js","repository":{"url":"git+https://github.com/hexgrad/kokoro.git","type":"git"},"_npmVersion":"10.8.2","description":"High-quality text-to-speech for the web","directories":{},"_nodeVersion":"20.18.1","dependencies":{"phonemizer":"^1.2.0","@huggingface/transformers":"^3.3.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"rollup":"^4.30.1","vitest":"^2.1.8","prettier":"3.4.2","typescript":"^5.7.3","@rollup/plugin-terser":"^0.4.4","@rollup/plugin-node-resolve":"^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/kokoro-js_1.0.0_1736968105284_0.5031761984708578","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"kokoro-js","version":"1.0.1","keywords":["kokoro","tts","text-to-speech"],"author":{"name":"hexgrad","email":"hello@hexgrad.com"},"license":"Apache-2.0","_id":"kokoro-js@1.0.1","maintainers":[{"name":"xenova","email":"admin@xenova.com"}],"contributors":[{"name":"Xenova"}],"homepage":"https://github.com/hexgrad/kokoro","bugs":{"url":"https://github.com/hexgrad/kokoro/issues"},"dist":{"shasum":"f7585cb936b89ccd4af2d0325970b6588bce9930","tarball":"https://registry.npmjs.org/kokoro-js/-/kokoro-js-1.0.1.tgz","fileCount":23,"integrity":"sha512-3PGcuPdX8gXnZcE397FHSTUp8cCH7wms2MxbSrqKhdRNbpO6FCTN/papFwIaCrdtQEJnyd7vPH9bgrMoJFXTnA==","signatures":[{"sig":"MEQCIBv58oRpG+y2RGxSDyIBJKNdX4crm21xz9q6EO1qQOzQAiAvmhuqq7OJBh8Igp+KHjhV4+6XVWl/mDMDagwdcxfdQQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":7904305},"type":"module","unpkg":"./dist/kokoro.web.js","browser":{"path":false,"fs/promises":false},"exports":{"node":{"import":"./dist/kokoro.js","require":"./dist/kokoro.cjs"},"types":"./types/kokoro.d.ts","default":"./dist/kokoro.web.js"},"gitHead":"f986150fc280bbd6ab40d727c81c3d1df29b6096","scripts":{"test":"vitest","build":"rm -rf dist types && rollup -c && tsc && cp ../LICENSE LICENSE","format":"prettier --write . --print-width 1000"},"_npmUser":{"name":"xenova","email":"admin@xenova.com"},"jsdelivr":"./dist/kokoro.web.js","repository":{"url":"git+https://github.com/hexgrad/kokoro.git","type":"git"},"_npmVersion":"10.8.2","description":"High-quality text-to-speech for the web","directories":{},"_nodeVersion":"20.18.1","dependencies":{"phonemizer":"^1.2.1","@huggingface/transformers":"^3.3.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"rollup":"^4.30.1","vitest":"^2.1.8","prettier":"3.4.2","typescript":"^5.7.3","@rollup/plugin-terser":"^0.4.4","@rollup/plugin-node-resolve":"^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/kokoro-js_1.0.1_1737036975503_0.17723514169406962","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"kokoro-js","version":"1.1.0","keywords":["kokoro","tts","text-to-speech"],"author":{"name":"hexgrad","email":"hello@hexgrad.com"},"license":"Apache-2.0","_id":"kokoro-js@1.1.0","maintainers":[{"name":"xenova","email":"admin@xenova.com"}],"contributors":[{"name":"Xenova"}],"homepage":"https://github.com/hexgrad/kokoro","bugs":{"url":"https://github.com/hexgrad/kokoro/issues"},"dist":{"shasum":"3b2e0b4e98892dc14992e9441714899bc1e92530","tarball":"https://registry.npmjs.org/kokoro-js/-/kokoro-js-1.1.0.tgz","fileCount":66,"integrity":"sha512-0XJ1+XH72zxeAH+qc3kPqehM9gVKxHOZANuAzzKLjzuRImf1X0Y+GKaa5/36zXrX3K2Hw6FzPBX0/syzlCka3w==","signatures":[{"sig":"MEYCIQD2u8RVcLkz9xflhYmUB8ODcAOjKzLui7JpJPudHTZP4QIhAOixnBdy4Olt8B7mOtKkqDS8L0TMwV6TPhWbGqoMBN0T","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":30357120},"type":"module","unpkg":"./dist/kokoro.web.js","browser":{"path":false,"fs/promises":false},"exports":{"node":{"import":"./dist/kokoro.js","require":"./dist/kokoro.cjs"},"types":"./types/kokoro.d.ts","default":"./dist/kokoro.web.js"},"gitHead":"4f3f8de76d259e28d853c2001b254eb68523abbb","scripts":{"test":"vitest","build":"rm -rf dist types && rollup -c && tsc && cp ../LICENSE LICENSE","format":"prettier --write . --print-width 1000"},"_npmUser":{"name":"xenova","email":"admin@xenova.com"},"jsdelivr":"./dist/kokoro.web.js","repository":{"url":"git+https://github.com/hexgrad/kokoro.git","type":"git"},"_npmVersion":"10.8.2","description":"High-quality text-to-speech for the web","directories":{},"_nodeVersion":"20.18.1","dependencies":{"phonemizer":"^1.2.1","@huggingface/transformers":"^3.3.3"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"rollup":"^4.30.1","vitest":"^2.1.8","prettier":"3.4.2","typescript":"^5.7.3","@rollup/plugin-terser":"^0.4.4","@rollup/plugin-node-resolve":"^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/kokoro-js_1.1.0_1738936771934_0.14017031356788823","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"kokoro-js","version":"1.1.1","keywords":["kokoro","tts","text-to-speech"],"author":{"name":"hexgrad","email":"hello@hexgrad.com"},"license":"Apache-2.0","_id":"kokoro-js@1.1.1","maintainers":[{"name":"xenova","email":"admin@xenova.com"}],"contributors":[{"name":"Xenova"}],"homepage":"https://github.com/hexgrad/kokoro","bugs":{"url":"https://github.com/hexgrad/kokoro/issues"},"dist":{"shasum":"5e3af45828ccf4cde9d3a069edd95fa157bf5b3e","tarball":"https://registry.npmjs.org/kokoro-js/-/kokoro-js-1.1.1.tgz","fileCount":66,"integrity":"sha512-cyLO34iI8nBJXPnd3fI4fGeQGS+a6Uatg7eXNL6QS8TLSxaa30WD6Fj7/XoIZYaHg8q6d+TCrui/f74MTY2g1g==","signatures":[{"sig":"MEUCIGuGRnN0KUB0x5VN7WFLe2DJ2noYAthqXnTJluiTRh9VAiEAw4i8T5LjTks5zIWj0h2xn9rqWcIIeTW6XlhabDMGty4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":30357168},"type":"module","unpkg":"./dist/kokoro.web.js","browser":{"path":false,"fs/promises":false},"exports":{"node":{"import":"./dist/kokoro.js","require":"./dist/kokoro.cjs"},"types":"./types/kokoro.d.ts","default":"./dist/kokoro.web.js"},"gitHead":"5d5610e7d562fc55939fa7fc36a85156efbfc3ee","scripts":{"test":"vitest","build":"rm -rf dist types && rollup -c && tsc && cp ../LICENSE LICENSE","format":"prettier --write . --print-width 1000"},"_npmUser":{"name":"xenova","email":"admin@xenova.com"},"jsdelivr":"./dist/kokoro.web.js","repository":{"url":"git+https://github.com/hexgrad/kokoro.git","type":"git"},"_npmVersion":"10.8.2","description":"High-quality text-to-speech for the web","directories":{},"_nodeVersion":"20.18.1","dependencies":{"phonemizer":"^1.2.1","@huggingface/transformers":"^3.3.3"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"rollup":"^4.30.1","vitest":"^2.1.8","prettier":"3.4.2","typescript":"^5.7.3","@rollup/plugin-terser":"^0.4.4","@rollup/plugin-node-resolve":"^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/kokoro-js_1.1.1_1738942973785_0.042738326672079774","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"kokoro-js","version":"1.2.0","keywords":["kokoro","tts","text-to-speech"],"author":{"name":"hexgrad","email":"hello@hexgrad.com"},"license":"Apache-2.0","_id":"kokoro-js@1.2.0","maintainers":[{"name":"xenova","email":"admin@xenova.com"}],"contributors":[{"name":"Xenova"}],"homepage":"https://github.com/hexgrad/kokoro","bugs":{"url":"https://github.com/hexgrad/kokoro/issues"},"dist":{"shasum":"b95caec5f05132b1b91a032a441397422e1370c0","tarball":"https://registry.npmjs.org/kokoro-js/-/kokoro-js-1.2.0.tgz","fileCount":68,"integrity":"sha512-INAf7f2jBHc74DMgmPlpT+Ji6AvRU/lwi/GJQjP/gxoEY1tbscafIuu5j3qOc4BIspuyAGyYh2lP8OP/ccW4ww==","signatures":[{"sig":"MEUCIEIl1N4mfz75u3yTeNbgdZPHbjkMUVB3ZlM7ZMcybcuLAiEAsR+bHyX5V6IZ0KXFNL8uIInSbZ2sjV2WupW568I448U=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":30373489},"type":"module","unpkg":"./dist/kokoro.web.js","browser":{"path":false,"fs/promises":false},"exports":{"node":{"import":"./dist/kokoro.js","require":"./dist/kokoro.cjs"},"types":"./types/kokoro.d.ts","default":"./dist/kokoro.web.js"},"gitHead":"4af24977b56fecf859a3f575339ea1ecb4950d17","scripts":{"test":"vitest run","build":"rm -rf dist types && rollup -c && tsc && cp ../LICENSE LICENSE","format":"prettier --write . --print-width 1000"},"_npmUser":{"name":"xenova","email":"admin@xenova.com"},"jsdelivr":"./dist/kokoro.web.js","repository":{"url":"git+https://github.com/hexgrad/kokoro.git","type":"git"},"_npmVersion":"10.8.2","description":"High-quality text-to-speech for the web","directories":{},"_nodeVersion":"20.18.1","dependencies":{"phonemizer":"^1.2.1","@huggingface/transformers":"^3.3.3"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"rollup":"^4.30.1","vitest":"^2.1.8","prettier":"3.4.2","typescript":"^5.7.3","@rollup/plugin-terser":"^0.4.4","@rollup/plugin-node-resolve":"^16.0.0"},"_npmOperationalInternal":{"tmp":"tmp/kokoro-js_1.2.0_1739550616642_0.1507262145717887","host":"s3://npm-registry-packages-npm-production"}},"1.2.1":{"name":"kokoro-js","version":"1.2.1","type":"module","exports":{"types":"./types/kokoro.d.ts","node":{"import":"./dist/kokoro.js","require":"./dist/kokoro.cjs"},"default":"./dist/kokoro.js"},"scripts":{"build":"rm -rf dist types && rollup -c && tsc && cp ../LICENSE LICENSE","format":"prettier --write . --print-width 1000","test":"vitest run"},"keywords":["kokoro","tts","text-to-speech"],"author":{"name":"hexgrad","email":"hello@hexgrad.com"},"browser":{"path":false,"fs/promises":false},"contributors":[{"name":"Xenova"}],"license":"Apache-2.0","description":"High-quality text-to-speech for the web","dependencies":{"@huggingface/transformers":"^3.5.1","phonemizer":"^1.2.1"},"devDependencies":{"@rollup/plugin-node-resolve":"^16.0.0","@rollup/plugin-terser":"^0.4.4","prettier":"3.4.2","rollup":"^4.30.1","typescript":"^5.7.3","vitest":"^3.1.2"},"homepage":"https://github.com/hexgrad/kokoro","repository":{"type":"git","url":"git+https://github.com/hexgrad/kokoro.git"},"publishConfig":{"access":"public"},"jsdelivr":"./dist/kokoro.web.js","unpkg":"./dist/kokoro.web.js","_id":"kokoro-js@1.2.1","gitHead":"664c76a704021239ba59c84dcbaa4d3dece01fe9","bugs":{"url":"https://github.com/hexgrad/kokoro/issues"},"_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-oq0HZJWis3t8lERkMJh84WLU86dpYD0EuBPtqYnLlQzyFP1OkyBRDcweAqCfhNOpltyN9j/azp1H6uuC47gShw==","shasum":"a6a9b0ffc1ab354fa3f9cb71ee95b6e9f0a13527","tarball":"https://registry.npmjs.org/kokoro-js/-/kokoro-js-1.2.1.tgz","fileCount":68,"unpackedSize":30395646,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHz4ddt/vXjsMbzVz8+VUEmJgm4jYJL5w+6sqz/uzORqAiARnezl07N1bzdaLouP6ZgDyE8S1/lYW7IpyM6V3l8Uzg=="}]},"_npmUser":{"name":"xenova","email":"admin@xenova.com"},"directories":{},"maintainers":[{"name":"xenova","email":"admin@xenova.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/kokoro-js_1.2.1_1746247621472_0.3050134415463839"},"_hasShrinkwrap":false}},"time":{"created":"2025-01-15T19:08:25.174Z","modified":"2025-05-03T04:47:02.153Z","1.0.0":"2025-01-15T19:08:25.548Z","1.0.1":"2025-01-16T14:16:15.889Z","1.1.0":"2025-02-07T13:59:32.442Z","1.1.1":"2025-02-07T15:42:54.430Z","1.2.0":"2025-02-14T16:30:17.312Z","1.2.1":"2025-05-03T04:47:01.972Z"},"bugs":{"url":"https://github.com/hexgrad/kokoro/issues"},"author":{"name":"hexgrad","email":"hello@hexgrad.com"},"license":"Apache-2.0","homepage":"https://github.com/hexgrad/kokoro","keywords":["kokoro","tts","text-to-speech"],"repository":{"type":"git","url":"git+https://github.com/hexgrad/kokoro.git"},"description":"High-quality text-to-speech for the web","contributors":[{"name":"Xenova"}],"maintainers":[{"name":"xenova","email":"admin@xenova.com"}],"readme":"# Kokoro TTS\n\n<p align=\"center\">\n    <a href=\"https://www.npmjs.com/package/kokoro-js\"><img alt=\"NPM\" src=\"https://img.shields.io/npm/v/kokoro-js\"></a>\n    <a href=\"https://www.npmjs.com/package/kokoro-js\"><img alt=\"NPM Downloads\" src=\"https://img.shields.io/npm/dw/kokoro-js\"></a>\n    <a href=\"https://www.jsdelivr.com/package/npm/kokoro-js\"><img alt=\"jsDelivr Hits\" src=\"https://img.shields.io/jsdelivr/npm/hw/kokoro-js\"></a>\n    <a href=\"https://github.com/hexgrad/kokoro/blob/main/LICENSE\"><img alt=\"License\" src=\"https://img.shields.io/github/license/hexgrad/kokoro?color=blue\"></a>\n    <a href=\"https://huggingface.co/spaces/webml-community/kokoro-webgpu\"><img alt=\"Demo\" src=\"https://img.shields.io/badge/Hugging_Face-demo-green\"></a>\n</p>\n\nKokoro is a frontier TTS model for its size of 82 million parameters (text in/audio out). This JavaScript library allows the model to be run 100% locally in the browser thanks to [🤗 Transformers.js](https://huggingface.co/docs/transformers.js). Try it out using our [online demo](https://huggingface.co/spaces/webml-community/kokoro-webgpu)!\n\n## Usage\n\nFirst, install the `kokoro-js` library from [NPM](https://npmjs.com/package/kokoro-js) using:\n\n```bash\nnpm i kokoro-js\n```\n\nYou can then generate speech as follows:\n\n```js\nimport { KokoroTTS } from \"kokoro-js\";\n\nconst model_id = \"onnx-community/Kokoro-82M-v1.0-ONNX\";\nconst tts = await KokoroTTS.from_pretrained(model_id, {\n  dtype: \"q8\", // Options: \"fp32\", \"fp16\", \"q8\", \"q4\", \"q4f16\"\n  device: \"wasm\", // Options: \"wasm\", \"webgpu\" (web) or \"cpu\" (node). If using \"webgpu\", we recommend using dtype=\"fp32\".\n});\n\nconst text = \"Life is like a box of chocolates. You never know what you're gonna get.\";\nconst audio = await tts.generate(text, {\n  // Use `tts.list_voices()` to list all available voices\n  voice: \"af_heart\",\n});\naudio.save(\"audio.wav\");\n```\n\nOr if you'd prefer to stream the output, you can do that with:\n\n```js\nimport { KokoroTTS, TextSplitterStream } from \"kokoro-js\";\n\nconst model_id = \"onnx-community/Kokoro-82M-v1.0-ONNX\";\nconst tts = await KokoroTTS.from_pretrained(model_id, {\n  dtype: \"fp32\", // Options: \"fp32\", \"fp16\", \"q8\", \"q4\", \"q4f16\"\n  // device: \"webgpu\", // Options: \"wasm\", \"webgpu\" (web) or \"cpu\" (node).\n});\n\n// First, set up the stream\nconst splitter = new TextSplitterStream();\nconst stream = tts.stream(splitter);\n(async () => {\n  let i = 0;\n  for await (const { text, phonemes, audio } of stream) {\n    console.log({ text, phonemes });\n    audio.save(`audio-${i++}.wav`);\n  }\n})();\n\n// Next, add text to the stream. Note that the text can be added at different times.\n// For this example, let's pretend we're consuming text from an LLM, one word at a time.\nconst text = \"Kokoro is an open-weight TTS model with 82 million parameters. Despite its lightweight architecture, it delivers comparable quality to larger models while being significantly faster and more cost-efficient. With Apache-licensed weights, Kokoro can be deployed anywhere from production environments to personal projects. It can even run 100% locally in your browser, powered by Transformers.js!\";\nconst tokens = text.match(/\\s*\\S+/g);\nfor (const token of tokens) {\n  splitter.push(token);\n  await new Promise((resolve) => setTimeout(resolve, 10));\n}\n\n// Finally, close the stream to signal that no more text will be added.\nsplitter.close();\n\n// Alternatively, if you'd like to keep the stream open, but flush any remaining text, you can use the `flush` method.\n// splitter.flush();\n```\n\n## Voices/Samples\n\n> [!TIP]\n> You can find samples for each of the voices in the [model card](https://huggingface.co/onnx-community/Kokoro-82M-v1.0-ONNX#samples) on Hugging Face.\n\n### American English\n\n| Name         | Traits | Target Quality | Training Duration | Overall Grade |\n| ------------ | ------ | -------------- | ----------------- | ------------- |\n| **af_heart** | 🚺❤️   |                |                   | **A**         |\n| af_alloy     | 🚺     | B              | MM minutes        | C             |\n| af_aoede     | 🚺     | B              | H hours           | C+            |\n| af_bella     | 🚺🔥   | **A**          | **HH hours**      | **A-**        |\n| af_jessica   | 🚺     | C              | MM minutes        | D             |\n| af_kore      | 🚺     | B              | H hours           | C+            |\n| af_nicole    | 🚺🎧   | B              | **HH hours**      | B-            |\n| af_nova      | 🚺     | B              | MM minutes        | C             |\n| af_river     | 🚺     | C              | MM minutes        | D             |\n| af_sarah     | 🚺     | B              | H hours           | C+            |\n| af_sky       | 🚺     | B              | _M minutes_ 🤏    | C-            |\n| am_adam      | 🚹     | D              | H hours           | F+            |\n| am_echo      | 🚹     | C              | MM minutes        | D             |\n| am_eric      | 🚹     | C              | MM minutes        | D             |\n| am_fenrir    | 🚹     | B              | H hours           | C+            |\n| am_liam      | 🚹     | C              | MM minutes        | D             |\n| am_michael   | 🚹     | B              | H hours           | C+            |\n| am_onyx      | 🚹     | C              | MM minutes        | D             |\n| am_puck      | 🚹     | B              | H hours           | C+            |\n| am_santa     | 🚹     | C              | _M minutes_ 🤏    | D-            |\n\n### British English\n\n| Name        | Traits | Target Quality | Training Duration | Overall Grade |\n| ----------- | ------ | -------------- | ----------------- | ------------- |\n| bf_alice    | 🚺     | C              | MM minutes        | D             |\n| bf_emma     | 🚺     | B              | **HH hours**      | B-            |\n| bf_isabella | 🚺     | B              | MM minutes        | C             |\n| bf_lily     | 🚺     | C              | MM minutes        | D             |\n| bm_daniel   | 🚹     | C              | MM minutes        | D             |\n| bm_fable    | 🚹     | B              | MM minutes        | C             |\n| bm_george   | 🚹     | B              | MM minutes        | C             |\n| bm_lewis    | 🚹     | C              | H hours           | D+            |\n","readmeFilename":"README.md"}