Skip to content

Epub reader with speech synthesis and dictionaries for Windows

License

Notifications You must be signed in to change notification settings

lellid/LediReader

Repository files navigation

LediReader

LediReader is a WPF application to read ebooks in the .epub format. It is especially suited for people like me, who like to read ebooks in a foreign language (needing a dictionary) and want to have them read aloud (using speech synthesis). Thus, I have made switching between speech mode and the lookup of words in a dictionary super easy and fast.

Some of the features are:

  • Can open ebooks in .epub format (without DRM only).
  • Can load one or multiple dictionaries in .slob format.
  • Read-aloud function using the speech synthesis of Microsoft Windows.
  • Light mode and dark mode, separately chooseable for the document and for the Gui.
  • Suited for high resolution screens.
  • Suited for touch screens.

Acknowledgements

It would not have been possible to create LediReader in such a short time without the contributions from other open source projects!

Thus, many thanks to:

  • Microsoft for providing the XamlToFlowDocumentConverter sample. The improved version of this sample demo can be found here. This component converts the XHTML content of the ebook into a Wpf FlowDocument that can easily be shown in the Gui.
  • Tyler Brinks for his HTML CSS parser, which is responsible for parsing the CSS style files in the ebooks.
  • vers-one for the EpubReader component. This component parses the zipped .epub file and provides its content in an easy-to-use way.
  • itkach for providing an extraordinary good documentation of the SLOB file format, which is used to store the dictionaries.
  • The many contributors to SharpZipLib, a library that can compress / decompress many formats. It is used to decompress the contents of the dictionary files.
  • Dan Pristupov for the dark theme that is used in LediReader.

Requirements

LediReader works with Windows 7-SP1 and above. The .NET framework 4.8 or above is required. Some functions (e.g. keeping the display switched on during speech synthesis) will require Windows 10 1903 or above.

Installation

At the time of writing, there is no dedicated installer. Download the Zip file with the binaries, unlock them by right-clicking on the .zip file and choose 'Unlock'. Then unzip the content of the .zip file in a folder of your choice. Double click on the main executable LediReader.exe to open the program. You can then register the extension .epub with LediReader by choosing the menu Settings -> Register . This ensures that the next time you double-click on an .epub file, LediReader is opened with that file.

Handling

Open an .epub file by using Open book from the main menu. Depending on the size of the book, this may take some time. The next time you start LediReader, the book is loaded automatically.

Open one or more dictionaries by using Dictionary -> Open SLOB file. If you don't have SLOB files, you can import dictionaries from other sources and convert them to SLOB files (see separate section dedicated to dictionaries).

Once book and dictionary are loaded, there is no need to load them the next time you open LediReader. The paths are to book and dictionary are stored in the settings.

Before you start using speech synthesis, open the Settings -> Speech.. menu and choose a voice. You will see all installed voices. If you can not find a voice for the language of your book, you can install other voices.

There are two handling modes in LediReader, in audio mode and not in audio mode. Switch between the two modes by clicking (or touching) the main menu item in audio mode.

Handling when in audio mode is checked

  • Start speech synthesis by selecting some text (a single character is enough) and then click or touch the right margin of the application window.
  • While speech synthesis is active, click or touch a word to open the dictionary (a single click is sufficient).
  • Click or touch the right margin of the application window to close the dictionary window.
  • Click or touch the right margin of the application window again to resume speech synthesis.
  • Click on the left margin of the application window to stop speech synthesis.
  • If you now click on the right margin, speech synthesis will resume.
  • If you instead want to go to the next page, first click on the left margin again to 'disarm' speech synthesis. Afterwards, you can use the left margin and the right margin to go to the previous / the next page.
  • While speech synthesis is inactive, double-click on a word to open the dictionary.

Handling when in audio mode is not checked

  • Click on the left or the right margin of the application window to go to the previous / the next page.
  • Double-click or double-touch onto a word to open the dictionary.
  • Close the dictionary by clicking or touching the right margin of the application window.
  • You can start speech synthesis by choosing Play from the main menu. (if some text is selected, synthesis will start from the selection; otherwise, from the start of the page).
  • Stop speech synthesis by clicking or touching the left margin of the application window.

Downloading and opening dictionaries that are already in the .slob format

There are some dictionaries out there that are already in the .slob format. For example, have a look here.

Note 1:
Some of the dictionaries will cause exceptions if you try to load them, in particular those created from Wikipedia or Wiktionary. This is because they are compressed with LZMA2 (7-Zip), and for an unknown reason my decompression procedure does not work correctly. If you feel you can help here, please have a look in the source code!

Note 2:
Although at the source mentioned above you will also find dictionaries from the FreeDict initiative already converted to .slob format, the content would look better if you follow the instructions below to import those dictionaries directly from the source .TEI XML files.

Importing dictionaries from other formats than .slob

Currently, LediReader can import, and then convert to .slob format:

  1. TEI XML files from the FreeDict initiative. Go to the GitHub repository of the dictionaries. There are subdirectories for many language combinations. Go into the subdirectory of your choice and search for the file with the extension .tei. Right click on this file and choose "Save destination as.." to save the file onto your local computer. Now switch back to LediReader, choose from the main menu DictionaryImport TEI file... Select in the file browser the .tei file you just downloaded. The .tei file is converted into a .slob file, which you then have to save. The file is now loaded into LediReader and is used as a source for the dictionary view.

  2. Plain text files. If you look for a good English-German dictionary, there is a good source at the Technical University of Chemnitz. At the time of writing, the dictionary could be found in this FTP directory. The name of the file is de-en.txt,zip. As described above, right-click on the file, select Save destination as.. and save the text file on your local PC. Unzip it so that you get the file de-en.txt. Now switch back to LediReader, choose from the main menu DictionaryImport TU Chemnitz file... Select in the file browser the .tei file you just downloaded. The .tei file is converted into a .slob file, which you then have to save. The file is now loaded into LediReader and is used as a source for the dictionary view.

  3. Json files of Wiktionary content, which can be found on Kaikki. The dictionaries you can find there are very comprehensive, so it is worth having a look! One warning: please do the following steps on a PC (not necessarily your reading device) which has at least 8 GB of RAM; the conversion process is demanding a lot of resources. First download one of the dictionaries (.json files) from Kaikki. Depending on the language, these are big files. For example, the Spanish word senses have 614 MB). Then open LediReader, choose menu DictionaryImport .json file from kaikki.org, and choose the just downloaded .json file. Then, after some time (patience is required), a file save dialog opens, in which you can store the dictionary as a .slob file in dictionary format. The file is now loaded into LediReader and is used as a source for the dictionary view. If you usually read onto another device, just copy the .slob file to this device, open LediReader on this device, and load the .slob file by DictionaryOpen SLOB file.

Building LediReader from the sources

To build the LediReader application from the sources, you will need Microsoft Visual Studio 2022. The 'Community edition' is sufficient.

Clone the source to your PC, using something like

git clone https://github.com/lellid/LediReader

You then need to update the submodules:

git update submodules

You can then open the solution (.sln) file in the root folder to open the solution in Visual Studio.

Known problems

Using Windows 7, after using the read-aloud function for about 20 pages, you will hear a crackling in the audio output. This is due to a memory leak that is known to Microsoft since the year 2010. (Congratulations, Microsoft!). See for instance this post and this post. Stopping and restarting speech will not help. Instead, you need to close LediReader and open it again.

With Windows 10, this problem has disappeared, since the speech synthesis uses the Windows 10 UWP API.

About

Epub reader with speech synthesis and dictionaries for Windows

Resources

License

Stars

Watchers

Forks

Packages

No packages published