10-20-2020, 11:53 PM | #31 |
Grand Sorcerer
Posts: 6,224
Karma: 16536676
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
@Kovid,
Just so you get a notification that I've updated the win32 import list and posted an updated zip in post #29. |
10-21-2020, 02:04 AM | #32 |
creator of calibre
Posts: 44,546
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I looked into it briefly and replacing all of tts_typelib and the various COM wrappers is too much work. However, from looking at the actual plugin code, what your plugin needs seems to be:
1) Get list of available voice names 2) Get list of available audio output names 3) Play specified text with a given voice name and audio output name at s specified volume and rate 4) Pause/resume playback 5) Same as 3 but record it to a file Creating a wrapper that does these is not too bad. Please confirm this is all that's needed. |
Advert | |
|
10-21-2020, 05:52 AM | #33 |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
There already is a lightweight python TTS wrapper by Joshua Milas that I used for my simple Sigil TTS plugin.
Maybe you could add the wrapper to Calibre? (The wrapper is MIT-licensed and consists of only two very small files.) |
10-21-2020, 06:22 AM | #34 |
creator of calibre
Posts: 44,546
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Yes, that's a pure python library, so it, alongwith its dependency comtypes could just be bundled in the plugin.
|
10-21-2020, 09:24 AM | #35 | ||
Grand Sorcerer
Posts: 6,224
Karma: 16536676
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
Quote:
Quote:
@Kovid, How long do I have to get this working before the win32 stuff is removed from calibre? |
||
Advert | |
|
10-21-2020, 11:34 AM | #36 |
Grand Sorcerer
Posts: 6,224
Karma: 16536676
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
The good news is that I should be able to use Doitsu's TTS replacement to do the speaking and recording to WAV.
The bad news is that I'm missing some basic understanding of how to include the comtypes module in the plugin. Doitsu's Sigil plugin includes a comtypes directory. I've done the same in the calibre plugin by taking a copy of the comtypes directory from my local Python3.5 site-packages. What do I need to do to point the plugin at it's own bundled comtypes rather than looking for it in calibre's python? I tried adding Code:
from calibre_plugins.tts_to_mp3_plugin import comtypes |
10-21-2020, 01:12 PM | #37 |
creator of calibre
Posts: 44,546
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
The simplest way to do that is to simply have the comtypes package stored in its own zip file inside the plugin zipfile. Then extract that zipfile into a temporary file somewhere and do
sys.path.append('path/to/extracted/zip/file') now you should be able to import and use comtypes. |
10-21-2020, 01:12 PM | #38 |
creator of calibre
Posts: 44,546
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
10-21-2020, 02:07 PM | #39 | |
Grand Sorcerer
Posts: 6,224
Karma: 16536676
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
Quote:
Code:
import comtypes import comtypes.client Does that leave crud in the user's main Windows environment variable PATH? That would be a bit intrusive, wouldn't it? |
|
10-21-2020, 11:37 PM | #40 |
creator of calibre
Posts: 44,546
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
yes, and you put it in a temp directory not PATH.
|
10-22-2020, 03:12 AM | #41 |
Junior Member
Posts: 2
Karma: 6624
Join Date: Dec 2018
Device: kindle
|
This is a good plugin when working, unfortunately it's not working for me. I'm using calibre 5.3
Here's the error dump, don't know if it's any use. Thanks for having a go! calibre, version 5.3.0 ERROR: Unhandled exception: <b>com_error</b>-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147200966), None) calibre 5.3 embedded-python: True is64bit: False Windows-10-10.0.19041-SP0 Windows ('32bit', 'WindowsPE') 32bit process running on 64bit windows ('Windows', '10', '10.0.19041') Python 3.8.5 Windows: ('10', '10.0.19041', 'SP0', 'Multiprocessor Free') Interface language: None Successfully initialized third party plugins: TTS to MP3 (0, 4, 0) Traceback (most recent call last): File "calibre_plugins.tts_to_mp3_plugin.uiaction", line 175, in show_dialog File "calibre_plugins.tts_to_mp3_plugin.tts_to_mp3" , line 211, in __init__ File "calibre_plugins.tts_to_mp3_plugin.tts_to_mp3" , line 234, in initialise_data File "calibre_plugins.tts_to_mp3_plugin.other_dlgs" , line 377, in get_voices_all File "calibre_plugins.tts_to_mp3_plugin.tts_typelib ", line 1760, in GetDescription pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147200966), None) |
10-22-2020, 08:37 AM | #42 |
Grand Sorcerer
Posts: 6,224
Karma: 16536676
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
duplicate post deleted
Last edited by jackie_w; 10-22-2020 at 08:43 AM. Reason: duplicate post |
10-22-2020, 08:42 AM | #43 | |
Grand Sorcerer
Posts: 6,224
Karma: 16536676
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
Quote:
The current version of the plugin (v4.0) is working for me on Windows 10 in all of these variations: - calibre 5.2 64-bit - calibre 4.23 32-bit (on my 64-bit PC) - calibre portable v5.3, which uses the 32-bit version of calibre, which I think should replicate what your error log suggests you're using, i.e. 32-bit calibre on a 64-bit PC. If you've been able to pick up the gist of the posts in this thread from the last couple of days you'll see that Kovid has warned that this plugin will cease functioning altogether with the next release (5.4) of calibre because some of the underlying calibre Windows modules, necessary for this plugin, have been removed. I'm currently trying hard to see whether the plugin can be made to work without those old Windows modules. 24 hours ago I was hopeful something could be salvaged but after a fruitless day yesterday I'm no longer sure. Nevertheless, I'm not ready to throw in the towel just yet. I can't follow up your problem in more detail, at the moment. Because of the above I need to keep my own non-portable versions of calibre installations as-is for a few days to keep trying to stop the plugin dying altogether. I will try to give you a better answer when I have more time but, in the meantime, if you're able, perhaps you could try one of the calibre installations which I've stated above are currently working for me. Is there a reason you're using the 32-bit version of calibre on your 64-bit PC? Code:
calibre 5.3 embedded-python: True is64bit: False
Windows-10-10.0.19041-SP0 Windows ('32bit', 'WindowsPE')
32bit process running on 64bit windows
('Windows', '10', '10.0.19041')
Python 3.8.5
Windows: ('10', '10.0.19041', 'SP0', 'Multiprocessor Free')
Interface language: None
Successfully initialized third party plugins: TTS to MP3 (0, 4, 0)
|
|
10-22-2020, 11:57 AM | #44 |
creator of calibre
Posts: 44,546
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
@jackie_w: FYI I have added wrappers for all functions i described earlier to calibre, so you dont need to depend on any external libraries. In fact I have even added code to directly output mp3 files, so you can drop lame.exe as well.
You can see how to use it by reading the tests in this file: https://github.com/kovidgoyal/calibr...ows/winsapi.py It was surprisingly easy, only about 500 lines of code. |
10-22-2020, 12:15 PM | #45 |
creator of calibre
Posts: 44,546
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Oops I spoke to soon, mp3 output doesnt work, but wav output does.
|
Tags |
calibre, mp3, neural, tts, voices |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Plugin] TTS - Windows TTS output plugin | Doitsu | Plugins | 12 | 05-18-2018 10:43 PM |
How to install "incompatible" apps to Boox M96+T68. IVONA TTS, ACAPELA TTS etc. | Booxtor | Onyx Boox | 24 | 04-19-2017 06:08 AM |
which one you will prefer an audiobook or tts | webroot | Audiobook Discussions | 4 | 08-06-2015 04:40 PM |
E-ink device with TTS/audiobook integration | verona | Which one should I buy? | 21 | 05-15-2013 07:11 PM |
GUI Launcher greyed out when TTS is on and does not come back when TTS is off | jmseight | Kindle Developer's Corner | 4 | 07-28-2012 03:48 AM |