-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create outetts
JS library for text-to-speech in the browser, Node.js, Deno, Bun, etc.
#42
Conversation
v1 for the web demo: output.mp4 |
After going down a long rabbit hole of number -> word conversion (and finding bugs in jaraco/inflect#226), I've got it working. One interesting thing I found while testing is that - even with the python version - dates, like 2016 get read as "twenty sixteen", even though the number is split as "two thousand and sixteen". Also, numbers on their own aren't spoken very well. Might be an improvement for v3. Example: 2016.mp4 |
Yeah, the numbers definitely need some improvement, and the next version should address this as well. It also does not seem to have the issue you mentioned. For example: from num2words import num2words
for _ in range(10000):
if num2words(0.000001) != 'zero point zero zero zero zero zero one':
print("Failed") |
Ran into an issue: import en_female_2 from "./default_speakers/en_female_2.json" assert { type: "json" };
^^^^^^
SyntaxError: Unexpected identifier 'assert'
at compileSourceTextModule (node:internal/modules/esm/utils:338:16)
at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:103:18)
at #translate (node:internal/modules/esm/loader:433:12)
at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:480:27)
Node.js v23.1.0 Not very knowledgeable in JS, but switching from import en_female_1 from "./default_speakers/en_female_1.json" with { type: "json" };
import en_female_2 from "./default_speakers/en_female_2.json" with { type: "json" };
import en_male_1 from "./default_speakers/en_male_1.json" with { type: "json" };
import en_male_2 from "./default_speakers/en_male_2.json" with { type: "json" };
import en_male_3 from "./default_speakers/en_male_3.json" with { type: "json" };
import en_male_4 from "./default_speakers/en_male_4.json" with { type: "json" };
import ja_female_1 from "./default_speakers/ja_female_1.json" with { type: "json" };
import ja_female_2 from "./default_speakers/ja_female_2.json" with { type: "json" };
import ja_female_3 from "./default_speakers/ja_female_3.json" with { type: "json" };
import ja_male_1 from "./default_speakers/ja_male_1.json" with { type: "json" };
import ko_female_1 from "./default_speakers/ko_female_1.json" with { type: "json" };
import ko_female_2 from "./default_speakers/ko_female_2.json" with { type: "json" };
import ko_male_1 from "./default_speakers/ko_male_1.json" with { type: "json" };
import ko_male_2 from "./default_speakers/ko_male_2.json" with { type: "json" };
import zh_female_1 from "./default_speakers/zh_female_1.json" with { type: "json" };
import zh_male_1 from "./default_speakers/zh_male_1.json" with { type: "json" }; |
Good point! I was using the older syntax still. Will update 👍 |
Published the current dev code to the npm package: npm i outetts I ran the example code, and everything seems to be working. |
I'll move the PR to "ready to review" soon - just waiting for an upstream bugfix in onnxruntime-web to fix WebGPU implementation of audio decoder. This will be released in Transformers.js v3.1.2 👍 |
https://www.npmjs.com/package/@huggingface/transformers/v/3.1.2 is out. Updating package now 👍 |
Online demo: https://huggingface.co/spaces/webml-community/text-to-speech-webgpu Also, marking as ready (even though the audio decoder still runs on CPU). That can be added in an update :) PS: https://www.npmjs.com/package/outetts seems to be private/down, so I've installed from source for now. |
outetts
JS library for text-to-speech in the browser, Node.js, Deno, Bun, etc.outetts
JS library for text-to-speech in the browser, Node.js, Deno, Bun, etc.
Looks good, merged it! Thanks for putting this together :)
Hmm, seems to work fine, tried installing on a few different devices with no issues. Is it not loading for you? |
Amazing! 🥳 It was an issue on my side - all good now! |
This PR creates a JavaScript version of outetts, allowing the models to be run 100% locally in the browser using Transformers.js. It also supports running in other JavaScript environments like Node.js, Deno, Bun, etc.
I've tried to keep the API as similar to the python library as possible.
Example code: