Answers.Body: <p>I haven't found a graphical way to create read-aloud ebooks, but here's my python-scripts-based way of making read-aloud ebooks:</p>
  <p>Dependencies:</p>
  <ul>
  <li>Python 3.6 or later.</li>
  <li><code>FFmpeg</code></li>
  <li><a href="https://github.com/r4victor/syncabook" rel="nofollow noreferrer"><code>syncabook</code></a></li>
  <li><a href="https://github.com/readbeyond/aeneas" rel="nofollow noreferrer"><code>aeneas</code></a></li>
  <li><code>eSpeak</code></li>
  <li><code>BeautifulSoup4</code>, <code>Jinja2</code>, <code>lxml</code>, <code>progressbar2</code>, and <code>numpy</code>.</li>
  </ul>
  <p>Installation:</p>
  <p>On Arch-based distros.</p>
  <pre><code>sudo pacman -S python ffmpeg espeak
  
  </code></pre>
  <p>Install <code>aeneas</code> using <code>pip</code>.</p>
  <pre><code>pip install BeautifulSoup4 Jinja2 lxml progressbar2 numpy aeneas
  
  </code></pre>
  <p>Install <code>syncabook</code> by cloning the repo and running <code>setup.py</code></p>
  <pre><code>git clone https://github.com/r4victor/syncabook &amp;&amp; cd syncabook
  python setup.py sdist &amp;&amp; pip install dist/syncabook*.tar.gz
  
  </code></pre>
  <p>Verify installations:</p>
  <pre><code>python -m aeneas.diagnostics
  syncabook -h
  
  </code></pre>
  <p>To create an ebook with Media Overlays, we will be using <code>syncabook</code>. It uses three necessary components to create the e-book:</p>
  <ul>
  <li>audio files (the audiobook) split into chapters</li>
  <li>text files split into chapters and converted to XHTML.</li>
  <li>SMIL files that sync the audio with the text.</li>
  <li>(Optional) JPG image for the ebook cover</li>
  </ul>
  <p>The first three components MUST be included inside these directories in our root directory:</p>
  <pre><code>.
  ├── audio        (required -- audio files)
  ├── smil         (required -- SMIL files)
  ├── plaintext    (temporary -- plain text files)
  ├── images       (optional -- holds the epub cover as cover.jpg)
  └── sync_text    (required -- XHTML text files)
  
  </code></pre>
  <p>Therefor, you need to create a directory for your book and these three subdirectories.</p>
  <pre><code>cd my-new-book
  mkdir -p audio plaintext smil sync_text images
  
  </code></pre>
  <p>Inside <code>plaintext</code>, you need to put the book split into chapters in plain text format (<code>.txt</code> files).</p>
  <p>One way to do this would be to convert a book from its original format (epub) to plain text, and use <code>syncabook split_text</code> utility to split it into multiple chapters:</p>
  <p>I put a <code>plaintext.txt</code> at the root directory and add a delimiter <code>--------</code> before the start of each chapter except the first one (using <code>sed</code> or manually in Vim. AI chatbots should help here.) Then, run the following command:</p>
  <pre><code>syncabook split_text --m opening --p '\-\-\-\-\-\-\-\-' book.txt plaintext
  
  </code></pre>
  <p>This will spit out the chapters into individual files inside the <code>plaintext</code> directory. The text files are named numerically. You can rename them to have a proper table of content in your ebook later on. (Important: you'll need to rename the audio files the same way as well.)</p>
  <p>Now, you need to convert the text files into XHTML files. Unlike plain text, XHTML files are split into sentences and given <code>id</code> to be used inside the SMIL files. Run the following:</p>
  <pre><code>syncabook to_xhtml plaintext sync_text
  
  </code></pre>
  <p>Now that our text files are ready, next, we will prepare our audio files. Unfortunately, unlike text files, there isn't an easy way to split audiobooks into chapters. You'll need them split already.</p>
  <p>Put the audio files inside the <code>audio</code> directory and be sure to name them the exact names you've given the XHTML text files inside <code>sync_text</code>.</p>
  <pre><code>.
  ├── audio
  │   ├── 01.mp3
  │   ├── 02.mp3
  │   ├── 03.mp3
  │   └── 04.mp3
  ├── plaintext
  │   ├── 01.txt
  │   ├── 02.txt
  │   ├── 03.txt
  │   └── 04.txt
  ├── sync_text
  │   ├── 01.xhtml
  │   ├── 02.xhtml
  │   ├── 03.xhtml
  │   └── 04.xhtml
  ├── images
  │   └── cover.jpg
  └── smil (empty)
  
  </code></pre>
  <p>To generate the SMIL files, we will be using <code>aeneas</code>. <code>syncabook</code> can generate them using a tool called <code>afaligner</code>, but it only supports <code>.wav</code> audio files which are quite large compared to <code>.mp3</code>s.</p>
  <p>Using the following shell command, we will iterate through all <code>.mp3</code> and generate <code>.smil</code> files inside the <code>smil</code> directory. (If you're working with another audio format, tweak the command accordingly.)</p>
  <p>⚠️ ⚠️ Make sure that the <code>smil</code> directory exists beforehand and that the XHTML chapters file names match those of the audiobook file names.</p>
  <pre><code>for i in audio/*.mp3; do i=`basename -s '.mp3' $i`; python -m aeneas.tools.execute_task &quot;audio/$i.mp3&quot; &quot;sync_text/$i.xhtml&quot; &quot;task_language=eng|os_task_file_format=smil|os_task_file_smil_audio_ref=../audio/$i.mp3|os_task_file_smil_page_ref=../text/$i.xhtml|is_text_type=unparsed|is_text_unparsed_id_regex=f[0-9]+|is_text_unparsed_id_sort=numeric&quot; &quot;smil/$i.smil&quot; --skip-validator; done
  
  </code></pre>
  <p>Once this task finishes, we can use <code>syncabook</code> to create an <code>.epub</code> file out of the three pieces.</p>
  <p>Inside the root directory, run:</p>
  <pre><code>syncabook create .
  </code></pre>
  <p>After asking for some metadata such as your ebook title, author, description and so on. You can modify the TOC before the final ebook generation. It will output some directories among which is the <code>out</code> directory holding our <code>.epub</code> file.</p>
  <p>You can play the file using:</p>
  <ul>
  <li><a href="https://www.edrlab.org/software/thorium-reader" rel="nofollow noreferrer">Thorium</a> on desktop (my personal go-to)</li>
  <li><a href="https://demo.colibrio.com/" rel="nofollow noreferrer">Vanilla Reader</a> everywhere (my go-to on tablet)</li>
  <li><a href="https://chrome.google.com/webstore/detail/readium/fepbnnnkkadjhjahcafoaglimekefifl" rel="nofollow noreferrer">Readium</a>
  on Chrome</li>
  <li><a href="https://github.com/readbeyond/menestrello" rel="nofollow noreferrer">Menestrello</a> on mobile.
  You can also use Apple Books (I think.)</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-10-12T12:48:03.190Z
Answers.Text: Thanks, looks promising, but now I don't have the resources to try and confirm.
Answers.UserDisplayName: Narayanan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-10-11T01:37:50.510Z
Answers.LastActivityDate: 2024-09-05T16:14:21.457Z
Answers.LastEditDate: 2024-09-05T16:14:21.457Z
Answers.UserDisplayName: simohamed
Answers.Body: <p>This must be done in code. It is possible to edit .smil files and everything else in Sigil.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-04-04T10:36:58.697Z
Answers.LastActivityDate: 2023-04-04T10:36:58.697Z
Answers.UserDisplayName: Zvonimir Bulaja
Body: <p>I am trying to create an ebook with a media overlay (read aloud feature). Once created, I would like to use the ebook to play audio and highlight the text in the book at the appropriate time in the audio.</p>
  <p>I understand that SMIL has to be used and <a href="https://www.albertopettarin.it/blog/2014/08/02/how-to-create-epub-3-read-aloud-ebooks.html" rel="nofollow noreferrer">this site</a> details it well.</p>
  <p>The manual process is quite laborious especially when I have a large content. I am looking for an application that could help me to mark the section of the content (could be at a low level as a word/character to a line or even paragraph) and ask it to play a section of an audio file.</p>
  <p>I tried <a href="https://www.pubcoder.com/" rel="nofollow noreferrer">PubCoder</a> but in the trial version, it automatically picks the section for the audio overlay and does not permit me to do so at a granular level. The <a href="https://docs.pubcoder.com/pubcoder_read_aloud.html" rel="nofollow noreferrer">documentation says</a>:</p>
  <blockquote>
  <p>Sometimes you may want to split a read aloud block at a certain,
  specific position. You can achieve this by inserting a Read Aloud
  Splitter in your text. Just edit the text in your text box and choose
  Insert Read Aloud Splitter in the advanced functionalities menu in the
  text editor toolbar. Restart the read aloud wizard to see the changes.</p>
  </blockquote>
  <p>I could not find any option to insert &quot;Read aloud splitter&quot; in the user interface and I presume it is not available in the trial version.</p>
  <p>My question is whether any such tool other than PubCoder allows me to define the media overlay graphically and allow me to create epub3 ebooks?</p>
  <p>I had tried Sigil, BlueGriffon and Calibre and to my knowledge, they do not have a user interface (menu) to select the text and its corresponding segment in an audio file.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-11-19T16:56:59.013Z
Comments.Text: Did you find any useful tools for doing media overlays on EPUB3? Do you mind to share if there is any?
Comments.UserDisplayName: CK Tan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-02-13T13:50:23.103Z
Comments.Text: Nope. I dropped the idea of creating the Ebook as I could not find any tool.
Comments.UserDisplayName: Narayanan
Tags: <epub>
Title: Any Ebook editor that allows easy media overlay?
UserDisplayName: Narayanan
ThreadText: # Any Ebook editor that allows easy media overlay?
  
  (Asked by: username_0 on 2021-07-02)
  
  I am trying to create an ebook with a media overlay (read aloud feature). Once created, I would like to use the ebook to play audio and highlight the text in the book at the appropriate time in the audio.
  
  I understand that SMIL has to be used and [this site](https://www.albertopettarin.it/blog/2014/08/02/how-to-create-epub-3-read-aloud-ebooks.html) details it well.
  
  The manual process is quite laborious especially when I have a large content. I am looking for an application that could help me to mark the section of the content (could be at a low level as a word/character to a line or even paragraph) and ask it to play a section of an audio file.
  
  I tried [PubCoder](https://www.pubcoder.com/) but in the trial version, it automatically picks the section for the audio overlay and does not permit me to do so at a granular level. The [documentation says](https://docs.pubcoder.com/pubcoder_read_aloud.html):
  
  > Sometimes you may want to split a read aloud block at a certain,
  > specific position. You can achieve this by inserting a Read Aloud
  > Splitter in your text. Just edit the text in your text box and choose
  > Insert Read Aloud Splitter in the advanced functionalities menu in the
  > text editor toolbar. Restart the read aloud wizard to see the changes.
  
  I could not find any option to insert "Read aloud splitter" in the user interface and I presume it is not available in the trial version.
  
  My question is whether any such tool other than PubCoder allows me to define the media overlay graphically and allow me to create epub3 ebooks?
  
  I had tried Sigil, BlueGriffon and Calibre and to my knowledge, they do not have a user interface (menu) to select the text and its corresponding segment in an audio file.
  
  **Tags:** epub
  
  > **Comments:**
  > **username_1**: Did you find any useful tools for doing media overlays on EPUB3? Do you mind to share if there is any?  
  > **username_0**: Nope. I dropped the idea of creating the Ebook as I could not find any tool.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2023-10-11. Score: 2
  
  I haven't found a graphical way to create read-aloud ebooks, but here's my python-scripts-based way of making read-aloud ebooks:
  
  Dependencies:
  
  * Python 3.6 or later.
  * `FFmpeg`
  * [`syncabook`](https://github.com/r4victor/syncabook)
  * [`aeneas`](https://github.com/readbeyond/aeneas)
  * `eSpeak`
  * `BeautifulSoup4`, `Jinja2`, `lxml`, `progressbar2`, and `numpy`.
  
  Installation:
  
  On Arch-based distros.
  
  ```
  sudo pacman -S python ffmpeg espeak
  
  ```
  
  Install `aeneas` using `pip`.
  
  ```
  pip install BeautifulSoup4 Jinja2 lxml progressbar2 numpy aeneas
  
  ```
  
  Install `syncabook` by cloning the repo and running `setup.py`
  
  ```
  git clone https://github.com/r4victor/syncabook && cd syncabook
  python setup.py sdist && pip install dist/syncabook*.tar.gz
  
  ```
  
  Verify installations:
  
  ```
  python -m aeneas.diagnostics
  syncabook -h
  
  ```
  
  To create an ebook with Media Overlays, we will be using `syncabook`. It uses three necessary components to create the e-book:
  
  * audio files (the audiobook) split into chapters
  * text files split into chapters and converted to XHTML.
  * SMIL files that sync the audio with the text.
  * (Optional) JPG image for the ebook cover
  
  The first three components MUST be included inside these directories in our root directory:
  
  ```
  .
  ├── audio        (required -- audio files)
  ├── smil         (required -- SMIL files)
  ├── plaintext    (temporary -- plain text files)
  ├── images       (optional -- holds the epub cover as cover.jpg)
  └── sync_text    (required -- XHTML text files)
  
  ```
  
  Therefor, you need to create a directory for your book and these three subdirectories.
  
  ```
  cd my-new-book
  mkdir -p audio plaintext smil sync_text images
  
  ```
  
  Inside `plaintext`, you need to put the book split into chapters in plain text format (`.txt` files).
  
  One way to do this would be to convert a book from its original format (epub) to plain text, and use `syncabook split_text` utility to split it into multiple chapters:
  
  I put a `plaintext.txt` at the root directory and add a delimiter `--------` before the start of each chapter except the first one (using `sed` or manually in Vim. AI chatbots should help here.) Then, run the following command:
  
  ```
  syncabook split_text --m opening --p '\-\-\-\-\-\-\-\-' book.txt plaintext
  
  ```
  
  This will spit out the chapters into individual files inside the `plaintext` directory. The text files are named numerically. You can rename them to have a proper table of content in your ebook later on. (Important: you'll need to rename the audio files the same way as well.)
  
  Now, you need to convert the text files into XHTML files. Unlike plain text, XHTML files are split into sentences and given `id` to be used inside the SMIL files. Run the following:
  
  ```
  syncabook to_xhtml plaintext sync_text
  
  ```
  
  Now that our text files are ready, next, we will prepare our audio files. Unfortunately, unlike text files, there isn't an easy way to split audiobooks into chapters. You'll need them split already.
  
  Put the audio files inside the `audio` directory and be sure to name them the exact names you've given the XHTML text files inside `sync_text`.
  
  ```
  .
  ├── audio
  │   ├── 01.mp3
  │   ├── 02.mp3
  │   ├── 03.mp3
  │   └── 04.mp3
  ├── plaintext
  │   ├── 01.txt
  │   ├── 02.txt
  │   ├── 03.txt
  │   └── 04.txt
  ├── sync_text
  │   ├── 01.xhtml
  │   ├── 02.xhtml
  │   ├── 03.xhtml
  │   └── 04.xhtml
  ├── images
  │   └── cover.jpg
  └── smil (empty)
  
  ```
  
  To generate the SMIL files, we will be using `aeneas`. `syncabook` can generate them using a tool called `afaligner`, but it only supports `.wav` audio files which are quite large compared to `.mp3`s.
  
  Using the following shell command, we will iterate through all `.mp3` and generate `.smil` files inside the `smil` directory. (If you're working with another audio format, tweak the command accordingly.)
  
  ⚠️ ⚠️ Make sure that the `smil` directory exists beforehand and that the XHTML chapters file names match those of the audiobook file names.
  
  ```
  for i in audio/*.mp3; do i=`basename -s '.mp3' $i`; python -m aeneas.tools.execute_task "audio/$i.mp3" "sync_text/$i.xhtml" "task_language=eng|os_task_file_format=smil|os_task_file_smil_audio_ref=../audio/$i.mp3|os_task_file_smil_page_ref=../text/$i.xhtml|is_text_type=unparsed|is_text_unparsed_id_regex=f[0-9]+|is_text_unparsed_id_sort=numeric" "smil/$i.smil" --skip-validator; done
  
  ```
  
  Once this task finishes, we can use `syncabook` to create an `.epub` file out of the three pieces.
  
  Inside the root directory, run:
  
  ```
  syncabook create .
  
  ```
  
  After asking for some metadata such as your ebook title, author, description and so on. You can modify the TOC before the final ebook generation. It will output some directories among which is the `out` directory holding our `.epub` file.
  
  You can play the file using:
  
  * [Thorium](https://www.edrlab.org/software/thorium-reader) on desktop (my personal go-to)
  * [Vanilla Reader](https://demo.colibrio.com/) everywhere (my go-to on tablet)
  * [Readium](https://chrome.google.com/webstore/detail/readium/fepbnnnkkadjhjahcafoaglimekefifl)
    on Chrome
  * [Menestrello](https://github.com/readbeyond/menestrello) on mobile.
    You can also use Apple Books (I think.)
  
  > **Comments:**
  > **username_0**: Thanks, looks promising, but now I don't have the resources to try and confirm.  
  
  ---
  
  ### Answer by username_3 on 2023-04-04. Score: 0
  
  This must be done in code. It is possible to edit .smil files and everything else in Sigil.
  
  
  ---
  
  