Commit Graph

54 Commits

Author SHA1 Message Date
rany2
c78e49d28e Cleanup SentenceBoundary support (#396)
- Default to SentenceBoundary
- Modify boundary argument to lowercase to match other options.
- Drop merge_cues support as SentenceBoundary renders it obsolete.

Signed-off-by: rany <rany2@riseup.net>
2025-08-05 14:30:30 +03:00
rany2
827d55e471 Limit text size to 4096 bytes (#394)
Fix https://github.com/rany2/edge-tts/issues/390

Signed-off-by: rany <rany2@riseup.net>
2025-08-05 14:01:32 +03:00
chnyangjie
f78c8ece0a Add option to configure SentenceBoundary (#348)
* Create FUNDING.yml

* add setence boundary which is more friendly to Chinese users

---------

Co-authored-by: Rany <ranygh@riseup.net>
2025-08-05 13:06:03 +03:00
rany2
7d03a08757 XML unescape WordBoundary text sent from metadata (#378)
Turns out Microsoft sends them XML escaped even though it's in JSON...

Signed-off-by: rany <rany2@riseup.net>
2025-05-03 13:28:50 +03:00
WANG Lei
7aabaaf480 fix: Split only on valid utf-8 boundary (#369)
* fix: Split only on valid utf-8 boundary

* refact

* make CI happy

Signed-off-by: rany <rany2@riseup.net>

---------

Signed-off-by: rany <rany2@riseup.net>
Co-authored-by: rany <rany2@riseup.net>
2025-04-15 15:13:28 +03:00
Rany
063957683c Improve type support a bit more (#333)
Also fix default voice for util.py

Signed-off-by: rany <rany2@riseup.net>
2024-11-23 19:59:39 +02:00
Rany
a3d468c7c9 Cleanup examples and fix VoicesManager types (#332)
Signed-off-by: rany <rany2@riseup.net>
2024-11-23 16:29:13 +02:00
Rany
d0e201ad3e Change default voice to en-US-EmmaMultilingualNeural (#327)
It sounds more natural than the default Aria voice to me
and should support more languages out of the box.

Signed-off-by: rany <rany2@riseup.net>
2024-11-22 21:55:07 +02:00
Rany
4611d79101 Use the short name for the default voice (#326)
Switch to en-US-AriaNeural for the default voice name. It will
be converted automatically to the complete voice name anyway.

Signed-off-by: rany <rany2@riseup.net>
2024-11-22 21:35:26 +02:00
Rany
d619925df2 Add support for custom aiohttp connector (#325)
This should allow users that need it to add support for SOCKS5
in their application via https://pypi.org/project/aiohttp-socks/.

Partially fixes: https://github.com/rany2/edge-tts/issues/147

Signed-off-by: rany <rany2@riseup.net>
2024-11-22 21:31:45 +02:00
Rany
7ee40fff2c Fix difference in command request from Edge (#324)
"sentenceBoundaryEnabled" and "wordBoundaryEnabled" is sent as a
string by Microsoft Edge but we are sending it as a boolean.

As there is no difference in functionality (both boolean and string
are treated properly), we try to pretend we are Microsoft Edge as
much as possible.

Signed-off-by: rany <rany2@riseup.net>
2024-11-22 21:06:27 +02:00
Rany
3e4de19344 Use TypedDict for voice list and TTS stream (#320)
Signed-off-by: rany <rany2@riseup.net>
2024-11-22 20:04:52 +02:00
Rany
6bc3a9e20f Clean up code comments and docstrings (#318)
Signed-off-by: rany <rany2@riseup.net>
2024-11-22 18:28:43 +02:00
Rany
dc8ac2ea7a Add support for clock adjustment for Sec-MS-GEC token (#309)
This should help when a user might have his clock skewed by more than
5 minutes. The server allows for a bit more than ~5 minutes of skew.

Signed-off-by: rany <rany2@riseup.net>
2024-11-11 13:03:40 +02:00
Rany
f014709c40 Add Sec-MS-GEC support (#303)
Credit to @gexgd0419 for understanding how the algorithm works.
See his comment here: https://github.com/rany2/edge-tts/issues/290#issuecomment-2464956570

Fixes: https://github.com/rany2/edge-tts/issues/302
Fixes: https://github.com/rany2/edge-tts/issues/299
Fixes: https://github.com/rany2/edge-tts/issues/295
Fixes: https://github.com/rany2/edge-tts/issues/290

Signed-off-by: rany <rany2@riseup.net>
Co-authored-by: gexgd0419 <55008943+gexgd0419@users.noreply.github.com>
2024-11-08 18:34:28 +02:00
Rany
80fc1d0a61 Fix 403 error for list voices endpoint (#272)
Fixes #271

Signed-off-by: rany <rany2@riseup.net>
2024-10-19 10:05:08 +03:00
BG5T
8e71135a22 Fix 403 Error (#268) 2024-10-18 17:42:26 +03:00
rany
580f880bda Fix #190
Signed-off-by: rany <rany2@riseup.net>
2024-05-21 16:36:52 +03:00
rany
547d91dfd4 Fix aiohttp timeout issue
This addresses the issue described in https://github.com/rany2/edge-tts/issues/190#issuecomment-2116195342

Signed-off-by: rany <rany2@riseup.net>
2024-05-17 13:14:56 +03:00
rany2
6d9299a669 Silence sonarlint warning
Signed-off-by: rany2 <rany2@riseup.net>
2024-05-17 13:03:58 +03:00
lzieniew
6355b32f0c Add sync versions of stream and save methods (#215)
* Add sync versions of stream and save methods

In order to provide synchronous interface to the library

* Fix save_sync() failing to use metadata_fname and fix typing issues

Signed-off-by: rany <ranygh@riseup.net>

---------

Signed-off-by: rany <ranygh@riseup.net>
Co-authored-by: rany <ranygh@riseup.net>
2024-04-21 13:47:38 +03:00
rany2
e58af9da76 Cleanup parse_metadata
Signed-off-by: rany2 <rany2@riseup.net>
2024-02-16 20:12:44 +02:00
rany2
c9bf4247a8 Refactor communicate for better readability
Also improve performance on larger documents.

Signed-off-by: rany2 <rany2@riseup.net>
2024-02-16 19:56:18 +02:00
rany2
df6bac8b54 Fix pylint config and reformat
Signed-off-by: rany2 <rany2@riseup.net>
2024-02-16 18:05:02 +02:00
scott306lr
afd4ba8fee added pitch variable back. 2023-08-31 05:19:57 +08:00
rany2
8f8a334203 Fix "unable to get local issuer certificate" when trust store is not available from OS
Closes #129

Signed-off-by: rany2 <rany2@riseup.net>
2023-08-12 17:26:30 +03:00
rany2
453a096c54 Fix comment in communicate.py
Inconsistent usage of tabs and spaces.

Signed-off-by: rany2 <rany2@riseup.net>
2023-07-09 15:47:33 +03:00
rany2
a1bacbe1fb Fix validation regex for voice
This fails for "fil-PH-AngeloNeural," make it more future proof
by accepting 2 or more of the same group.

Signed-off-by: rany2 <rany2@riseup.net>
2023-06-22 18:10:17 +03:00
rany2
0094e3b952 Exception is now raised in stream() proper 2023-05-03 22:22:02 +03:00
rany2
94603ab536 Update pylint parameters 2023-04-30 23:48:20 +03:00
rany2
6e733a306b Add some checks to ensure that it contains header length and drop struct 2023-04-21 14:22:51 +03:00
maltoze
bc781b2769 Refactor header length retrieval to utilize more appropriate method 2023-04-21 17:39:28 +08:00
rany2
58307ded26 Update edge_tts to v6.1.3
* Sort voices in util's --list-voices
* Disable overlapping subtitles by default
* Try to fix subtitles for many hour long TTS generation
* Match Microsoft Edge connection behavior more
* Bump edge_tts version
2023-01-25 18:36:59 +02:00
rany2
bd9cc2bd2d Slight performance improvements and bug fixes
* also add new functionality for edge-playback to keep temp files
* and bump version to 6.0.9
2023-01-09 18:09:23 +02:00
rany2
f598deebe0 Verify type of args passed to Communicate __init__ 2023-01-05 16:59:46 +02:00
rany2
b68b27103f Resolve *almost* all pylint complaints and setup pylint 2023-01-05 07:52:51 +02:00
rany2
2a52b979e0 lint 2023-01-05 03:14:04 +02:00
rany2
4862ec8517 Remove pitch option as it no longer has any effect
* Most likely Microsoft started ignoring it along with the custom SSML
  purge
2023-01-05 03:13:40 +02:00
rany2
01c87b7e1c Fix README and fix slight issue with validation for rate and volume
* Rate and volume could be greater than 100 and don't need to have
  a sign at the start.
2023-01-05 03:07:29 +02:00
rany2
a1bfe2a8fa Fix Python 3.7 support
* X | Y shorthand is not supported there
2023-01-05 02:31:25 +02:00
rany2
a1c5924024 Complete workflow fixing 2023-01-05 01:49:37 +02:00
rany2
c4c3dc5a13 add more typing 2023-01-05 00:56:15 +02:00
rany2
8c356a000c Slightly cleanup some more 2023-01-05 00:07:08 +02:00
rany2
7a9e4a62e3 Specify encoding on metadata fname open in save() 2023-01-04 23:52:35 +02:00
rany2
23370b4c27 Simplify edge_tts library usage 2023-01-04 23:49:29 +02:00
rany2
93f2e452ce lint 2022-07-27 20:17:42 +03:00
rany2
3a4595d6d6 Fix "ValueError: the metadata doesn't contain a Duration field"
* seems like microsoft updated their API to include this metadata type

Fixes #16
2022-07-27 20:15:17 +03:00
rany2
68a9e191d7 drop custom SSML support 2022-06-19 21:07:05 +03:00
rany2
797d04f182 Update edge-tts to version 4.0.11
* Add pylint check for lint.sh
* Change overlapping default from 5second to 1second for SubMaker and util.py
* Default to WordBoundary for edge-playback (from SentenceBoundary)
* Drop SentenceBoundary support (never works properly and too many hacks)
  - No longer actually supported by Azure's official SDK for a few years
    already
* Stop attempting to correct broken offsets sent back to us by Azure
  - Fixes never work properly because AI voice sometimes takes odd pauses
    at the start and sometimes doesn't do so. It's never predictable and
    cannot be fixed on the library's end.
  - Solution is for Microsoft to fix the integer overflow bug they are facing
    in the {Word,Sentence}Boundary offsets. It doesn't affect us until we reach
    30min long TTS anyway.
* Have edge-tts --list-voices use the configured HTTP proxy
* More misc changes and fixes
2022-05-29 18:17:48 +03:00
zhisenyang
863c545f9a add proxy 2022-04-24 16:58:01 +08:00