Similar to edge's Read Aloud feature, this Chrome extension reads text from any webpage using a custom TTS service like Kokoro (Kokoro-FastAPI) or OpenAI's tts model.
- Intelligent Text Reading: Click anywhere on a page to start reading from that point
- Real-time Word Highlighting: Visual feedback shows current word being spoken
- Context Menu Integration: Right-click to start reading from any position
- Voice Customization: Choose from multiple TTS voices and adjust speech speed
- Smart Navigation: Automatically continues to next text elements
- Background Processing: Efficient audio caching and preloading
- Control Panel: Sticky in-page controls for managing playback
- Dark/Light Theme: Toggle between themes in the popup
- Responsive Design: Works across all websites
-
Clone the repository:
git clone <repository-url> cd custom_read_aloud
Or download the ZIP file from here and extract it.
-
Load in Chrome:
- Open Chrome and navigate to
chrome://extensions/
- Enable "Developer mode"
- Click "Load unpacked" and select the project directory (where
manifest.json
is located)
- Open Chrome and navigate to
- Activate the extension: Click the extension icon and toggle "Active"
- Start reading: Click anywhere on a webpage where you want to start reading
- Context menu: Right-click and select "Read aloud from here"
- Control playback: Use the in-page control panel to pause/resume
- API Base URL: Set your text-to-speech service endpoint
- Voice Selection: Choose from available voices or enter a custom voice
- Speech Speed: Adjust playback speed (0.5x - 2.0x)
- Toggle between light and dark themes via the popup interface
- Handles TTS API communication
- Implements audio caching and preloading
- Manages request queue and retry logic
- Supports audio streaming optimization
- Orchestrates the reading process
- Manages sentence tokenization
- Handles element traversal and continuation
- Controls audio playback timing
- Provides real-time word highlighting
- Synchronizes highlights with audio playback
- Manages visual feedback states
- Central state management with reactivity
- Subscription-based updates
- Cross-module communication
- Smart text element detection
- Handles navigation between readable elements
- Filters out non-content elements
- In-page UI for playback controls
- Settings management interface
- Voice selection and configuration
โโโ manifest.json # Extension manifest
โโโ package.json # Node.js dependencies
โโโ rollup.config.js # Build configuration
โโโ tsconfig.json # TypeScript configuration
โโโ popup.html # Extension popup UI
โโโ styles.css # Global styles
โโโ images/ # Extension icons
โ โโโ icon16.png
โ โโโ icon48.png
โ โโโ icon128.png
โโโ src/
โโโ background.ts # Service worker
โโโ index.ts # Content script entry
โโโ popup.ts # Popup script
โโโ modules/ # Core functionality
โ โโโ audioManager.ts
โ โโโ controlPanel.ts
โ โโโ domTraversal.ts
โ โโโ state.ts
โ โโโ textHighlighter.ts
โ โโโ textProcessor.ts
โ โโโ textReader.ts
โโโ types/ # TypeScript definitions
โโโ index.d.ts
โโโ state.ts
npm run dev
: Development build with watch modenpm run build
: Production buildnpm run type-check
: TypeScript type checking
The extension uses Rollup for bundling with TypeScript support:
- Entry points: Background script, content script, popup script
- Output: Optimized bundles in
dist/
directory - Type checking: Full TypeScript support with Chrome extension types
- TypeScript: Type-safe development
- Rollup: Module bundling
- Chrome Extension APIs: Background scripts, content scripts, storage
- Web Speech Synthesis: Browser TTS fallback
- Custom TTS API: External service integration
The extension includes comprehensive CSS with:
- CSS custom properties for theming
- Dark/light mode support
- Responsive design patterns
- Smooth animations and transitions
- Accessible color schemes
The extension expects a TTS service with the following endpoints:
GET /audio/voices
Response: { "voices": ["voice1", "voice2", ...] }
POST /audio/speech
Body: {
"model": "kokoro",
"input": "text to speak",
"voice": "voice_name",
"response_format": "mp3",
"speed": 1.0
}
Response: Audio blob (MP3)
The extension requires the following permissions:
activeTab
: Access current tab contentstorage
: Save user preferencescontextMenus
: Right-click menu integration
- No audio playback: Check TTS API configuration in settings
- Highlighting not working: Ensure the extension is active
- Performance issues: Clear audio cache or reduce preloading
Enable debug logging by opening the extension popup and checking the browser console for detailed information about:
- Audio caching operations
- TTS API requests
- State management updates
- Fork the repository
- Create a feature branch:
git checkout -b feature/new-feature
- Make your changes and test thoroughly
- Commit with descriptive messages
- Push to your fork and submit a pull request
- Follow TypeScript best practices
- Maintain consistent code formatting
- Add appropriate type definitions
- Test across different websites
- Ensure accessibility compliance
This project is licensed under the ISC License.
- Multiple language support
- Keyboard shortcuts
- Reading statistics
- Export audio functionality
- Custom highlighting styles
Note: Auto generated by Claude Sonet 4