Commit Graph

43 Commits

Author SHA1 Message Date
Damien Elmes
9dc6e41153 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.
2022-12-06 20:30:54 +10:00
Damien Elmes
65b8b8c69b Fix typechecking error on Windows 2022-11-29 13:28:57 +10:00
Damien Elmes
a70f8d4dd5 Fix TTS handling on Windows
Also update to winsdk, which unblocks Python updates on Windows
2022-11-29 13:04:51 +10:00
Damien Elmes
d699bc1252 Handle missing attributes in win32 tts code
https://forums.ankiweb.net/t/trouble-adding-tts-to-my-cards/21792/4
2022-07-30 19:08:37 +10:00
Damien Elmes
1165939271 Update Python deps, including stable Black
Black 22.1 made some changes that required some minor reformatting.
2022-02-25 15:26:16 +10:00
RumovZ
8ca2fa6476
Handle multiple languages in TTS code on Windows (#1663)
Closes  #1615.
2022-02-13 13:51:59 +10:00
RumovZ
9c54f85be6
Import submodules directly (#1662)
* Use submodule imports in aqt

* Use submodule imports in pylib

* More submodule imports in pylib

These required removing some direct imports to get rid of import cycles.
2022-02-13 13:40:47 +10:00
Damien Elmes
ebad6ad379 update platform checks (eg isWin -> is_win) + devMode 2021-11-25 09:06:16 +10:00
Damien Elmes
b9251290ca run pyupgrade over codebase [python upgrade required]
This adds Python 3.9 and 3.10 typing syntax to files that import
attributions from __future___. Python 3.9 should be able to cope with
the 3.10 syntax, but Python 3.8 will no longer work.

On Windows/Mac, install the latest Python 3.9 version from python.org.
There are currently no orjson wheels for Python 3.10 on Windows/Mac,
which will break the build unless you have Rust installed separately.

On Linux, modern distros should have Python 3.9 available already. If
you're on an older distro, you'll need to build Python from source first.
2021-10-04 15:05:48 +10:00
Damien Elmes
7c70d26fe7 update Python deps 2021-10-02 23:52:23 +10:00
Damien Elmes
948fc5f777 add missing copyright headers to *.py 2021-04-13 18:45:35 +10:00
Damien Elmes
1ee4385fcf i18n tts error message 2021-04-08 09:35:19 +10:00
Damien Elmes
88c002f4eb convert qt strings to f-strings with flynt
Also revealed an incorrect type def in editor.py that mypy wasn't
noticing before :-(
2021-02-11 10:09:06 +10:00
Damien Elmes
bb29ce88f3 minor code cleanups with pyupgrade
- pyupgrade --py38-plus --keep-runtime-typing --keep-percent-format
- third-party mpv and winpaths excluded
2021-02-11 09:43:40 +10:00
Damien Elmes
4d373f4aa3 catch TTS runtime error 2021-02-10 16:30:51 +10:00
Damien Elmes
6426edb0ac more typing updates 2021-02-02 23:31:55 +10:00
Damien Elmes
a56b09b987 add a bunch of return types 2021-02-01 23:53:23 +10:00
Damien Elmes
d13762bd32 add types to editor.py 2021-02-01 17:28:35 +10:00
Damien Elmes
68390eccde fail gracefully in winrt voice list fails to load
If no voices are installed, get_all_voices() throws a "file not found"
error.
2020-12-21 14:29:14 +10:00
Ryan Aird
a30064d5e9 Make RT import statement conditional, fix formatting, ignore WinRT for type checking 2020-12-20 19:43:09 -06:00
Ryan Aird
9a0b112a0f Lower default rank for non-RT voices and restrict to Windows 10 October 2018 or greater 2020-12-19 20:10:23 -06:00
Ryan Aird
56703e5f3a WinRT TTS API support 2020-12-19 19:29:34 -06:00
Damien Elmes
0ecc189a9b fix audio getting stuck (2/2) 2020-03-15 09:34:04 +10:00
Damien Elmes
a954dc1066 fix _tidy_name() comment 2020-02-28 17:14:47 +10:00
Damien Elmes
32b38bf26d ensure Anki starts on Windows systems that don't have TTS installed 2020-02-25 16:25:17 +10:00
Damien Elmes
bfb1d5c5f5 fix pylint 2020-01-26 18:57:32 +10:00
Damien Elmes
91c2825551 add a (perhaps temporary) tts-voices: filter to show all available engines 2020-01-26 17:35:07 +10:00
Damien Elmes
21cbb5a766 support speed control in tts tags 2020-01-26 14:31:07 +10:00
Damien Elmes
95b497ccf0 handle spaces in voices, add platform prefix 2020-01-22 17:50:08 +10:00
Damien Elmes
cfa0f65311 add a hook for when playback begins 2020-01-22 14:41:32 +10:00
Damien Elmes
fd95336933 mypy fixes 2020-01-21 20:42:06 +10:00
Damien Elmes
19b3a15146 formatting fixes 2020-01-21 20:39:25 +10:00
Damien Elmes
37d2a4d43c add a helper for caching generated files 2020-01-21 20:35:23 +10:00
Damien Elmes
b00a9010be when matching voices, need to check language matches too 2020-01-21 20:35:00 +10:00
Damien Elmes
5351a5f396 compare only on rank, as voices may be subclassed 2020-01-21 18:33:14 +10:00
Damien Elmes
84711f8fe2 add Windows TTS support 2020-01-21 17:34:47 +10:00
Damien Elmes
98802c9c9a deal with spaces in macOS voices like "Bad News" 2020-01-21 13:38:37 +10:00
Damien Elmes
2ac86ac400 add file-based TTS say implementation as well 2020-01-21 13:21:43 +10:00
Damien Elmes
c713683f63 add rank handling to TTS; parse TTS args in get_av_tags() 2020-01-21 12:41:37 +10:00
Damien Elmes
66e277e44b more TTS and sound work
- use provided language and voices when playing on Mac
- fix hang in waiting for termination
- allow players to return a rank for a given tag,
which will allow for the best matching player to be chosen
depending on the context (eg, prioritize one player for videos,
one tts player for certain voices, etc)
2020-01-21 11:34:25 +10:00
Damien Elmes
01f3fd06d6 support interrupting say; fix race in simple player 2020-01-21 07:28:19 +10:00
Damien Elmes
1beae4f858 pass task manager in instead of creating a new one 2020-01-21 06:49:09 +10:00
Damien Elmes
caac4527e9 add a proof of concept TTS implementation on Mac 2020-01-20 20:08:19 +10:00