mimiuchi icon indicating copy to clipboard operation
mimiuchi copied to clipboard

[Suggestion] Play Audio While Text is Generating

Open AichiChikuwa opened this issue 2 years ago • 11 comments

As the title says. I've looked the code, however, and I don't see there's an easy "On_Text_Generating" flag tho...

AichiChikuwa avatar Oct 20 '23 04:10 AichiChikuwa

Nevermind I found it. There's an obvious 'Talking' flag.

AichiChikuwa avatar Oct 20 '23 05:10 AichiChikuwa

oh yes, that is done here: https://github.com/naeruru/mimiuchi/blob/main/src/modules/speech/WebSpeech.ts#L89

what kind of sound would it play? some sort of ding that plays when it starts generating text?

naeruru avatar Oct 20 '23 05:10 naeruru

That can be an option, but what I actually want is that it loops an audio file while talking flag is true. I've done the code locally. It's gonna be just for my personal use tho. Not gonna share it to anyone so don't worry.

AichiChikuwa avatar Oct 20 '23 06:10 AichiChikuwa

Wait I misunderstood. I want it to work on the electron app so I need it the audio method to be called when the posted json from websocket is parsed. I haven't found that part of the code yet..

AichiChikuwa avatar Oct 20 '23 06:10 AichiChikuwa

it is currently in an obnoxious spot. I was in the middle of restructuring stuff: https://github.com/naeruru/mimiuchi/blob/main/src/components/Footer.vue#L204

the callback is called once the electron app receives text from the websocket using receive-text-event

you could also just use on_submit(...) in speech.ts which is where that callback eventually leads to. and check foris_electron().

also logStore.loading_result is used to tell the app that a result is currently being processed. It is set in on_submit()

naeruru avatar Oct 20 '23 07:10 naeruru

Thanks! That helps a lot! Could you please also tell me where I can disable censoring if you don't mind?

AichiChikuwa avatar Oct 20 '23 07:10 AichiChikuwa

sadly censoring is done where the speech is being processed (Google when using chrome) and is totally out of my control. I’d have to apply some sort of heuristic on what is returned. A similar app (that’s sadly shutting down), had an option that had something to solve this (https://webcaptioner.com/captioner/settings/general) but I think it wasn’t perfect since it just guesses.

ultimately I want to give more options for speech to text which would circumvent this, but that’s the dilemma until then

naeruru avatar Oct 20 '23 07:10 naeruru

That's fine! Thank you so much! I've got my code working!

AichiChikuwa avatar Oct 20 '23 07:10 AichiChikuwa

Oh I probably shouldn't close it as it's an inconclusive suggestion lol. So I just made the app play animalese audio while i'm speaking. Do you think if that's an good idea to add in the app? I should say this earlier but your app is great! Thanks for the effort of making this!

AichiChikuwa avatar Oct 20 '23 07:10 AichiChikuwa

oh animalese cute^^ yeah I think that’d be a nice addition. feel free to PR if you want. as long as the sound file is free use.

~~It will also need an option in the settings to toggle it on and off though (default off). settings are managed in states folder using pinia.~~ wait nvm, I think we should just put it in the TTS voices as a new “service.” — but then at that point I think it should be able to be turned on for either web or electron independently. If you don’t wanna do that I can always try to amend the PR when you send it when I get some time to

naeruru avatar Oct 20 '23 08:10 naeruru

I just hardcoded it to suite my use lol. But yea it's my pleasure to give the app an additional feature!

AichiChikuwa avatar Oct 20 '23 08:10 AichiChikuwa