{"_id":"@abreza/piper-tts-web","name":"@abreza/piper-tts-web","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.4":{"name":"@abreza/piper-tts-web","private":false,"version":"1.0.4","description":"Fork of @diffusion-studio/vits-web for easier built-in PiperTTS use.","type":"module","module":"./dist/piper-tts-web.js","types":"./dist/index.d.ts","author":{"name":"team@mintplexlabs.com"},"exports":{".":{"import":"./dist/piper-tts-web.js","types":"./dist/index.d.ts"}},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+ssh://git@github.com/abreza/piper-tts-web.git"},"homepage":"https://github.com/abreza/piper-tts-web#readme","license":"MIT","keywords":["vits","webassembly","emscripten","audio","browser","tts","text-to-speech","speech synthesis","web ai","webnn","piperTTS","AnythingLLM"],"scripts":{"dev":"vite","build":"rm -r -f ./dist && tsc && vite build","preview":"vite preview","test":"npx playwright test --project=chromium","verify":"yarn build && cd scripts && node refresh-and-validate.mjs && cd .."},"devDependencies":{"@playwright/test":"^1.35.1","object-deep-compare":"^1.2.0","typescript":"^5.2.2","vite":"^5.3.1","vite-plugin-dts":"^3.9.1"},"peerDependencies":{"onnxruntime-web":"^1.18.0"},"dependencies":{"onnxruntime-web":"^1.22.0"},"_id":"@abreza/piper-tts-web@1.0.4","gitHead":"7c48960800fae0ff4472a0e3e8b876dcb2df186c","bugs":{"url":"https://github.com/abreza/piper-tts-web/issues"},"_nodeVersion":"22.13.1","_npmVersion":"11.1.0","dist":{"integrity":"sha512-2T8BbewGT4RPUnydN4h3u3mg4bl8TM+HwFhRkbTIVBpfJCGS3i2ZYlsi8TtMmLzqiq0DOO3Fv8BhQ0XAgEa64Q==","shasum":"0afa2627bcf4d45b29ccc4cc1204cc9fe71917a6","tarball":"https://registry.npmjs.org/@abreza/piper-tts-web/-/piper-tts-web-1.0.4.tgz","fileCount":16,"unpackedSize":492551,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDRFLN8xe1BHqrc94zW8BCWYl/EM/SXtG2molo+jmXX2gIhAIbLq+SJi/W5fFayIikJ44UT3DNuC2EgtS/6LaOpfbtO"}]},"_npmUser":{"name":"abreza","email":"a.re.morteza@gmail.com"},"directories":{},"maintainers":[{"name":"abreza","email":"a.re.morteza@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/piper-tts-web_1.0.4_1748470178527_0.14263688475641434"},"_hasShrinkwrap":false}},"time":{"created":"2025-05-28T22:09:38.463Z","1.0.4":"2025-05-28T22:09:38.815Z","modified":"2025-05-28T22:09:39.123Z"},"maintainers":[{"name":"abreza","email":"a.re.morteza@gmail.com"}],"description":"Fork of @diffusion-studio/vits-web for easier built-in PiperTTS use.","homepage":"https://github.com/abreza/piper-tts-web#readme","keywords":["vits","webassembly","emscripten","audio","browser","tts","text-to-speech","speech synthesis","web ai","webnn","piperTTS","AnythingLLM"],"repository":{"type":"git","url":"git+ssh://git@github.com/abreza/piper-tts-web.git"},"author":{"name":"team@mintplexlabs.com"},"bugs":{"url":"https://github.com/abreza/piper-tts-web/issues"},"license":"MIT","readme":"> This is a fork of [@diffusion-studio/vits-web](https://github.com/diffusion-studio/vits-web) for use\n> of PiperTTS modules inside of a browser/Electron for AnythingLLM.\n> A big shout-out goes to [Rhasspy Piper](https://github.com/rhasspy/piper), who open-sourced all the currently available models > (MIT License) and to [@jozefchutka](https://github.com/jozefchutka) who came up with the wasm build steps.\n\n# Run PiperTTS based text-to-speech in the browser powered by the [ONNX Runtime](https://onnxruntime.ai/)\n\n## Difference from the original\n\n### Caching for client\n\nYou can leverage `TTSSessions` for a faster inference. (see index.js for implementation)\nCredit to [this PR](https://github.com/diffusion-studio/vits-web/pull/5) for the starting point.\n\n### Local WASM/Loading\n\nYou can define local WASM paths for the `ort` wasm as well as the phenomizer wasm and data file for faster local loading\nsince the client could be offline.\n\n### Note:\n\nThis is a frontend library and will not work with NodeJS.\n\n## Usage\nFirst of all, you need to install the library:\n```bash\nyarn add @mintplex-labs/piper-tts-web\n```\n\nThen you're able to import the library like this (ES only)\n```typescript\nimport * as tts from '@mintplex-labs/piper-tts-web';\n```\n\nNow you can start synthesizing speech!\n```typescript\nconst wav = await tts.predict({\n  text: \"Text to speech in the browser is amazing!\",\n  voiceId: 'en_US-hfc_female-medium',\n});\n\nconst audio = new Audio();\naudio.src = URL.createObjectURL(wav);\naudio.play();\n\n// as seen in /example with Web Worker\n```\n\n\nWith the initial run of the predict function you will download the model which will then be stored in your [Origin private file system](https://developer.mozilla.org/en-US/docs/Web/API/File_System_API/Origin_private_file_system). You can also do this manually in advance *(recommended)*, as follows:\n```typescript\nawait tts.download('en_US-hfc_female-medium', (progress) => {\n  console.log(`Downloading ${progress.url} - ${Math.round(progress.loaded * 100 / progress.total)}%`);\n});\n```\n\nThe predict function also accepts a download progress callback as the second argument (`tts.predict(..., console.log)`). <br>\n\nIf you want to know which models have already been stored, do the following\n```typescript\nconsole.log(await tts.stored());\n\n// will log ['en_US-hfc_female-medium']\n```\n\nYou can remove models from opfs by calling\n```typescript\nawait tts.remove('en_US-hfc_female-medium');\n\n// alternatively delete all\n\nawait tts.flush();\n```\n\nAnd last but not least use this snippet if you would like to retrieve all available voices:\n```typescript\nconsole.log(await tts.voices());\n\n// Hint: the key can be used as voiceId\n```\n\n### **That's it!** Happy coding :)\n","readmeFilename":"README.md","_rev":"1-ebf6d7e04b268f409095900574252c34"}