Switch back to winrt to see if it fixes slow TTS

https://forums.ankiweb.net/t/slow-tts-and-duplicated-voices/25157/7

winrt blocks an upgrade from Python 3.9, so this will be a temporary
solution at best.
This commit is contained in:
Damien Elmes 2022-12-06 20:30:54 +10:00
parent f0c3256e39
commit 9dc6e41153
5 changed files with 14 additions and 19 deletions

View file

@ -44,4 +44,4 @@ good-names =
ip,
[IMPORTS]
ignored-modules = anki.*_pb2, anki.sync_pb2, win32file,pywintypes,socket,win32pipe,winsdk,pyaudio,anki.scheduler_pb2
ignored-modules = anki.*_pb2, anki.sync_pb2, win32file,pywintypes,socket,win32pipe,winrt,pyaudio,anki.scheduler_pb2

View file

@ -7,4 +7,4 @@ send2trash
waitress>=2.0.0
psutil; sys.platform == "win32"
pywin32; sys.platform == "win32"
winsdk; sys.platform == "win32"
winrt; sys.platform == "win32"

View file

@ -1,3 +1,3 @@
pywin32
winsdk
winrt

View file

@ -14,16 +14,11 @@ pywin32==305 \
--hash=sha256:9dd98384da775afa009bc04863426cb30596fd78c6f8e4e2e5bbf4edf8029504 \
--hash=sha256:a55db448124d1c1484df22fa8bbcbc45c64da5e6eae74ab095b9ea62e6d00496
# via -r requirements.win.in
winsdk==1.0.0b7 \
--hash=sha256:0e3a07cbd1d63f046e11e87144a5d7fc592a0baf7518ed90c40d29efe1dd4708 \
--hash=sha256:141f40a6a7819df0fe9511b7d31bebc7119cb4c643ee695e7069cea198868efc \
--hash=sha256:51875edb889a94dbe24357277f56270eae0e3a1436acf5e596d36c95aef09977 \
--hash=sha256:873ef6fd47f78830ccbe4fc47482056b881c6ae05eaca5ba5ddabef6fe32582e \
--hash=sha256:955421aace349ef26cfc8dccbfaa716917a0f3c5043aaef3b1534ad7efd86bf6 \
--hash=sha256:a49606148b3ecac1860e7fc17d31d7149925c0387c41e85be1c655572a3b24f6 \
--hash=sha256:a653eca5a0e83f8e35f2d706a67160705ba7ac3200d29684e0821a61b00ab66c \
--hash=sha256:b90367c2fda2f649cf2fa16dd49511d7c74db11fc0abac4a46e773d97fb340e2 \
--hash=sha256:ccff00afe526a77f88b7f32e3a3924f3b7c83f2ea168665af449d2c0acfb4e4f \
--hash=sha256:d2b389c3252774e5cef432e0236e7880fff1bff1a237724f9ed1ae0fc2635352 \
--hash=sha256:e059d13117e6c57e95c6e0b3a6b67b432769b5301b89676a20d76452afdd213b
winrt==1.0.21033.1 \
--hash=sha256:224e13eb172435aaabdc7066752898a61dae0fcc3022f6f8cbd1ce953be3358c \
--hash=sha256:9d7b7d2e48c301855afd3280aaf51ea0d3c683450f46de2db813f71ee1cd5937 \
--hash=sha256:ad4afd1c7b041a6b770256d70e07093920fa83eecd80e42cac2704cd03902243 \
--hash=sha256:d035570ce2cf7e8caa785abb43f25a6ede600c2cde0378c931495bdbeaf1a075 \
--hash=sha256:da3ca3626fb992f2efa4528993d4760b298f399a7f459f7e070a2f8681d82106 \
--hash=sha256:f5ab502117da4777ab49b846ad1919fbf448bd5e49b4aca00cc59667bae2c362
# via -r requirements.win.in

View file

@ -552,12 +552,12 @@ if is_win:
tmppath = os.path.join(tmpdir(), "tts.wav")
def import_voices(self) -> None:
import winsdk.windows.media.speechsynthesis as speechsynthesis # type: ignore
import winrt.windows.media.speechsynthesis as speechsynthesis # type: ignore
try:
self.voice_list = speechsynthesis.SpeechSynthesizer.get_all_voices() # type: ignore
except Exception as e:
print("winsdk tts voices unavailable:", e)
print("winrt tts voices unavailable:", e)
self.voice_list = []
def get_available_voices(self) -> list[TTSVoice]:
@ -600,8 +600,8 @@ if is_win:
cb()
async def speakText(self, tag: TTSTag, voice_id: Any) -> None:
import winsdk.windows.media.speechsynthesis as speechsynthesis # type: ignore
import winsdk.windows.storage.streams as streams # type: ignore
import winrt.windows.media.speechsynthesis as speechsynthesis # type: ignore
import winrt.windows.storage.streams as streams # type: ignore
synthesizer = speechsynthesis.SpeechSynthesizer()