mush42 / sonata-nvda

This add-on implements a speech synthesizer driver for NVDA using neural TTS models. It supports Piper
GNU General Public License v2.0
49 stars 11 forks source link

Supporting 2024.1 #40

Open rmcpantoja opened 6 months ago

rmcpantoja commented 6 months ago

NVDA 2024.1 has been released. Big changes are the update of Python 3.11. In this branch, I provide proposal changes to make compatible with 2024.1. *.pyd libraries are updated to Python 3.11 win32 as well. Closes #33 Closes #39

KiON-GiON commented 6 months ago

Hi,

There is still a bug in the initialization of the add-on. Piper can't connect to the GRPC server.

INFO - external:synthDrivers.piper_neural_voices.aio._thread_target (20:25:28.311) - piper4nvda_asyncio (6596):
Starting asyncio event loop
ERROR - external:synthDrivers.piper_neural_voices.SynthDriver.check (20:25:28.312) - MainThread (8196):
Failed to connect to piper GRPC server. Synthesizer will not be available.
Traceback (most recent call last):
  File "C:\Users\PC\AppData\Roaming\nvda\addons\piper_neural_voices\synthDrivers\piper_neural_voices\__init__.py", line 174, in check
    piper_grpc_server_version = grpc_client.check_grpc_server().result()
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "concurrent\futures\_base.pyc", line 456, in result
  File "concurrent\futures\_base.pyc", line 401, in __get_result
  File "C:\Users\PC\AppData\Roaming\nvda\addons\piper_neural_voices\synthDrivers\piper_neural_voices\grpc_client\__init__.py", line 107, in check_grpc_server
    return await asyncio.wait_for(
                 ^^^^^^^
NameError: name 'asyncio' is not defined
ultrasound1372 commented 6 months ago

Really, you need to stop bundling asyncio, or at least stop loading it in 2024.1from said bundle, and make the code compatible with Python 3.11's asyncio. The main thing is that the loop keyword is removed in a few places, deprecated in 3.10. It does still let you spawn custom event loops, I'm unsure how exactly you replace the functionality. Maybe Python documentation in the deprecation section tells you how. Attempting to import the bundled asyncio runs into a kind of import error with one of the pyd files even if you update them, because the module is already bundled in the standard library and you have a DLL import conflict.

rmcpantoja commented 6 months ago

Hi @KiON-GiON and @ultrasound1372,

  1. Thanks for your findings.
  2. Yeah I did exactly you said. I removed asyncio package and his bundled import and removed loop argument in one of scripts of GRPC client, and updating python37 to python311 pyd modules as python3.dll as well. I reviewed the asyncio documentation before making this PR. Otherwise, what would be the point of doing this?

I will push a commit fixing bugs found by me and the pointed one by @KiON-GiON in a few hours.

rmcpantoja commented 6 months ago

Hi,

There is still a bug in the initialization of the add-on. Piper can't connect to the GRPC server.

INFO - external:synthDrivers.piper_neural_voices.aio._thread_target (20:25:28.311) - piper4nvda_asyncio (6596):
Starting asyncio event loop
ERROR - external:synthDrivers.piper_neural_voices.SynthDriver.check (20:25:28.312) - MainThread (8196):
Failed to connect to piper GRPC server. Synthesizer will not be available.
Traceback (most recent call last):
  File "C:\Users\PC\AppData\Roaming\nvda\addons\piper_neural_voices\synthDrivers\piper_neural_voices\__init__.py", line 174, in check
    piper_grpc_server_version = grpc_client.check_grpc_server().result()
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "concurrent\futures\_base.pyc", line 456, in result
  File "concurrent\futures\_base.pyc", line 401, in __get_result
  File "C:\Users\PC\AppData\Roaming\nvda\addons\piper_neural_voices\synthDrivers\piper_neural_voices\grpc_client\__init__.py", line 107, in check_grpc_server
    return await asyncio.wait_for(
                 ^^^^^^^
NameError: name 'asyncio' is not defined

Hi @KiON-GiON, Please try the latest commit. I had the asyncio fix in my local copy of the add-on, but not in the one in the repo. Sorry. Now I made sure to put it here now. Also, I did another compatibility fix to handle an exception. So, this will go from a draft pull request to open.

mikebayus commented 6 months ago

Where do I download this?

I only see the October 23,2023 release on the Release page.

rmcpantoja commented 6 months ago

Hi @mikebayus. No, this isn't in releases page yet, because the pull request needs to merge first. This is ready to merge, at least that someone find more bugs. Download from this artifact with the latest fixes: https://github.com/mush42/piper-nvda/actions/runs/8539138528/artifacts/1381177553

mikebayus commented 6 months ago

It works!

Please pardon me as I am not a programer, and I am new to all of this.

I have been an NVDA user for a very long time now, and it's time that we have some new and better voices.

These new Piper Neural voices do it for me.

Keep up the good work.

And again, thank you all so much.

On Wed, Apr 3, 2024 at 9:36 AM Mateo Cedillo @.***> wrote:

Hi @mikebayus https://github.com/mikebayus. No, this isn't in releases page yet, because the pull request needs to merge first. This is ready to merge, at least that someone find more bugs. Download from this artifact with the latest fixes: https://github.com/mush42/piper-nvda/actions/runs/8539138528/artifacts/1381177553

— Reply to this email directly, view it on GitHub https://github.com/mush42/piper-nvda/pull/40#issuecomment-2034636052, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKJ77NWRKOQZVQIT3WEOVGTY3QAWXAVCNFSM6AAAAABFTOX74GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZUGYZTMMBVGI . You are receiving this because you were mentioned.Message ID: @.***>

KiON-GiON commented 6 months ago

Thanks @rmcpantoja, it seems it works successfully now.

KiON-GiON commented 6 months ago

I found a little bug/quirk. It affects UI interfaces with ccheckboxes and/or buttons (not all of them), let's see, for example, NVDA settings panel.

  1. Select Piper Neural Voices..
  2. Open the NVDA menu.
  3. Navigate to any section of the menu.
  4. Before the voice stops speaking, press ctrl, and it will speak a letter instead of just stopping.

For example, when I navigate to "Preferences subMenu" and I stop the speech with ctrl, instead of stopping completely, it says the "P" letter.

mush42 commented 6 months ago

Hi @rmcpantoja

I did all the changes locally about 2 months ago, but I wasn't able to push them due to personal troubles.

I'll push them very soon and do a release.

rmcpantoja commented 6 months ago

Hi @rmcpantoja

I did all the changes locally about 2 months ago, but I wasn't able to push them due to personal troubles.

I'll push them very soon and do a release.

HI @mush42 No worries. I understand your situation. Take your time to push it. If you need help, I'm here.