unofficial mirror of 
 help / color / mirror / code / Atom feed
* QtTextToSpeech
@ 2022-11-22  2:49 Matt
  0 siblings, 0 replies; only message in thread
From: Matt @ 2022-11-22  2:49 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 2529 bytes --]

I'm trying to get Text-To-Speech included within the python-pyqt package.

It looks like the definition is simply missing a declaration for qtspeech (patch attached).  I updated the definition, the package builds, and I'm now able to import the QtTextToSpeech module.  However, I'm not able to find an engine, so I can't verify that it's working 100%.

To validate the new pyqt functionality, I'm trying to get TTS working using the python-pyside-2 package.  That definition already has qtspeech included and I assume it works.  Unfortunately, I can't get that to work either.

I've installed speech-dispatcher, espeak, espeak-ng, and festival.  I'm able to get TTS from the command-line (i.e. spd-say, speak, etc.).  However, no voices or engine are found by PyQt or PySide.  I've verified that the same program works on a separate Debian machine.  Is there some setup for speech-dispatcher that I'm missing?

import sys
from PySide2 import QtCore, QtWidgets, QtTextToSpeech

class MainWindow(QtWidgets.QMainWindow):

    def __init__(self):

        self.engine = None
        self.engine_name = None

        text ='''Every effort has been made to replicate this text as faithfully as
possible, including inconsistencies in spelling and hyphenation.  Some
corrections of spelling and punctuation have been made. They are
listed at the end of the text.'''

        self.text_edit = QtWidgets.QTextEdit()

        self.speak_button = QtWidgets.QPushButton('Speak once')

        # Central widget
        layout = QtWidgets.QVBoxLayout()

        centralWidget = QtWidgets.QWidget()

        engineNames = QtTextToSpeech.QTextToSpeech.availableEngines()

        if len(engineNames) > 0:
            self.engine_name = engineNames[0]
            self.engine = QtTextToSpeech.QTextToSpeech(self.engine_name)

            voice = self.engine.availableVoices()[0]

    def on_speak_button_clicked(self):
        text = self.text_edit.toPlainText()

if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    mainWin = MainWindow()

[-- Attachment #2: 0001-Add-qtspeech-to-python-pyqt.patch --]
[-- Type: application/octet-stream, Size: 706 bytes --]

From 93abe594035ae4694aa78cf0ca32b226dbd84eb3 Mon Sep 17 00:00:00 2001
From: Matt <>
Date: Mon, 21 Nov 2022 18:31:17 -0500
Subject: [PATCH] Add qtspeech to python-pyqt

 gnu/packages/qt.scm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index 30bf429897..c5ac67a483 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -3128,6 +3128,7 @@ (define-public python-pyqt
        ("qtmultimedia-5" ,qtmultimedia-5)
        ("qtsensors" ,qtsensors)
        ("qtserialport" ,qtserialport)
+       ("qtspeech" ,qtspeech)
        ("qtsvg-5" ,qtsvg-5)
        ("qttools-5" ,qttools-5)
        ("qtwebchannel-5" ,qtwebchannel-5)

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-22  2:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-22  2:49 QtTextToSpeech Matt

Code repositories for project(s) associated with this public inbox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).