Skip to content
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

Adds TTS to announcements made by the Captain and silicons #73967

Closed
wants to merge 52 commits into from

Conversation

Watermelon914
Copy link
Member

Copy from #72300

About The Pull Request

TTS currently can't handle every client having their own voice, so it's been limited to announcements made by the Captain and silicon players.
In the future, if we get a GPU server, it may become a more viable option to implement every client having their own voice because GPUs are great at concurrency.

It's all handled via python http requests to a local server. Docker is required to set up, but the container can be held on a separate linux server as it's only used to process text into audio and send it back via http requests.

TTS engine used in python script:
VITS: https://arxiv.org/pdf/2106.06103
coqui: https://github.com/coqui-ai/TTS

Base image is debian.

This is all handled locally. There are no calls to a third-party service.

Why It's Good For The Game

TTS is cool.

Changelog

🆑 Watermelon914, Iamgoofball, MrStonedOne
add: Adds TTS to announcements made by the Captain and silicon players.
/:cl:

@Mothblocks Mothblocks marked this pull request as draft March 14, 2023 00:58
@castawaynont
Copy link
Contributor

sounds awful in game

@Draggeru
Copy link
Contributor

Even when the option is ticked off, I'm still hearing the TTS in game. I have no idea why.

@Mothblocks
Copy link
Member

Can you upload an example recording of this

@TheSmallBlue
Copy link
Contributor

It's supposedly testmerged on many servers but, for example, in Manuel its testmerging the old closed PR and it just. doesn't work.

@dessysalta
Copy link
Contributor

When in the lobby, you can hear any TTS announcements the captain/AI makes.

@Watermelon914
Copy link
Member Author

Watermelon914 commented Mar 15, 2023

When in the lobby, you can hear any TTS announcements the captain/AI makes.

I'll look into this, this shouldn't be the case

@Watermelon914
Copy link
Member Author

Can you upload an example recording of this

https://user-images.githubusercontent.com/37270891/225313437-5cdde27b-225a-40ef-a9fe-c25ab2d0e3b6.mp4
https://user-images.githubusercontent.com/37270891/225313471-de813e89-1430-44ef-9ec2-685097874c2d.mp4

I'm probably going to work on it a bit more to add more reverb since it doesn't have that intercom feel right now and it sounds like it's coming from inside your head. It needs reverb/echo and the filters make it sound robotic more than anything.
Borg voice also isn't great so I'll look into tweaking the filters for that as well. All in all, the testmerges were to just make sure it's still functional but it definitely needs polishing

@MrMelbert
Copy link
Contributor

Even when the option is ticked off, I'm still hearing the TTS in game. I have no idea why.

Quite confused about this, because my TTS preferences are ticked on and I can't hear any announcements.

@MrStonedOne
Copy link
Member

The test merge was only fixed on one of the servers it got test merged to, the other still had the version that had the inverted preferences bug.

@Mothblocks
Copy link
Member

Mothblocks commented Mar 16, 2023

Can you upload an example recording of this

https://user-images.githubusercontent.com/37270891/225313437-5cdde27b-225a-40ef-a9fe-c25ab2d0e3b6.mp4 https://user-images.githubusercontent.com/37270891/225313471-de813e89-1430-44ef-9ec2-685097874c2d.mp4

I'm probably going to work on it a bit more to add more reverb since it doesn't have that intercom feel right now and it sounds like it's coming from inside your head. It needs reverb/echo and the filters make it sound robotic more than anything. Borg voice also isn't great so I'll look into tweaking the filters for that as well. All in all, the testmerges were to just make sure it's still functional but it definitely needs polishing

I know our limitations but I really wish these sounded magnitudes better, I am hesitant to call this acceptable

@Watermelon914
Copy link
Member Author

I know our limitations but I really wish these sounded magnitudes better, I am hesitant to call this acceptable

These sound bad right now because there's a lack of reverb and the filters are not as good as they could be. I'm not a sound engineer so I'll need to do some more research in order to get them to a good state.
Additionally, there is the option of training my own model using the current AI VOX we have and making it silicon only, but that's going to cost money.

@Mothblocks
Copy link
Member

They speak extremely fast and stumble over their words, we can't fix that with filters but I understand that we're extremely limited with the requirements we have for TTS

@MrStonedOne
Copy link
Member

I'm pretty sure tempo can be messed with in the python script.

@Watermelon914
Copy link
Member Author

I'm pretty sure tempo can be messed with in the python script.

You can also mess with tempo using the filters from ffmpeg. It's just that ffmpeg sucks at providing good reverb effects and you basically need another library if you want to apply reverb effects.
Though, byond already offers a way to give reverb to sound files that you send to the client, but assuming we want to play these sound files via browser to get around byond's handling of IO (to prevent clients with low latency from freezing up), then we'd need to apply the reverb to the sound file.

Watermelon914 and others added 2 commits March 21, 2023 12:30
…ures/game_preferences/sounds.tsx

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
…ures/game_preferences/sounds.tsx

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
@github-actions github-actions bot added the Merge Conflict Adding upstream files to your repo via drag and drop won't resolve conflicts label Mar 23, 2023
@Watermelon914
Copy link
Member Author

Can't really find the motivation to work on this, I may end up opening it up again in the future, but I'm not really a sound engineer, I haven't got a clue on how to make it sound good and like an intercom.

@Watermelon914
Copy link
Member Author

re-opening since I'm working on this again + need to respond to threads

@Watermelon914 Watermelon914 reopened this Apr 16, 2023
@TheSmallBlue
Copy link
Contributor

We are SO back....

@tgstation-server tgstation-server removed the Merge Conflict Adding upstream files to your repo via drag and drop won't resolve conflicts label Apr 16, 2023
@TheSmallBlue
Copy link
Contributor

Damn OK, nevermind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Config Update Time to bother the headadmins for three months to get your config applied Feature Exposes new bugs in interesting ways 📌 Test Merge Candidate This version will not be removed by actions when the PR is updated Tools We pretend to be a real development community UI We make the game less playable, but with round edges
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet