Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTextToSpeech fails sporadically

QTextToSpeech fails sporadically

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 311 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    ollax452
    wrote on last edited by
    #1

    Hi!
    I have compiled the hello_speak example from Qt on my Rpi3 with qt5.15.2. The available languages/voices seem not be loaded correctly (sporadically). I don't get any lanugages, voices sometimes, and sometimes it works. Please, can someone look at this, I have done fault finding a long time now :)

    I have enabled the QT_DEBUG_PLUGINS and its seems like only one plugin is loaded: libqttexttospeech_flite or libqtexttospeech_speechd. And it changes between those two every run. Why is not both loaded every time?

    My pro file looks as following (the rest of the code is the same as for the hello_speak
    example):

    QT       += core gui
    QT       += multimedia
    QT       += texttospeech
    
    SOURCES = main.cpp \
              mainwindow.cpp
    HEADERS = mainwindow.h
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    TEMPLATE = app
    
    FORMS = mainwindow.ui
    

    I have added the QT_DEBUG_PLUGINS and the only difference between a 'good' start and a 'bad' start is the following:
    loaded library "/opt/Qt/5.15.2/plugins/texttospeech/libqtexttospeech_speechd.so"
    vs
    loaded library "/opt/Qt/5.15.2/plugins/texttospeech/libqttexttospeech_flite.so"

    Why is not both plugins loaded? Here is the total output from the QT_DEBUG_PLUGINS when libqtexttospeech_speechd is loaded:

    10:21:10: Debugging starts
    QFactoryLoader::QFactoryLoader() checking directory path "/opt/Qt/5.15.2/plugins/platforms" ...
    QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/plugins/platforms/libqeglfs.so"
    Found metadata in lib /opt/Qt/5.15.2/plugins/platforms/libqeglfs.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "eglfs"
            ]
        },
        "archreq": 0,
        "className": "QEglFSIntegrationPlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("eglfs")
    QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/plugins/platforms/libqlinuxfb.so"
    Found metadata in lib /opt/Qt/5.15.2/plugins/platforms/libqlinuxfb.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "linuxfb"
            ]
        },
        "archreq": 0,
        "className": "QLinuxFbIntegrationPlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("linuxfb")
    QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/plugins/platforms/libqminimal.so"
    Found metadata in lib /opt/Qt/5.15.2/plugins/platforms/libqminimal.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "minimal"
            ]
        },
        "archreq": 0,
        "className": "QMinimalIntegrationPlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("minimal")
    QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/plugins/platforms/libqminimalegl.so"
    Found metadata in lib /opt/Qt/5.15.2/plugins/platforms/libqminimalegl.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "minimalegl"
            ]
        },
        "archreq": 0,
        "className": "QMinimalEglIntegrationPlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("minimalegl")
    QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/plugins/platforms/libqoffscreen.so"
    Found metadata in lib /opt/Qt/5.15.2/plugins/platforms/libqoffscreen.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "offscreen"
            ]
        },
        "archreq": 0,
        "className": "QOffscreenIntegrationPlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("offscreen")
    QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/plugins/platforms/libqvnc.so"
    Found metadata in lib /opt/Qt/5.15.2/plugins/platforms/libqvnc.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "vnc"
            ]
        },
        "archreq": 0,
        "className": "QVncIntegrationPlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("vnc")
    QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/plugins/platforms/libqwebgl.so"
    Found metadata in lib /opt/Qt/5.15.2/plugins/platforms/libqwebgl.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "webgl"
            ]
        },
        "archreq": 0,
        "className": "QWebGLIntegrationPlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("webgl")
    QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/plugins/platforms/libqxcb.so"
    Found metadata in lib /opt/Qt/5.15.2/plugins/platforms/libqxcb.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "xcb"
            ]
        },
        "archreq": 0,
        "className": "QXcbIntegrationPlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("xcb")
    QFactoryLoader::QFactoryLoader() checking directory path "/home/pi/Downloads/build-hello_speak-Qt_5_15_2_5_15_2-Debug/platforms" ...
    loaded library "/opt/Qt/5.15.2/plugins/platforms/libqxcb.so"
    loaded library "Xcursor"
    QFactoryLoader::QFactoryLoader() checking directory path "/opt/Qt/5.15.2/plugins/platformthemes" ...
    QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/plugins/platformthemes/libqxdgdesktopportal.so"
    Found metadata in lib /opt/Qt/5.15.2/plugins/platformthemes/libqxdgdesktopportal.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformThemeFactoryInterface.5.1",
        "MetaData": {
            "Keys": [
                "xdgdesktopportal",
                "flatpak",
                "snap"
            ]
        },
        "archreq": 0,
        "className": "QXdgDesktopPortalThemePlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("xdgdesktopportal", "flatpak", "snap")
    QFactoryLoader::QFactoryLoader() checking directory path "/home/pi/Downloads/build-hello_speak-Qt_5_15_2_5_15_2-Debug/platformthemes" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/opt/Qt/5.15.2/plugins/platforminputcontexts" ...
    QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so"
    Found metadata in lib /opt/Qt/5.15.2/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPlatformInputContextFactoryInterface.5.1",
        "MetaData": {
            "Keys": [
                "compose",
                "xim"
            ]
        },
        "archreq": 0,
        "className": "QComposePlatformInputContextPlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("compose", "xim")
    QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so"
    Found metadata in lib /opt/Qt/5.15.2/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPlatformInputContextFactoryInterface.5.1",
        "MetaData": {
            "Keys": [
                "ibus"
            ]
        },
        "archreq": 0,
        "className": "QIbusPlatformInputContextPlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("ibus")
    QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/plugins/platforminputcontexts/libqtvirtualkeyboardplugin.so"
    Found metadata in lib /opt/Qt/5.15.2/plugins/platforminputcontexts/libqtvirtualkeyboardplugin.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPlatformInputContextFactoryInterface.5.1",
        "MetaData": {
            "Keys": [
                "qtvirtualkeyboard"
            ]
        },
        "archreq": 0,
        "className": "QVirtualKeyboardPlugin",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("qtvirtualkeyboard")
    QFactoryLoader::QFactoryLoader() checking directory path "/home/pi/Downloads/build-hello_speak-Qt_5_15_2_5_15_2-Debug/platforminputcontexts" ...
    loaded library "/opt/Qt/5.15.2/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so"
    QFactoryLoader::QFactoryLoader() checking directory path "/opt/Qt/5.15.2/plugins/styles" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/home/pi/Downloads/build-hello_speak-Qt_5_15_2_5_15_2-Debug/styles" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/opt/Qt/5.15.2/plugins/texttospeech" ...
    QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/plugins/texttospeech/libqtexttospeech_speechd.so"
    Found metadata in lib /opt/Qt/5.15.2/plugins/texttospeech/libqtexttospeech_speechd.so, metadata=
    {
        "IID": "org.qt-project.qt.speech.tts.plugin/5.0",
        "MetaData": {
            "Features": [
            ],
            "Keys": [
                "speechd"
            ],
            "Provider": "speechd",
            "Version": 100
        },
        "archreq": 0,
        "className": "QTextToSpeechPluginSpeechd",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("speechd")
    QFactoryLoader::QFactoryLoader() looking at "/opt/Qt/5.15.2/plugins/texttospeech/libqttexttospeech_flite.so"
    Found metadata in lib /opt/Qt/5.15.2/plugins/texttospeech/libqttexttospeech_flite.so, metadata=
    {
        "IID": "org.qt-project.qt.speech.tts.plugin/5.0",
        "MetaData": {
            "Features": [
            ],
            "Keys": [
                "flite"
            ],
            "Provider": "flite",
            "Version": 100
        },
        "archreq": 0,
        "className": "QTextToSpeechPluginFlite",
        "debug": false,
        "version": 331520
    }
    
    
    Got keys from plugin meta data ("flite")
    QFactoryLoader::QFactoryLoader() checking directory path "/home/pi/Downloads/build-hello_speak-Qt_5_15_2_5_15_2-Debug/texttospeech" ...
    loaded library "/opt/Qt/5.15.2/plugins/texttospeech/libqtexttospeech_speechd.so"
    QFactoryLoader::QFactoryLoader() checking directory path "/opt/Qt/5.15.2/plugins/xcbglintegrations" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/home/pi/Downloads/build-hello_speak-Qt_5_15_2_5_15_2-Debug/xcbglintegrations" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/opt/Qt/5.15.2/plugins/accessible" ...
    QFactoryLoader::QFactoryLoader() checking directory path "/home/pi/Downloads/build-hello_speak-Qt_5_15_2_5_15_2-Debug/accessible" ...
    10:21:48: Debugging has finished
    

    I have also tried to add libs in my pro file and manually load the plugin in mainwindow.cpp (but I got Unknown error from loader.errorString()):

    In .pro file:
    INCLUDEPATH += /home/pi/Downloads/build/qtspeech/include/QtTextToSpeech
    INCLUDEPATH += /home/pi/Downloads/build/qtspeech/include/
    LIBS += -L/home/pi/Downloads/build/qtspeech/lib -lQt5TextToSpeech
    
    In mainwindow.cpp:
    QPluginLoader loader;
    loader.setFileName("/opt/Qt/5.15.2/plugins/texttospeech/libqtexttospeech_speechd.so");
    qDebug()<<loader.load();
    qDebug()<<loader.errorString();
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Which is the plugin that works properly ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      O 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Which is the plugin that works properly ?

        O Offline
        O Offline
        ollax452
        wrote on last edited by
        #3

        @SGaist I think I have identifyed the problem: it's seems like the default plugin, during start, is not loaded in a deterministic way, sometimes libqtexttospeech_speechd.so is loaded and sometimes the libqttexttospeech_flite is loaded. I managed to fix it by manually load the desired engine at start:

        new QTextToSpeech(_engineName, this)
        

        I don't know if its a Qt bug, but it seems like

        new QTextToSpeech(this)
        

        will not load the default plugin in a deterministic way.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          That is a bit strange indeed.

          Something to investigate.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved