Menu

#135 espeak_Synth: Trouble with German special letters in wchar_t* string.

v1.0 (example)
open
nobody
None
5
2020-11-28
2020-11-19
No

When synthesizing German-language texts containing special letters (Ä, Ö, Ü, ß, and possibly others), these letters are broken up into character salad like "A tilde quarter".

This is my code:

unsigned int spoken_message_uuid = 0;

espeak_ERROR Speak (wstring text)
{
  espeak_ERROR   error = EE_OK;
  unsigned int  *uuid  = &spoken_message_uuid;
  const wchar_t *input = text.c_str ();

  wcout << L"Speaking text:" << endl << input << endl;

  error = espeak_Synth (input, text.length (), 0, POS_CHARACTER, 0, espeakCHARS_WCHAR | espeakENDPAUSE | espeakSSML, uuid, NULL);

return error;
}

I tested the whole using this text (with SSML markup dividing the messages):

B1 Reichsstraße Burgstemmen Brückenarbeiten
<break strength="strong">
GHAL Georgi-Dimitroff-Straße Merseburger Straße Durchfahrt gesperrt für LKW
<break strength="strong">
B27 Donaueschingen/A864 wegen Baustelle gesperrt
<break strength="strong">
Holsteiner Chaussee - Oldesloer Straße wegen Baustelle gesperrt
<break strength="strong">
Rosdorf wegen Baustelle gesperrt
<break strength="strong">
B5 Herzfelde Strausberger Straße gesperrt
<break strength="strong">
L52 Anschlussstelle Laubach gesperrt
<break strength="strong">
B6 Am Leineufer Mecklenheidestraße wegen Baustelle gesperrt
<break strength="strong"></break></break></break></break></break></break></break></break>

What's wrong here? I sometimes encounter such trouble when UTF-8-encoded text is being treated as ASCII by some program.

Here is my config:

pi@autoradio:/import/valen/autoradio $ espeak --version
eSpeak NG text-to-speech: 1.49.2  Data at: /usr/lib/arm-linux-gnueabihf/espeak-ng-data
pi@autoradio:/import/valen/autoradio $ g++ --version
g++ (Raspbian 6.5.0-1+rpi1+b1) 6.5.0 20181026

The voice I'm using is mb-de5.

Discussion

  • Valdis Vitolins

    Valdis Vitolins - 2020-11-20

    Please check, how it works with eSpeak NG latest version 1.50.

     
  • Jacek Ruzyczka

    Jacek Ruzyczka - 2020-11-20

    No use! The errors persist with ver. 1.50 from the Debian Buster backports repo. Here is the exact version:

    pi@autoradio:/import/valen/autoradio $ apt-cache policy espeak-ngespeak-ng:
      Installiert:           1.50+dfsg-7~bpo10+1
      Installationskandidat: 1.50+dfsg-7~bpo10+1
      Versionstabelle:
     *** 1.50+dfsg-7~bpo10+1 100
            100 http://deb.debian.org/debian buster-backports/main armhf Packages
            100 /var/lib/dpkg/status
         1.49.2+dfsg-8 500
            500 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages
    
     
  • Jacek Ruzyczka

    Jacek Ruzyczka - 2020-11-28

    OK, at least I've got the following workaround now: I hand the text over to espeak as a normal C character array. In fact, it turned out that the texts (I read from a database) are UTF-8-encoded, so that I don't even have to convert them into a wide string:

    unsigned int spoken_message_uuid = 0;
    
    espeak_ERROR Speak (string text)
    {
      espeak_ERROR  error = EE_OK;
      unsigned int *uuid  = &spoken_message_uuid;
      const char   *input = text.c_str ();
    
      cout << "Speaking text:" << endl << input << endl;
    
      error = espeak_Synth (input, text.length (), 0, POS_CHARACTER, 0, espeakCHARS_UTF8 | espeakENDPAUSE | espeakSSML, uuid, NULL);
    
    return error;
    }
    

    Nevertheless, the issue I reported still remains an unresolved bug, so that someone should look into this. Thank you.

     

Log in to post a comment.

Auth0 Logo