Skip to content

Add local EPUB Read Along with synchronized words and mini-player captions - #167

Draft
saucedasf wants to merge 13 commits into
rstewa:mainfrom
saucedasf:feature/epub-read-along
Draft

saucedasf wants to merge 13 commits into
rstewa:mainfrom
saucedasf:feature/epub-read-along

Conversation

@saucedasf

@saucedasf saucedasf commented Nov 6, 2026 •

Copy link
Copy Markdown

Audiobook listeners can attach a matching EPUB and follow its published words in the existing player. This adds local word alignment, highlighting and click-to-seek using the original MediaPlayer, plus dark-backed captions above the movable mini-player.

Changes

  • Import one M4B/M4A/MP3 with an optional EPUB, or attach an EPUB to an existing audiobook.
  • Bundle Node, FFmpeg/FFprobe and the Storyteller alignment adapter; no engine-folder selection or server is needed. The speech model downloads on first use.
  • Default Windows preparation to DirectML GPU with model-load CPU fallback, with an explicit CPU choice. Show stage progress, elapsed time, cancellation and copyable diagnostics.
  • Persist attachments/maps beside the library using the existing book GUID, with EPUB/audio fingerprints and strict cue validation. Preserve original source files and source-local seek times; leave unreliable regions unhighlighted.
  • Restore EPUB paragraphs for presentation; add saved text/highlight colours, independent reader/mini font sizes and caption-background opacity.
  • Integrate book icons into existing player controls. Keep nearby text through ordinary pauses without extending word timing, balance caption windows, and avoid overlapping mini-player controls.
  • Preserve/add M4A support through selection, import and alignment.
  • Add an isolated Windows development launcher and local installer. The app displays as Audibly with the correct icon; its package identity/library/settings remain separate from the Store installation. The installer copies the app into the local Programs directory and creates a desktop shortcut.

Validation

  • Windows x64 build succeeds; existing upstream warnings remain.
  • 285 C# regression checks pass.
  • Synthetic matching EPUB/audio yields 202 word cues; deliberately unrelated text yields none. M4B, M4A and multi-file MP3 are covered.
  • Fresh M4A inference successfully loaded DirectML rather than CPU fallback and yielded 202 validated cues. This does not establish a full-book speedup or energy advantage.
  • Two local books passed fingerprint, cue-text, source-time, lookup and mini-excerpt validation: 213,295 cues in total. Paragraph restoration did not alter the persisted maps.
  • EPUB 2 conversion, protected Windows cache handling, Unicode diagnostics, ambiguous-cue suppression, persistence, cancellation, gaps and caption boundaries have regression coverage.

Remaining review/testing

This is a draft because native appearance, colour-picker interactions, DPI scaling, drag/pin, actual click-to-seek, playback speed and audible synchronization still require manual verification. Automated model tests and successful compilation do not verify those interactions.

Preparation remains tied to the main reader panel, so unloading it can cancel its worker. Structurally unusual EPUB chapters can retain their original sentence layout. Genuine unmatched audio stays unhighlighted. The local installer uses a registered development package and existing Windows/.NET runtimes. PowerShell syntax checks pass. Local installation was exercised successfully: the app launches from the local Programs directory, Start shows Audibly, the desktop shortcut uses the app icon, installed files match the tested build, and both existing Read Along book attachments remain ready. The original Store app remains separate. A signed consumer installer/release has not been produced.

See docs/read-along.md and docs/read-along-ui-audit.md for setup, evidence and limitations. The change also includes the package-feed/Windows SDK projection fixes required to build the existing upstream dependency versions in the tested environment.

Original licensing is retained. Generated sample files, personal books, library databases, caches, models, binaries and machine-specific research outputs are excluded from the tracked contribution.

Review fixes and reader update — 19 November 2026

Addressed the three Copilot findings:

  • Clean-checkout CI installs Node 24 and locked Read Along npm dependencies before MSBuild evaluates runtime content. It runs the core checks, supports unsigned PR validation without certificate secrets, uses supported artifact upload actions, stages the MSIX before unpackaged publishing can clean build outputs, and uses an explicit application-only publish directory.
  • Paired import, the book toolbar and the mini-player share the same expanded-reader navigation entry point, including fullscreen state, glyph and tooltip. The main book button is selected only while the expanded reader is active and no longer restores a stale startup flag.
  • Source-open generations distinguish loaded media from a selected/opening file, retain the latest repeated word click, and reject stale asynchronous source work. Regression cases cover same-destination clicks, rapid source changes and book changes.

The reader layout now uses a compact title/filename toolbar, Aa controls and an overflow settings flyout. Setup controls are replaced by the transcript once a book is ready; progress/errors appear only when relevant. Appearance controls use colour swatches, expanding the picker only when editing a colour.

The mini-player now supports read-back without rewinding: scrolling pauses text following while playback continues, and Follow narration returns to the live words. It shares the saved paragraph list with native virtualization and renders browsing text read-only, preventing accidental word-click seeks. No new audio analysis or second player is involved.

Validation: 285 C# regression checks; Windows x64 build; real Windows MediaPlayer source-identity/readiness smoke check without audio playback; clean source export + npm ci + unsigned Release MSIX packaging + unpackaged publishing. The actual MSIX payload was inspected for executable, runtime and icon assets. The updated local app was installed and launched, its binaries/XAML matched the tested build, and both saved alignments remained unchanged.

No GitHub-hosted CI success is claimed: dispatch on the fork returned 404 for an unregistered workflow despite its file being present. Native visual appearance and live UI gesture/click verification remain outstanding because computer use is disabled; source/layout review and successful compilation are not substitutes for those checks. This PR remains a draft.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Clean-checkout CI cannot package or publish because the new MSBuild prerequisite requires Read Along npm dependencies that the workflow never installs.

3 open issues
What changed in this PR

Adds optional EPUB Read Along to Audibly’s existing audiobook player, using local alignment for synchronized highlighting and word seeking without introducing a second playback engine.

Changes:

  • Adds paired audio/EPUB import, managed attachments, validated timing maps, progress reporting and cancellation.
  • Adds a native reader and mini-player captions with paragraph restoration and saved appearance settings.
  • Bundles alignment dependencies and adds isolated Windows installation tooling, regression checks and documentation. Native interaction and audible synchronization remain pending manual verification.
File Description
tools/​read-along/​verify.mjs Checks alignment, cache reuse and unreliable-match rejection.
tools/​read-along/​verify-protected-cache.mjs Checks protected Windows cache handling without new inference.
tools/​read-along/​verify-gpu.mjs Adds a fresh DirectML inference check.
tools/​read-along/​verify-formats.mjs Checks M4B, M4A and ordered multi-file MP3 alignment.
tools/​read-along/​verify-epub2.mjs Checks EPUB 2 conversion and text preservation.
tools/​read-along/​verify-ambiguity.mjs Checks suppression of overlapping cues.
tools/​read-along/​prepare-epub.mjs Validates EPUBs and upgrades EPUB 2 working copies.
tools/​read-along/​poc.mjs Adds a sample CPU alignment runner.
tools/​read-along/​package.json Declares local alignment and runtime dependencies.
tools/​read-along/​create-sample.ps1 Generates matching sample speech and EPUB fixtures.
tools/​read-along/​convert.mjs Converts verified media overlays into source-local cues.
tools/​read-along/​align.mjs Coordinates alignment, fingerprints, caching and progress.
Start-ReadAlong.ps1 Builds, registers and launches an isolated development app.
README.md Links to Read Along documentation.
NuGet.Config Configures NuGet and Toolkit Labs package sources.
Install-ReadAlong.ps1 Invokes the local installation mode.
docs/​read-along.md Documents setup, usage, architecture and limitations.
docs/​read-along-ui-audit.md Records presentation changes and outstanding manual checks.
docs/​read-along-evidence.json Records sample alignment and format results.
Audibly.sln Includes the Read Along library and regression runner.
Audibly.ReadAlong/​StorytellerProcessor.cs Runs the alignment worker with cancellation and diagnostics.
Audibly.ReadAlong/​ReadingPreferences.cs Defines and normalizes appearance settings.
Audibly.ReadAlong/​ReadingLayout.cs Restores EPUB paragraphs without changing cue timing.
Audibly.ReadAlong/​ReadAlongStore.cs Persists attachments and validates saved maps.
Audibly.ReadAlong/​ReadAlongExcerpt.cs Creates bounded caption excerpts with preserved cue offsets.
Audibly.ReadAlong/​FailureReport.cs Builds copyable, size-limited diagnostic reports.
Audibly.ReadAlong/​CaptionGap.cs Adds source-local gap classification logic.
Audibly.ReadAlong/​AudiobookImportSelection.cs Validates audio-plus-optional-EPUB selections.
Audibly.ReadAlong/​Audibly.ReadAlong.csproj Defines the independent .NET core library.
Audibly.ReadAlong/​AlignmentProgress.cs Parses and validates structured worker progress.
Audibly.ReadAlong/​AlignmentProcessingException.cs Carries diagnostic-log paths with processing failures.
Audibly.ReadAlong/​AlignmentMap.cs Defines fingerprints, cue validation and timing lookup.
Audibly.ReadAlong.Tests/​Program.cs Adds core regression checks and real-map validation.
Audibly.ReadAlong.Tests/​Audibly.ReadAlong.Tests.csproj Defines the executable regression runner.
Audibly.App/​Views/​PlayerPage.xaml.cs File-ending formatting only; no behavior change.
Audibly.App/​Views/​PlayerPage.xaml Hosts the toggleable Read Along panel.
Audibly.App/​Views/​NewMiniPlayerPage.xaml.cs Loads captions and manages following, sizing and dragging.
Audibly.App/​Views/​NewMiniPlayerPage.xaml Adds caption presentation and compact controls.
Audibly.App/​Views/​LibraryCardPage.xaml.cs Updates import labels for EPUB pairing and M4A.
Audibly.App/​ViewModels/​PlayerViewModel.cs Shares reading state and adds source-aware word seeking.
Audibly.App/​ViewModels/​MainViewModel.cs Integrates paired import, attachment and player navigation.
Audibly.App/​UserControls/​ReadAlongPassage.cs Renders clickable text, highlights and word scrolling.
Audibly.App/​UserControls/​ReadAlongPanel.xaml.cs Coordinates preparation, loading, diagnostics and following.
Audibly.App/​UserControls/​ReadAlongPanel.xaml Defines preparation controls and the virtualized reader.
Audibly.App/​UserControls/​ReadAlongAppearance.xaml.cs Applies appearance changes and resets.
Audibly.App/​UserControls/​ReadAlongAppearance.xaml Adds font, colour and caption-opacity controls.
Audibly.App/​UserControls/​PlayerControlGrid.xaml.cs Handles Read Along toggling and player entry.
Audibly.App/​UserControls/​PlayerControlGrid.xaml Adds the Read Along book-icon toggle.
Audibly.App/​Services/​FileImportService.cs Includes M4A in directory imports.
Audibly.App/​Package.appxmanifest Adds the M4A file association.
Audibly.App/​Helpers/​WindowHelper.cs Configures the caption window, dragging and icon path.
Audibly.App/​Helpers/​ReadAlongAppearanceSettings.cs Persists appearance settings and broadcasts changes.
Audibly.App/​Audibly.App.csproj Bundles runtime/assets and adds core and SDK references.
Audibly.App/​App.xaml.cs Resolves the main-window icon from the install directory.
.gitignore Excludes local research, samples and generated archives.

Review effort: Balanced

Comment on lines +281 to +283
<Target Name="CheckReadAlongRuntime" BeforeTargets="PrepareForBuild" Condition="'$(DesignTimeBuild)' != 'true'">
<Error Condition="!Exists('..\tools\read-along\node_modules\node\bin\node.exe') Or !Exists('..\tools\read-along\node_modules\@storyteller-platform\align\package.json')"
Text="Prepare bundled Read Along dependencies before building: npm ci --prefix tools/read-along (from the repository root)." />
Comment thread Audibly.App/ViewModels/MainViewModel.cs Outdated
await new ReadAlongStore(ApplicationData.Current.LocalFolder.Path)
.AttachAsync(imported.Id, selection.EpubPath);
App.PlayerViewModel.ReadAlongEnabled = true;
App.RootFrame?.Navigate(typeof(PlayerPage));
Comment on lines +472 to +475
if (sourceIndex == book.CurrentSourceFileIndex)
{
_pendingReadAlongSeek = null;
CurrentPosition = TimeSpan.FromSeconds(seconds);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants