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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to change the "text to voice" language? #23

Open
CombeeMike opened this issue Jun 1, 2020 · 7 comments
Open

Is it possible to change the "text to voice" language? #23

CombeeMike opened this issue Jun 1, 2020 · 7 comments

Comments

@CombeeMike
Copy link

I just found out that I can change the "recognized words" by editing words.txt, which is perfect since I can adjust them to my individual needs!

The logical next step would be to add words in my (and my childs 馃槈) native language German. In order for this to make sense, I'd also like to hear those recognized words pronounced correctly by a "German voice".

Is it possible to change the voice to a German one by adjusting some file or windows system setting?

@Daniel-Svensson
Copy link

The app seams to use System.Speech so it should be possible

I have not tried it myself but found some information earlier when researching the issue, maybe the following can help? https://stackoverflow.com/questions/29163994/adding-a-new-language-to-speechsynthesizer

@CombeeMike
Copy link
Author

I managed to change the language by adjusting the code & making a custom build of mine:

Controller.cs:ThreadedSpeak constructor

// Original
CultureInfo keyboardLanguage = System.Windows.Forms.InputLanguage.CurrentInputLanguage.Culture;
InstalledVoice neededVoice = this.SpeechSynth.GetInstalledVoices(keyboardLanguage).FirstOrDefault();

// Force german voice
CultureInfo culture = CultureInfo.GetCultureInfo("de-DE");
InstalledVoice neededVoice = this.SpeechSynth.GetInstalledVoices(culture).FirstOrDefault();

I guess there's no way right now to change this via some some config file etc. but only by either creating a custom build like I did or by changing the default input language which I wanted to avoid for several reasons.

@DennisGaida
Copy link

Figured out that changing the text-to-speech language is rather easy: Use the Windows language preference selector (keyboard/language). Changing that from English to German also changed the text-to-speech voice for me.

image

@ruiefe
Copy link

ruiefe commented May 20, 2022

I managed to change the language by adjusting the code & making a custom build of mine:

Controller.cs:ThreadedSpeak constructor

// Original
CultureInfo keyboardLanguage = System.Windows.Forms.InputLanguage.CurrentInputLanguage.Culture;
InstalledVoice neededVoice = this.SpeechSynth.GetInstalledVoices(keyboardLanguage).FirstOrDefault();

// Force german voice
CultureInfo culture = CultureInfo.GetCultureInfo("de-DE");
InstalledVoice neededVoice = this.SpeechSynth.GetInstalledVoices(culture).FirstOrDefault();

I guess there's no way right now to change this via some some config file etc. but only by either creating a custom build like I did or by changing the default input language which I wanted to avoid for several reasons.

I was trying to compile (with the commands Dotnet and msbuild) for portuguese (pt-pt) following @CombeeMike solution but I have a lot of errors (libraries that were installed but are not found like .NetFramework and NewtonSoft, etc.) and cannot do it - I'm googling every error but when I think I found a solution for an error another one follows. I am using Visual Studio Code last version to compile. I am a COMPLETE newbie, as you already knew!

  1. Are those errors are to be expected (or what am I doing wrong)?
    I work with Special Needs Students. I use BabySmash since the beggining as an example of some cool things for teachers I work with but I don't use it with the kids because of the English language. With the Portuguese localization (that I tried before) I could use Baby Smash with the kids.
    Thank you.

@DavidRieman
Copy link
Contributor

DavidRieman commented Oct 18, 2022

@ruiefe I just now got my own fork of BabySmash updated to latest dependencies and added a couple tiny improvements. So I tried this out. I did repro the NetwonSoft dependency problems, but...

BabySmash builds best via Visual Studio editions other than VSCode; Visual Studio 2019 is also free and gets past the dependency problems that dotnet build BabySmash.sln command line seems to have problems with by default, even when trying to specify with --packages /packages/. (Back when BabySmash was first built, VSCode wasn't really an option yet, and I don't think anyone had tried out command-line building of it yet back while this project was maintained more.)

So, VS 2019 resolves the NuGet package fine. But if you want to build from the shanselman/babysmash base fork, you will also likely have one more build issue to work though: Signing. The fastest/easiest way is to turn off signing for now:

  • In the Solution Explorer pane, there will be a [C#] BabySmash project (probably in bold) to right-click on.
  • Select "Properties".
  • Select the "Signing" tab on the left.
  • Uncheck the "Sign the ClickOnce manifests".
  • Try building.

Alternately if you need to pull source again anyway, you could try building from a fork that already has signing disabled ATM like mine.

@HelderMagalhaes
Copy link

Figured out that changing the text-to-speech language is rather easy: Use the Windows language preference selector (keyboard/language). Changing that from English to German also changed the text-to-speech voice for me.

This works pretty well, thanks for the hint; basically in the comment before we can see that it depends on the active keyboard layout. 馃槈
Did something similar for Portuguese support but I believe for most locales it's necessary to manually install the TTS language (Helia for pt-PT), for which I followed:

  1. The recipe at How to install more voices to Windows Speech?
  2. Did prioritizing using the Control Panel applet (referred out of the main solution) at: %windir%\sysWOW64\speech\SpeechUX\SAPI.cpl

That will cause letters and words.txt to be in the desired language; for the remaining expressions (shapes and colors, used in meta and special keys), it's currently only available in English and Russian. Should be pretty simple to translate (and contribute). 馃槉

@HelderMagalhaes
Copy link

Should be pretty simple to translate (and contribute). 馃槉

PR available in #37. Mind related glitch found there, to be fixed at a later stage. And please help answering the question, if you know of any exception. 馃槈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants