Download Selected Text as Audio” Feature (feat/download-audio) - #480
Open
Dnyaneshwar-dnyanu wants to merge 3 commits into
Open
Download Selected Text as Audio” Feature (feat/download-audio)#480Dnyaneshwar-dnyanu wants to merge 3 commits into
Dnyaneshwar-dnyanu wants to merge 3 commits into
Conversation
Neon-Solitude
pushed a commit
to Neon-Solitude/read-aloud
that referenced
this pull request
Jul 14, 2026
Replace Speech.pickEngine's hardcoded if/else ladder with a data-driven
engineRegistry table (ordered {match, get} entries, browser-engine fallback).
Behavior is identical: order preserved, GoogleTranslate Hebrew/Telugu opt-out
and Premium.prepare / GoogleNative TimeoutTtsEngine side effects retained.
getInfo().engine is intentionally left as-is (only hosted engines surface a
name, which popup.js uses for the "initializing" label).
Add test/engine-routing.test.js: extracts the registry + predicates and asserts
16 representative voices route to the same engine the old ladder produced --
routing was previously untestable (nested inside the Speech constructor). This
decoupling is what lets a new engine become a one-line registry entry (unblocks
PRs ken107#426 and ken107#480).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
📌Summary
This PR introduces a new feature that allows users to download the selected text as an audio file (MP3) directly from the popup UI.
It uses the existing TTS engine pipeline and extends it to support generating and exporting audio.
🧩 What’s Added
✔ A new “Download Audio” button in the popup
✔ The background → player → popup pipeline for downloading audio
✔ A full audio synthesis flow using the selected TTS voice
✔ Automatic fallback to Google Translate English voice
✔ Auto-generated filename from selected text
✔ Stable Base64 → MP3 download handling
🛠 Technical Details
Core logic implemented in:
🚀 How to Test
Play downloaded file → audio should match the selected text
📄 Notes