techygrrrl
techygrrrl's blog

techygrrrl's blog

Multilingual Text-to-Speech (TTS) app for Twitch on Windows

Multilingual Text-to-Speech (TTS) app for Twitch on Windows

techygrrrl's photo
techygrrrl
·Jan 10, 2022·

7 min read

Table of contents

I recently bought a Windows computer for streaming and PC gaming. Some games require my full, undivided attention, which means I can't use my eyeballs to read chat. Text-to-speech is a great solution to that problem, allowing me to stay on top of chat while being able to pay attention to the game I'm playing.

This post will go into detail about the Windows app. As of June, I've also built a Mac one—you can read about that in this blog post.

This post will talk about the features of the app, include a demo, I'll talk about why I built it, and finally link to the download.

image.png

Features

Multilingual

Automatically supports English, French and Spanish. Username reading is in English, e.g. "techygrrrl says" while the message that follows will have its language autodetected and use a pre-installed voice for English, French or Spanish. If an unsupported language is detected, it falls back to English.

For this to work, you will need to install voices in these languages on Windows 10 or 11. You may also find this list of all available voices useful. While my app doesn't currently support more than these 3 languages, it's relatively low effort to add new languages, so I plan on adding more languages in the future.

Speed controls

The app allows you to choose between 3 read speeds (slow, medium, fast) to hear your messages at a speed that works best for you.

Word Replacements

A basic implementation of word replacement is added. Replaces words in both chat messages and usernames. This is useful in the event that default pronunciations are either inaccurate or too verbose. For example, my username sounds terrible in TTS, and this is probably the main driver for me developing this feature.

Synchronous reading

Chats are read synchronously rather than asynchronously, meaning that in order for a message to begin being read aloud, the previous message is finished being read. This prevents messages from being read on top of each other.

Ignore List

As of February 21, 2022, there is now a feature to add usernames to an ignore list so that all messages from that username are ignored. This feature can be used to ignore your chat bots to avoid noise. So, for example, if I add the username StreamElements, all messages from the StreamElements bot will be skipped and not read aloud by the TTS app.

Watch the Demo

Here's a demo video of the Multilingual TTS for Twitch app I built. In this video I install it from the zip file that's available for download, and use all the features available at the time of launch.

Why did I build my own instead of using an existing app?

There are some existing solutions already out there like Twitch TTS on the Microsoft Store and Speech Chat, a website, but these didn't work for me for a number of reasons.

There may be other apps out there but these are the only ones I considered. If you have other app suggestions, feel free to link them in the comments below.

This section will touch on each concern I had with the 2 apps I tried. Feel free to skip this whole section if you don't care about that.

Security and Privacy

My main concern was with Speech Chat's request for permissions, and unfortunately Twitch permissions are all or nothing.

This is what it looks like when it requests Twitch authorization when you sign up. A bit excessive, in my opinion.

Screen Shot 2022-01-09 at 13.47.17 PM.png

The only permission that's actually needed is the ability to read channel messages, and this can be done anonymously without authentication.

The Multilingual TTS for Twitch app that I built does not ask you to authenticate with Twitch, you just provide any username for the chat you want to listen to.

The official tmi.js library by Twitch allows you to connect anonymously to a channel's chat if all you're doing is reading messages. It's even on the first page of the documentation. Even though the Multilingual TTS for Twitch app that I built is not written in JavaScript, the connection approach my TTS app uses is similar. I had no privacy or security concerns with the Twitch TTS app on the Microsoft store as it uses the tmi.js library with this anonymous connection approach.

image.png

Language Support

Support for other languages is lacking or non-existent. If you look up the term "languages" in the Speech Chat forums, you can see there's some chatter around that any responses don't inspire any amount of confidence that this functionality is working. They appear to have support for voice commands users can do but support does not appear to be automated in any way.

The above-mentioned Twitch TTS app in the Microsoft Store has even less support for languages, and actually appears to make the assumption that all your installed languages would be in the same language as your stream. It cycles through all of the installed languages randomly assigning a new language to a new message. This means that your messages will be read in the language of the randomly-selected voice, likely resulting in the wrong language being used for the message.

My Multilingual TTS for Twitch app automatically detects the language of the message and uses a voice in that language if it exists. Right now it has been fully tested to work with English, French and Spanish with the goal to add more languages.

Chat message overlapping

The Twitch TTS app available in the Microsoft store has an issue that if multiple users send messages, the app begins to read them when they are received, rather than when the previous message has been completed. This causes messages to be read on top of each other, which means you may miss what is said. I'm not a big streamer and I don't have that many chatters at the same time, but I found it hard to follow even 2 messages being read on top of each other. This app would be unusable for people with more active chats than mine.

While I didn't test Speech Chat, I have been to streams where the streamer is using it and it's broadcasting, and I have not noticed these concerns, so I'd say that this concern does not exist with Speech Chat.

Tech Stack

This app is built using Visual Studio 2017 and Windows Presentation Foundation (WPF), an XML-based framework for building UI.

It uses the Speech API's System.Speech.Synthesis's SpeechSynthesizer for the bulk of its functionality.

Language detection uses ntextcat.

Download and Install

Download the latest release and see all releases here: github.com/techygrrrl/multilang-twitch-tts/..

  1. Download the TwitchTTSMultilang-techygrrrl.stream.zip file from the link above
  2. Open the .zip file you just downloaded
  3. Double click the setup.exe file to launch the installer

The demo video linked above demonstrates how to install it.

I am not registered as a developer on Microsoft's platform so if you have trouble installing this app, you may need to change your permissions and either allow installing apps from unknown publishers, or specifically unblock this app.

Sound setup

By default, when you use any TTS app it will be part of your desktop audio, so if you're playing a PC game, you may be streaming your desktop audio, causing you to stream your TTS output. If you don't want to stream your TTS output, you'll need to configure your sound on Windows to multiple output devices and only stream one of them.

These instructions should work for any TTS app, not just mine.

Configuring Windows sound settings for this is fairly complex, here are some articles:

TL;DR:

  • Enable StereoMix in Windows (or re-enable)
  • Add StereoMix as an audio input in OBS
  • In Windows Sound settings, route the audio that you plan on streaming to desktop audio (and not headphones), e.g. if I'm playing a PC game, that game audio should be routed to desktop audio.
  • Route audio I don't want to stream directly to my headphones, e.g. any TTS app
  • Go into Sound -> More Sound settings
    • Under Playback, make headphones the default audio (if not already)
    • Under Recording, go into StreeoMix properties and click the checkbox Listen to this device. Choose Playback through this device (e.g. laptop speakers)

After streaming:

  • Go into Sound settings -> Input, and assuming StereoMix is selected, click the Mute microphone icon button (to disable StereoMix input)

Before your text stream:

  • Go into Sound settings -> Input -> choose StereoMix (if not selected already) -> Unmute microphone
  • Ensure desktop audio is disabled in OBS and only StereoMix is enabled in OBS so you don't get TTS audio output to your stream.

Uninstalling

If you decide this isn't for you, you can uninstall the app by going into Add or Remove programs in your Settings, which can be easily accessed by hitting the Windows key and typing "remove" and selecting the right option.

Request Features

To request new features or vote on other requested features, create a new issue in the issue queue or comment on an existing issue.

Request new features or show your support for existing request at the following link: github.com/techygrrrl/multilang-twitch-tts/..

 
Share this