<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: cleora</title>
    <description>The latest articles on DEV Community by cleora (@cleora).</description>
    <link>https://dev.to/cleora</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4257522%2F4ada2f31-d00e-40d1-93a7-02be968054c0.png</url>
      <title>DEV Community: cleora</title>
      <link>https://dev.to/cleora</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cleora"/>
    <language>en</language>
    <item>
      <title>How I Run a Speech Model in the Browser</title>
      <dc:creator>cleora</dc:creator>
      <pubDate>Sat, 28 Nov 2026 22:40:00 +0000</pubDate>
      <link>https://dev.to/cleora/how-i-run-a-speech-model-in-the-browser-ald</link>
      <guid>https://dev.to/cleora/how-i-run-a-speech-model-in-the-browser-ald</guid>
      <description>&lt;p&gt;&lt;em&gt;Part 4 of Building All to Audiobook&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;How do you run a speech model in a browser when the reader's computer might not have a usable GPU? In All to Audiobook, I try WebGPU first and keep a WebAssembly CPU path available.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Building All to Audiobook&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I ran into these problems while building All to Audiobook for my mom. After neck surgery, holding a book became difficult for her, and many of the ebooks she wanted to read had no audiobook edition. I wanted her to turn books she already had into audio she could keep and listen to in her usual player.&lt;/p&gt;

&lt;p&gt;The app processes documents and generates speech on the reader's own device, then exports MP3 or chaptered M4B files. This series follows the practical problems I encountered while building it, the approaches I chose, and what still needs work.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The earlier parts covered &lt;a href="https://dev.to/cleora/how-i-prepare-pdf-text-for-an-audiobook-5c7i"&gt;preparing PDF text&lt;/a&gt;, &lt;a href="https://dev.to/cleora/how-i-resume-an-audiobook-conversion-after-closing-the-tab-31op"&gt;saving unfinished conversions&lt;/a&gt;, and &lt;a href="https://dev.to/cleora/how-i-check-an-audiobook-for-missing-words-4kjb"&gt;checking generated passages in Studio&lt;/a&gt;. This last part returns to the browser app and the model that produces its audio.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep inference out of the page's main thread
&lt;/h2&gt;

&lt;p&gt;I use &lt;a href="https://huggingface.co/onnx-community/Kokoro-82M-v1.0-ONNX" rel="noopener noreferrer"&gt;Kokoro, an existing 82-million-parameter speech model&lt;/a&gt;, through Kokoro.js and Transformers.js. ONNX Runtime runs the exported model. My application handles the document, the choice of runtime, and the audio it gets back.&lt;/p&gt;

&lt;p&gt;The model lives in a dedicated web worker. The job runner sends it one prepared passage and a voice selection at a time. The worker sends back loading progress, its selected engine, and audio samples.&lt;/p&gt;

&lt;p&gt;When a passage finishes, the app encodes and saves its audio before moving on. The worker stays available for the next passage, so I can reuse the loaded model. A ten-hour audiobook doesn't mean loading the model for every paragraph.&lt;/p&gt;

&lt;p&gt;The worker transfers the sample buffer back to the app. Keeping inference there lets the page handle controls and progress updates separately from the model's computation.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do I choose between the GPU and CPU?
&lt;/h2&gt;

&lt;p&gt;I ask the browser for a GPU adapter before choosing WebGPU. If it returns none, or the request fails, I use WebAssembly on the CPU.&lt;/p&gt;

&lt;p&gt;The two paths load different weight files:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Path&lt;/th&gt;
&lt;th&gt;Weights&lt;/th&gt;
&lt;th&gt;Model file size&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;WebGPU&lt;/td&gt;
&lt;td&gt;32-bit floating point&lt;/td&gt;
&lt;td&gt;About 325.5 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CPU / WebAssembly&lt;/td&gt;
&lt;td&gt;8-bit quantized&lt;/td&gt;
&lt;td&gt;About 92.4 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Those sizes come from the pinned files in the app's asset manifest. The runtime, tokenizer and voice files add to the initial download.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://onnxruntime.ai/docs/tutorials/web/ep-webgpu.html" rel="noopener noreferrer"&gt;ONNX Runtime provides both execution paths&lt;/a&gt;. My loader chooses the matching model file and keeps the tokenizer and voice assets on the same pinned revision.&lt;/p&gt;

&lt;p&gt;For the WebAssembly path, I allow up to four threads when the page is cross-origin isolated, bounded by the reported hardware concurrency. Otherwise, it uses one thread.&lt;/p&gt;

&lt;p&gt;Getting a GPU adapter only gets me to the next step. The model still has to load and return usable audio.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check the output before accepting it
&lt;/h2&gt;

&lt;p&gt;Before sending an audio chunk back, the worker checks that it contains samples and that every value is finite. It also checks the peak amplitude. A peak below 0.00001 is treated as silent output.&lt;/p&gt;

&lt;p&gt;These checks catch empty buffers, invalid numbers and silence. A valid buffer can still contain a mispronounced name or missing words. The passage transcription check from part three is a separate Studio feature.&lt;/p&gt;

&lt;p&gt;If model loading fails on WebGPU, I dispose of the current model and load the CPU version. During synthesis, the switch has a narrower condition. It happens only for a GPU-related error or invalid audio, before that request has returned any audio chunks.&lt;/p&gt;

&lt;p&gt;That boundary matters because one request can produce several chunks. Replaying the text on the CPU after sending some GPU audio could duplicate words if both outputs were kept.&lt;/p&gt;

&lt;p&gt;For an error after audio has already been emitted, the worker reports failure instead of changing engines halfway through that request. The job runner can then handle the failed passage.&lt;/p&gt;

&lt;p&gt;After a switch, the worker stays on the CPU for the rest of its lifetime. It doesn't try the failing GPU again on every passage.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9rc44jak3j6loa60jbs3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9rc44jak3j6loa60jbs3.png" alt="Simplified runtime choice for one synthesis request: a usable GPU adapter leads to WebGPU with fp32 weights; no adapter leads to CPU with q8 weights. GPU model-loading failure, or a recoverable synthesis failure before any audio is returned, switches to CPU. Both paths return audio samples." width="800" height="472"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The retry boundary belongs to the current synthesis request. Earlier saved passages remain available.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Download once, reuse the pinned files
&lt;/h2&gt;

&lt;p&gt;The first model download is a visible part of the experience. I report bytes received while preparing the runtime and voice assets, before the job switches to generating audio.&lt;/p&gt;

&lt;p&gt;The loader first looks in Cache Storage. Its cache name includes the model revision, and each asset has an expected SHA-256 hash. It checks cached bytes before using them and checks newly downloaded bytes before caching them.&lt;/p&gt;

&lt;p&gt;I keep the runtime version pinned too. This gives the loader a specific set of files to reuse on the next visit. If the browser cannot retain them, that conversion can still proceed, but a later visit may need another download.&lt;/p&gt;

&lt;p&gt;There are two kinds of reuse here. During a conversion, the worker keeps the loaded model. Across visits, the browser keeps the downloaded files. After creating the ONNX session, I also release the loader's extra JavaScript copy of the weights.&lt;/p&gt;

&lt;h2&gt;
  
  
  What stays on the reader's computer
&lt;/h2&gt;

&lt;p&gt;Document processing and speech generation run on the reader's device. The model files arrive over the network; the reader's document and generated audio stay local. Account and usage checks have their own network requests.&lt;/p&gt;

&lt;p&gt;The reader's hardware still determines how long a book takes. A CPU path gives the app another way to run, but it doesn't make an older computer perform like a fast GPU. Closing the tab also stops inference. The saved passages described in part two make it possible to continue later.&lt;/p&gt;

&lt;p&gt;You can &lt;a href="https://alltoaudiobook.com/kokoro-tts-online" rel="noopener noreferrer"&gt;try All to Audiobook's Kokoro browser app&lt;/a&gt; with a short EPUB or text-based PDF. Choose a voice and let the first run prepare its files. Start with one chapter, listen to the result, and download the audio for your usual player.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>showdev</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How I Check an Audiobook for Missing Words</title>
      <dc:creator>cleora</dc:creator>
      <pubDate>Wed, 25 Nov 2026 23:35:08 +0000</pubDate>
      <link>https://dev.to/cleora/how-i-check-an-audiobook-for-missing-words-4kjb</link>
      <guid>https://dev.to/cleora/how-i-check-an-audiobook-for-missing-words-4kjb</guid>
      <description>&lt;p&gt;&lt;em&gt;Part 3 of Building All to Audiobook&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;What if a passage sounds natural but skips half a sentence? In Studio, I transcribe each generated passage locally and compare it with the source text. That gives me specific passages to review before exporting a whole book.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Building All to Audiobook&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I ran into these problems while building All to Audiobook for my mom. After neck surgery, holding a book became difficult for her, and many of the ebooks she wanted to read had no audiobook edition. I wanted her to turn books she already had into audio she could keep and listen to in her usual player.&lt;/p&gt;

&lt;p&gt;The app processes documents and generates speech on the reader's own device, then exports MP3 or chaptered M4B files. This series follows the practical problems I encountered while building it, the approaches I chose, and what still needs work.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The &lt;a href="https://dev.to/cleora/how-i-prepare-pdf-text-for-an-audiobook-5c7i"&gt;first part&lt;/a&gt; covered text preparation. The &lt;a href="https://dev.to/cleora/how-i-resume-an-audiobook-conversion-after-closing-the-tab-31op"&gt;second&lt;/a&gt; covered saving finished passages so a closed tab doesn't mean starting over. This time I'm looking at the audio itself. The checks and editing controls below are in Studio, the desktop app.&lt;/p&gt;

&lt;h2&gt;
  
  
  A good voice sample doesn't settle it
&lt;/h2&gt;

&lt;p&gt;One Chinese listening comparison left me choosing between an expressive reading with unstable tone and a steadier one that sounded a little flat. I kept the steadier version for long listening sessions.&lt;/p&gt;

&lt;p&gt;For a narrator made from a reference recording, I reuse that recording and its transcript for each passage, with fixed sampling settings. I shorten long pauses in the generated audio. At export, I measure each chapter's loudness and apply a second normalization pass so chapters play at a similar level.&lt;/p&gt;

&lt;p&gt;These steps help with consistency. They can't tell me whether the model left out part of the text. A passage with missing words can still have an ordinary duration and a convincing voice.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do I check for missing words?
&lt;/h2&gt;

&lt;p&gt;After generating a passage, a separate local speech-recognition model transcribes it in the book's language. I compare that transcript with the text the voice was supposed to read.&lt;/p&gt;

&lt;p&gt;The comparison uses the longest common subsequence. It counts source words that appear in the transcript in the same order, allowing gaps where words are missing or different. English, German, French and Spanish use word tokens; Chinese uses individual characters. Case and punctuation don't count.&lt;/p&gt;

&lt;p&gt;The score is the matched token count divided by the source token count. I also keep the unmatched phrases, so the interface can highlight the part worth listening to.&lt;/p&gt;

&lt;p&gt;For example, suppose the input says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Nora left the lantern on the table beside the open window.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And the transcript says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Nora left the lantern beside the open window.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Eight of eleven words match. The missing phrase is "on the table." This is an illustration of the comparison, not a recording from a test.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhmju9818nzizxtwbxrj7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhmju9818nzizxtwbxrj7.png" alt="Illustrative word comparison: the source has eleven words, the transcript matches eight in order, and the missing phrase is on the table. The score is about 73%, below the 80% threshold." width="800" height="416"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The check compares text with a transcript. A low score can come from a speech error or a transcription error.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Pronunciation replacements complicate the comparison. The spelling I send to the narrator may differ from the spelling a transcriber writes down. I compare against both the prepared book text and the pronunciation-adjusted version, then use the better match. I also normalize forms such as "Mr." and "Mister."&lt;/p&gt;

&lt;h2&gt;
  
  
  One automatic retry, then a decision
&lt;/h2&gt;

&lt;p&gt;When fewer than 80% of the source tokens match, Studio makes one more take with a new random seed for voices that can produce a different reading. It transcribes the second take and keeps it only if its match score is higher.&lt;/p&gt;

&lt;p&gt;The English preset voices are an exception. Changing the seed doesn't change their reading, so I don't automatically generate the same passage twice. A pronunciation-list edit can help when a particular word sounds wrong.&lt;/p&gt;

&lt;p&gt;If the kept take remains below the threshold, the passage gets a &lt;strong&gt;Check&lt;/strong&gt; label. The rest of the book continues. I don't keep retrying until the recognizer happens to accept something.&lt;/p&gt;

&lt;p&gt;The 80% threshold is a review rule, not an accuracy claim. A passage can pass while still missing a word. The check gives me a way to find substantial omissions without requiring a full listen before I can inspect anything.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fix the passage and keep the rest
&lt;/h2&gt;

&lt;p&gt;A flagged passage shows the match count and highlights the unmatched phrases. The reader can play that passage, choose &lt;strong&gt;Make again&lt;/strong&gt;, or select &lt;strong&gt;It sounds right: keep it&lt;/strong&gt; if the audio is fine.&lt;/p&gt;

&lt;p&gt;That last option matters because the recognizer can be wrong. It might transcribe a name differently even when the narrator said it correctly. I want the reader to be able to clear that warning after listening.&lt;/p&gt;

&lt;p&gt;A manual remake puts that passage back in the queue and leaves the other completed passages alone. Its old audio file stays until a replacement is ready. Speed and the pause after a passage can also be adjusted without asking the voice model to speak again.&lt;/p&gt;

&lt;p&gt;Saving individual passages, which I wrote about last time, makes this possible. The reader can repair a small part of the book and build the final download from the resulting files.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the score misses
&lt;/h2&gt;

&lt;p&gt;The current comparison is permissive about numbers. A number written as digits can match a number written as words, even when they represent different values. That avoids some false warnings, but it means this check cannot verify that a date or amount was read correctly.&lt;/p&gt;

&lt;p&gt;Extra words are another gap. If the transcript includes all the source words in order and repeats a sentence afterward, the score can still be 100%. I haven't added a repetition penalty to this check.&lt;/p&gt;

&lt;p&gt;Very short passages are skipped: fewer than four word tokens, or six Chinese characters. If the transcription worker fails, the passage stays unchecked and the book continues. Neither case proves the audio is correct.&lt;/p&gt;

&lt;p&gt;And a transcript tells me little about an awkward pause, a sudden change in tone, or a voice that becomes tiring over several chapters. Those still need listening. I use the check to find likely omissions and make them repairable; I still choose voices by ear.&lt;/p&gt;

&lt;p&gt;You can &lt;a href="https://alltoaudiobook.com/read-pdf-aloud" rel="noopener noreferrer"&gt;try All to Audiobook with a text-based PDF&lt;/a&gt;. For the passage checking and remakes described here, use Studio, the desktop app.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Next in the series: running a speech model inside a browser, using the GPU when it works and falling back to the CPU when it doesn't.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>productivity</category>
      <category>showdev</category>
    </item>
    <item>
      <title>How I Resume an Audiobook Conversion After Closing the Tab</title>
      <dc:creator>cleora</dc:creator>
      <pubDate>Tue, 24 Nov 2026 20:30:00 +0000</pubDate>
      <link>https://dev.to/cleora/how-i-resume-an-audiobook-conversion-after-closing-the-tab-31op</link>
      <guid>https://dev.to/cleora/how-i-resume-an-audiobook-conversion-after-closing-the-tab-31op</guid>
      <description>&lt;p&gt;&lt;em&gt;Part 2 of Building All to Audiobook&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A browser tab can close halfway through a book. If the audio only exists in memory, reopening the page means making it again. I save each finished passage before moving to the next one.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Building All to Audiobook&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I ran into these problems while building All to Audiobook for my mom. After neck surgery, holding a book became difficult for her, and many of the ebooks she wanted to read had no audiobook edition. I wanted her to turn books she already had into audio she could keep and listen to in her usual player.&lt;/p&gt;

&lt;p&gt;The app processes documents and generates speech on the reader's own device, then exports MP3 or chaptered M4B files. This series follows the practical problems I encountered while building it, the approaches I chose, and what still needs work.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In the &lt;a href="https://dev.to/cleora/how-i-prepare-pdf-text-for-an-audiobook-5c7i"&gt;first part&lt;/a&gt;, I wrote about preparing PDF text for narration. Once that text reaches the voice model, I need to keep the work it produces. A whole book can outlast the time someone wants to keep a browser tab open.&lt;/p&gt;

&lt;h2&gt;
  
  
  What has to survive closing the tab?
&lt;/h2&gt;

&lt;p&gt;The saved job needs the text it started with, the selected voice, and a record of its finished audio.&lt;/p&gt;

&lt;p&gt;I copy the document when a conversion starts. The job also keeps the prepared chapter text, split into passages. Editing the working document later leaves that saved copy intact.&lt;/p&gt;

&lt;p&gt;Without the copy, resuming could mix audio made from an earlier version with text the reader has since changed. I want Continue to finish the job they started. A new edit belongs to a new conversion.&lt;/p&gt;

&lt;p&gt;Each passage gets an ID based on the job, chapter and passage position. The same passage has the same ID when I reopen the job. That gives the runner something specific to look up before asking the model to generate more audio.&lt;/p&gt;

&lt;h2&gt;
  
  
  Save one passage before starting the next
&lt;/h2&gt;

&lt;p&gt;The voice worker returns audio samples for a passage. I encode those samples as MP3, write the file, and then save its record. That record includes the passage text, its position in the chapter, and its duration.&lt;/p&gt;

&lt;p&gt;Job and passage records live in IndexedDB. The audio files normally go into the browser's &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/File_System_API/Origin_private_file_system" rel="noopener noreferrer"&gt;origin private file system&lt;/a&gt;, or OPFS. These are files kept for the site inside browser storage. They do not appear in the reader's Downloads folder.&lt;/p&gt;

&lt;p&gt;When OPFS cannot be used, the storage layer can put the audio blob in IndexedDB instead. Either way, I wait for the storage operation to finish before moving on. For IndexedDB, the helper waits for the transaction to complete.&lt;/p&gt;

&lt;p&gt;This puts the saving point inside the chapter. If the reader closes the tab before the next passage finishes saving, that passage has to be made again. The earlier saved passages remain available.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxfdv6x6ds31za249a2z1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxfdv6x6ds31za249a2z1.png" alt="Example of passage recovery: passages 1 and 2 are saved before a tab closes, passage 3 is unfinished, and passage 4 has not started. After reopening and pressing Continue, the runner reuses 1 and 2, then generates 3 and 4." width="800" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;An example sequence within one chapter. A finished storage write is what makes a passage available after reopening.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Reopen into a paused job
&lt;/h2&gt;

&lt;p&gt;When the reader returns, I load the job's document copy, chapter records and saved passages from local storage. A job left marked as running becomes paused. The reader presses Continue when they are ready.&lt;/p&gt;

&lt;p&gt;The runner walks through the stored passage list in order. For each passage, it checks whether a corresponding audio record already exists. It skips a successfully saved passage and generates one that is missing.&lt;/p&gt;

&lt;p&gt;I keep errors in the saved records too. A passage that failed to generate is marked as a failure, so the app can offer a retry. Its presence in the database does not mean there is usable audio for it.&lt;/p&gt;

&lt;p&gt;Once a chapter is ready, the export step reads its saved audio in chapter and passage order. It can build the download from those files without asking the voice model to read the chapter again.&lt;/p&gt;

&lt;p&gt;The storage tests mark a job as running, apply the recovery step, and check that its saved pieces remain. They also check that automatic continuation stays off. Another test changes the working document after creating a job and checks that the saved copy still contains the original text.&lt;/p&gt;

&lt;p&gt;Those checks matter together. Keeping the audio would be less useful if reopening silently changed which text the rest of the job would read.&lt;/p&gt;

&lt;h2&gt;
  
  
  The browser still owns this storage
&lt;/h2&gt;

&lt;p&gt;Closing the tab stops the work. The app resumes when the reader returns and presses Continue; it does not keep making audio with the page closed.&lt;/p&gt;

&lt;p&gt;The saved job also belongs to that browser's storage on that device. Signing into the same account on another computer does not bring the book or its audio along. Clearing the site's data removes the local copy.&lt;/p&gt;

&lt;p&gt;I request &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/StorageManager/persist" rel="noopener noreferrer"&gt;persistent storage&lt;/a&gt;, which the browser can grant or refuse. Storage limits still apply. If the browser reports that its storage is full, the conversion pauses with an error. The reader can download or remove a finished job before continuing.&lt;/p&gt;

&lt;p&gt;That is why I keep saving a job and downloading an audiobook as separate steps. The saved job lets the reader continue making it. The downloaded MP3 or M4B is the file they can keep and move to their usual player.&lt;/p&gt;

&lt;p&gt;You can try &lt;a href="https://alltoaudiobook.com/pdf-to-mp3" rel="noopener noreferrer"&gt;All to Audiobook's PDF-to-MP3 conversion&lt;/a&gt; with a short chapter. Let a few passages finish, pause, and reopen the site in the same browser and account. Continue should pick up the remaining work while keeping the saved audio.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Next in the series: voice consistency, checking for missing words, and remaking an individual passage.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>showdev</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How I Prepare PDF Text for an Audiobook</title>
      <dc:creator>cleora</dc:creator>
      <pubDate>Sun, 22 Nov 2026 21:25:00 +0000</pubDate>
      <link>https://dev.to/cleora/how-i-prepare-pdf-text-for-an-audiobook-5c7i</link>
      <guid>https://dev.to/cleora/how-i-prepare-pdf-text-for-an-audiobook-5c7i</guid>
      <description>&lt;p&gt;&lt;em&gt;Part 1 of Building All to Audiobook&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Our sample PDF has a running "CHAPTER ONE" header above "Chapter II. The shore." I remove the repeated margin text before narration, keeping the chapter title and story.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Building All to Audiobook&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I ran into these problems while building All to Audiobook for my mom. After neck surgery, holding a book became difficult for her, and many of the ebooks she wanted to read had no audiobook edition. I wanted her to turn books she already had into audio she could keep and listen to in her usual player.&lt;/p&gt;

&lt;p&gt;The app processes documents and generates speech on the reader's own device, then exports MP3 or chaptered M4B files. This series follows the practical problems I encountered while building it, the approaches I chose, and what still needs work.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I use PDF.js for the extraction step in All to Audiobook's &lt;a href="https://alltoaudiobook.com/pdf-to-audio" rel="noopener noreferrer"&gt;PDF-to-audio converter&lt;/a&gt;. It gives me the words and their positions on the page. I keep the positions and text sizes for cleanup.&lt;/p&gt;

&lt;p&gt;Here's the opening of page two before and after removing the margins:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Stage&lt;/th&gt;
&lt;th&gt;Opening text&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Extracted from the PDF&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;CHAPTER ONE - PDF READING SAMPLE · 2 ·&lt;/strong&gt; Chapter II. The shore. Nora took her coat from the hook and stepped outside.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;After margin cleanup&lt;/td&gt;
&lt;td&gt;Chapter II. The shore. Nora took her coat from the hook and stepped outside.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;The dots in the first row separate extracted text blocks.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffszygyclklcrcvlkaphj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffszygyclklcrcvlkaphj.png" alt="Page two of the sample PDF beside its cleaned text. Orange outlines mark the removed running header and page number; the green outline marks the retained chapter title." width="800" height="539"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The running header appears near the top of both pages. The chapter title appears once, farther down. I compare margin lines across the document and count the pages on which each line appears.&lt;/p&gt;

&lt;p&gt;For this comparison, I ignore capitalization and replace digit sequences with a placeholder. A header can then match even when it includes a changing page number. A line needs to recur across enough pages before I remove it. I handle standalone page numbers separately, within the margins.&lt;/p&gt;

&lt;p&gt;"Chapter II. The shore." survives those checks. So does Nora's opening sentence. Matching the word "Chapter" alone would have removed text I wanted to keep.&lt;/p&gt;

&lt;p&gt;A repeated margin line can contain something the reader wants to hear. There is a header control for that choice. Turning removal off brings the running heading back in this sample.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Footnotes need a choice too.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I estimate the body text size from the longer lines on each page. Then I look for smaller text near the bottom that starts with a number or note symbol. Following small-print lines can continue the same note. The comparison uses that page's body size, so it can work across books with different typography.&lt;/p&gt;

&lt;p&gt;Detection only tells me that a passage looks like a note. The reader decides what to do with it.&lt;/p&gt;

&lt;p&gt;One PDF test includes "1 An explanatory footnote below the text," positioned beneath the body in smaller type. Here is what the three settings produce from that input:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Setting&lt;/th&gt;
&lt;th&gt;What happens to the note&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Keep&lt;/td&gt;
&lt;td&gt;The note remains in the reading text.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Skip&lt;/td&gt;
&lt;td&gt;The note is omitted.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;At the end&lt;/td&gt;
&lt;td&gt;The note appears after the chapter body, introduced by "Notes."&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Moving notes to the end lets someone hear the main passage first and still get the extra information. Skipping them suits a different reading preference. I don't want the detector making that decision for everyone.&lt;/p&gt;

&lt;p&gt;The rule depends on the note's layout. It can miss notes or mistake other small text for one. The preview shows the result before conversion, and Keep leaves the note text in place.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The original extraction stays available.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That follows from the footnote controls. A reader who changes Skip to Keep expects the notes to reappear. Deleting them from the only stored copy would make that impossible.&lt;/p&gt;

&lt;p&gt;Each chapter retains its extracted page data. The cleanup settings produce a separate reading version. When a setting changes, I rebuild that version from the source instead of editing the previous result again.&lt;/p&gt;

&lt;p&gt;Skip, then At the end, then Keep should therefore produce the same text as choosing Keep at the start. The intermediate choices don't permanently remove anything from the source.&lt;/p&gt;

&lt;p&gt;I can test those choices against the same input. The sample's expected output includes the actual chapter title and Nora's complete opening sentence. For a moved footnote, I also need to check that the note appears after the chapter body. A shorter result alone would tell me very little.&lt;/p&gt;

&lt;p&gt;PDF bookmarks provide chapter boundaries where possible. Otherwise, the importer looks for chapter headings and falls back to groups of whole pages. Pronunciation replacements happen before the prepared text reaches the voice model.&lt;/p&gt;

&lt;p&gt;These steps need selectable text. Scanned pages require OCR, which the app doesn't include. For a supported file, the reader can inspect the prepared chapters and change the cleanup settings before generating audio.&lt;/p&gt;

&lt;p&gt;If you have a text-based PDF you'd like to listen to, try &lt;a href="https://alltoaudiobook.com/pdf-to-audio" rel="noopener noreferrer"&gt;All to Audiobook&lt;/a&gt; with one chapter. Check the preview with the footnotes kept, skipped, or moved to the end. I'd like to hear where the result differs from what you wanted to listen to.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Next in the series: How I Resume an Audiobook Conversion After Closing the Tab.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>showdev</category>
      <category>productivity</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
