Mortville Manor TTS

Hello, in the past week, I worked some more on the TTS project. First I finished the GUI TTS, I needed to make sure, that everything behaves the same way on Windows and on Linux and I had to make sure I free everything I allocate. I even had to implement reference counting for a class, which wasn't that hard, but it still was pretty interesting, because I have never needed to do this. I also had to implement conversion of the text being said to UTF-8. On Windows this involved adding a table to the code, which would allow looking up codepage identifier by its name. On Linux I just used SDL_iconv_string, which can convert from most of the GUI encodings, but unfortunately it seems, it cannot convert from CP850, which is apparently quite often used by game engines (it is used by the Mortevielle engine and also by the supernova engine). So right now I just convert the strings like if they were in ASCII (most of the encodings are just ASCII extensions, so I hope to successfully convert at least some strings). I am thinking about using the iconv library for handling the conversion, but that would mean another dependency needed for compiling the code.

After I was happy with the state the TTS was in and everything worked for the GUI, I moved to implementing TTS to the mortevielle engine. It took me some time to get oriented enough in the engine (partly because some functions have their original french names). But once I located the correct spot, the implementation was pretty easy.
The engine uses a table of character voice pitch (number > 5 is a female voice, < 5 is a male voice):

const int haut[9] = { 0, 0, 1, -3, 6, -2, 2, 7, -1 };

At first, I wanted to map each number to a different voice, which would be alright on Linux, because there are 4 voices for each gender (some characters would still be mapped to the same voice, but I think the result would be good enough). But unfortunately it's quite unlikely, that on the other platforms the user is going to have that many different voices. So I ended up using only one voice for every character and just changing the pitch a little bit to make them at least a little bit different. If there is ever a situation, that there is no voice for a gender, I try to simulate that genders voice by taking a voice, that is available and changing its pitch a lot (higher for female, lower for male). It sounds quite comically, but with a little bit of fantasy it works.

Here are some results of the Mortevielle TTS, I wanted to show, that switching TTS states really works (that the TTS works as it should when switching between GUI and game).




  1. Very promising!

    A cool thing about the original game is that in the English version, everybody is speaking with a French accent. See for example

    I wonder if it would be possible to get a similar effect by using French TTS voices.

  2. Hello, this is interesting. Even though I don't think this would be possible without a lot of work, I still out of curiosity tried it.

    This is with espeak-ng on linux. Most of it doesn't sound that bad, but the numbers are read in French and some words, like "stronger" just don't sound like English. So I think English voice was a better option even if we lose the French accent of the original game. Another think is, that on some platforms a voice might be just unable to read some really foreign words. I for example tried to read some text with Chinese voice on Windows once and instead of trying to read the words as a whole, it just spelled it. I know French isn't that different from English than what I was feeding to the Chinese voice, but still I don't want to risk that on some platform the voice would not be able to read the text.


Post a Comment

Popular posts from this blog

Second week: it's starting to look interesting

ScummVM speaks