# Kokoro TTS
Kokoro 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-web)! ## Usage First, install the `kokoro-js` library from [NPM](https://npmjs.com/package/kokoro-js) using: ```bash npm i kokoro-js ``` You can then generate speech as follows: ```js import { KokoroTTS } from "kokoro-js"; const model_id = "onnx-community/Kokoro-82M-ONNX"; const tts = await KokoroTTS.from_pretrained(model_id, { dtype: "q8", // Options: "fp32", "fp16", "q8", "q4", "q4f16" }); const text = "Life is like a box of chocolates. You never know what you're gonna get."; const audio = await tts.generate(text, { // Use `tts.list_voices()` to list all available voices voice: "af_bella", }); audio.save("audio.wav"); ``` ## Voices/Samples > Life is like a box of chocolates. You never know what you're gonna get. | Voice | Nationality | Gender | Sample | | ------------------------ | ----------- | ------ | -------------------------------------------------------------------------------------------------------- | | Default (`af`) | American | Female | | | Bella (`af_bella`) | American | Female | | | Nicole (`af_nicole`) | American | Female | | | Sarah (`af_sarah`) | American | Female | | | Sky (`af_sky`) | American | Female | | | Adam (`am_adam`) | American | Male | | | Michael (`am_michael`) | American | Male | | | Emma (`bf_emma`) | British | Female | | | Isabella (`bf_isabella`) | British | Female | | | George (`bm_george`) | British | Male | | | Lewis (`bm_lewis`) | British | Male | |