Text to Speech (TTS) integration for JanitorAI using built-in voices, ElevenLabs TTS, and Gemini TTS with emotion analysis and audio segmentation.
< 脚本 JanitorAI - Text to Speech - Built-in/ElevenLabs/GeminiTTS 的反馈
Hi! That’s because JAI updated their chat code — they changed the names of some HTML variables, so the script can’t find the text it’s supposed to filter and apply TTS to. I'll update when I get back home (also I forgot to upload the Elevenlabs support update mb lol, I'm also working on a script that adds a live2d model and does lipsync with the tts)
Oh, okay. It makes sense that some element ID and class names change. If you can ever find something you know won't change, you can sometimes use it alongside parent() to target the element that does sometimes change. For example, if element#neverchanges never changes and it is the child of element#sometimeschanges, you could do a element#neverchanges.parent() to target element#sometimeschanges and if the #sometimeschanges does change the userscript will still work. I don't like paying for subscriptions or services so I don't use ElevenLabs, but it is good that you are working on it for those who do. Zira's voice sounds like complete crap though, which is why I stopped using this userscript a couple of months ago. I wish that you could figure out what this Google Extension did: 'https://chromewebstore.google.com/detail/ms-edge-tts-text-to-speec/oajalfneblkfiejoadecnmodfpnaeblh' because for English > USA, they have a 'Michelle' voice that is absolutely divine but it doesn't cost anything to use it. It's really weird because that 'Michelle' voice is a SAPI5 voice which is not supported in Chrome, but that extension found a way to add it or a clone of it anyway. As for the Live2D model and lip syncing stuff, that has NEVER interested me. JanitorAI has its own thumbnail images that you can enlarge and look at during chat. But for me, to see some anime character covering my screen talking at me creeps me out. But I do believe a lot of people will like that feature, including yourself, so I can understand if you keep working at it. I just hope it won't distract you or overwhelm you on the more important matters. Anyway, thank you for the reply. Have a great day. Oh, another thing about your userscript is that it waits until the AI reply has finished typing before speaking it aloud. My AI responses are super long so it's a long wait. If you ever figure out a way to make it speak aloud at the same time it is typing, it would speed things up. But I think that would take a lot of work and code knowledge to do.
Hi! Okay, so I figured out how to use Edge TTS on the script. The thing is, it's using an NPM library, so you'll have to disable the Content Security Policy (CSP) in your Tampermonkey settings if you want it to work. Another problem is that it's not very stable; the audio sounds 'glitched' or like it has 'interference' when the text is around 100 words or more. Oh, and I also added the function to use TTS while the text is streaming. It'll apply TTS with a small delay (to ensure that there are no pauses) that you can configure. I'll do some tests to ensure its compatibility with my Live2D script before posting.
It sounds like you made some major progress on many different things. Awesome. I don't use Tampermonkey. I was using Violentmonkey, but then I switched to ScriptCat around 1.5 or 2 weeks ago. I don't know if it has a CSP setting or not. Even if it did, I don't feel comfortable disabling security features. But I can test it in ScriptCat and report to you if it works or not. That is unfortunate that the sound gets glitchy after 100 words. My responses are like 5-6 paragraphs long, sot hat is definitely more than 100 words. But yeah, it sounds like you made some major changes. By the way, I still like JanitorAI, but I've mostly been using AI Dungeon the last one or two months. You should give it a try. It's more advanced and is better overall.
By the way, you should consider moving this userscript to SleazyFork. GreasyFork and SleazyFork are the same thing, but GreasyFork is for PG website userscripts and SleazyFork is for NSFW website userscripts. Both websites use the same login information. If you do move it to SleazyFork, please let me know the new URL to your userscript. I haven't used JanitorAI or your userscript in ages, but I sitll want to keep tabs on it.
For some reason, it is not working for me anymore. It doesn't auto generate TTS. And if I manually click the play button, it shows "playing" for two seconds (don't hear any audio) and then it stops by itself even though it should be 30 or so seconds of audio.
It has only been two months since I last used this userscript, and the userscript hasn't been updated during that time so I don't know why it isn't working anymore.