Skip to content

Download Selected Text as Audio” Feature (feat/download-audio)#480

Open
Dnyaneshwar-dnyanu wants to merge 3 commits into
ken107:masterfrom
Dnyaneshwar-dnyanu:feat/download-audio
Open

Download Selected Text as Audio” Feature (feat/download-audio)#480
Dnyaneshwar-dnyanu wants to merge 3 commits into
ken107:masterfrom
Dnyaneshwar-dnyanu:feat/download-audio

Conversation

@Dnyaneshwar-dnyanu
Copy link
Copy Markdown

📌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:

  • popup.js
    • Captures selected text
    • Sends download request
    • Triggers MP3 download
    • Generates safe audio filenames
  • events.js
    • Sends request to player through messaging layer
  • player.js
    • Synthesizes the audio using internal TTS engines
    • Applies fallback logic (Wavenet → GoogleTranslate fallback)
    • Converts audio URL → Blob → Base64 for popup download
  • tts-engines.js (if modified)
    • Access to translation or Wavenet voice selection
    • Ensures correct working of getAudioUrl

🚀 How to Test

  • Load the extension in Chrome (Developer Mode → Load Unpacked)
  • Open any webpage
  • Select any text
  • Open the extension popup
  • Verify:
  • Selected text appears
  • Click Download
  • Audio file starts downloading as .mp3

Play downloaded file → audio should match the selected text

image

📄 Notes

  • All original logic preserved as requested
  • No breaking changes to Read-Aloud playback pipeline
  • Download feature works independently of playback
  • Works even when Google TTS fails due to fallback logic

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.

1 participant