Repository navigation
Conversation
Narration reads a chapter's text aloud. Extract it without frontmatter, code, diagrams, tables, markup or math, one heading, list item or paragraph per line, and name its audio by the hash of the text, so audio rendered from other text never stands in for it.
Render each chapter to one MP3 per voice inside the build, with the Kokoro from nixpkgs and its weights and voices fetched by hash. Each section, cut before each of the chapter's headings, is read by its own derivation per voice, so an edit re-renders only its section, and the start of each section is kept beside the MP3. Speaking lives in contrib/speak.py, apart from tts.py, so that a change to tts.py re-renders only the sections whose text it changes. The book is read in af_heart, am_echo, bf_emma and bf_isabella; the list is in nix/tts.nix. With an empty cache the Pages build narrates the whole book, at about 10 minutes per voice on a 4 core runner, which outlasts the 30 minute timeout.
Put the browser's audio player, one per rendered voice, at the top of each chapter, so that narration works without JavaScript. theme/narration.js replaces them with one player floating at the bottom of the page, opened from the menu bar: play, a timeline marked at the chapter's main sections, speed, voice, and the position where the reader stopped. The audio is linked from the site URL, since the print page holds every chapter at the root. The preprocessor lives apart from the renderer, so that changing it does not re-render the book.
Member
Author
|
Reopened from a branch in this repository as 94: #94 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Narrate each chapter with Kokoro at build time, so the book can be listened to. Closes #76.
1116.1.-github.mp4