A Chrome extension that uses your local TTS API Docker container to read web articles aloud with high-quality text-to-speech in 60+ languages.
Local TTS is a privacy-focused Chrome extension that brings high-quality text-to-speech capabilities directly to your browser. Unlike cloud-based TTS services, this extension runs entirely on your local machine using Docker containers, ensuring your data never leaves your device.
- π΅ High-quality TTS: Uses Local TTS model for natural-sounding speech
- π 60+ Languages: Supports a wide range of languages and accents
- π Smart Article Detection: Automatically extracts readable content from web pages
- ποΈ Customizable Settings: Adjust voice, speed, and API endpoint
- π§ Audio Format Options: Choose between PCM (recommended), MP3, or WAV formats
- β―οΈ Playback Controls: Play, pause, and stop functionality
- π¨ Modern UI: Beautiful gradient interface with visual indicators
- π±οΈ Context Menu: Right-click to read selected text or full articles
- π Privacy-First: All processing happens locally on your machine
- π Easy Setup: One-command Docker deployment
- Frontend: Chrome Extension (Manifest V3), HTML5, CSS3, JavaScript (ES6+)
- Backend: Local TTS API (Docker container)
- Build Tools: esbuild, npm
- Containerization: Docker, Docker Compose
- Languages: JavaScript, HTML, CSS, YAML
- Docker (for running the TTS service)
- Chrome Browser (Version 88+ for Manifest V3 support)
- Git (for cloning the repository)
-
Clone the repository
git clone https://github.com/yourusername/local-tts.git cd local-tts -
Start the TTS service
# Pull the Docker images first docker pull ghcr.io/remsky/kokoro-fastapi-cpu:latest docker pull ghcr.io/remsky/kokoro-fastapi-gpu:latest # CPU version (recommended for most users) docker run -d --name local-tts-cpu -p 8880:8880 ghcr.io/remsky/kokoro-fastapi-cpu:latest # GPU version (requires NVIDIA GPU) docker run -d --name local-tts-gpu --gpus all -p 8880:8880 ghcr.io/remsky/kokoro-fastapi-gpu:latest # Or use the interactive setup script ./setup.sh
-
Load the extension in Chrome
- Open Chrome and go to
chrome://extensions/ - Enable "Developer mode" (top right toggle)
- Click "Load unpacked"
- Select the
local-ttsfolder - The extension should now appear in your extensions list
- Open Chrome and go to
-
Configure the extension
- Click the extension icon
- Set the API URL to:
http://localhost:8880 - Choose your preferred voice and settings
-
Clone and install dependencies
git clone https://github.com/yourusername/local-tts.git cd local-tts npm install -
Start development environment
# Start the TTS service make dev # Or manually: docker-compose -f docker-compose.dev.yml up -d
-
Build the extension
# Build once npm run build # Watch mode for development npm run build:watch
-
Load in Chrome for testing
- Go to
chrome://extensions/ - Enable "Developer mode"
- Click "Load unpacked"
- Select the project folder
- Click the reload button after making changes
- Go to
- Make your changes in the
src/directory - Build the extension with
npm run buildornpm run build:watch - Reload the extension in Chrome's extension page
- Test your changes on any webpage
- Commit and push your changes
local-tts/
βββ src/ # Source code
β βββ main.js # Main content script
β βββ audio-handler.js # Audio processing
β βββ text-extraction.js # Text extraction logic
β βββ highlighting.js # Text highlighting
β βββ ui-controller.js # UI management
βββ popup.html # Extension popup UI
βββ popup.js # Popup functionality
βββ background.js # Background service worker
βββ content.css # Content script styles
βββ manifest.json # Extension manifest
βββ docker-compose.yml # Docker configuration
βββ setup.sh # Setup script
βββ README.md # This file
# Build the extension
npm run build
# Watch mode for development
npm run build:watch
# Start development environment
make dev
# Run tests
make test
# Clean up
make cleanWe welcome contributions! Here's how you can help:
- π Report bugs - Use GitHub Issues
- π‘ Suggest features - Open a feature request
- π§ Fix bugs - Submit a pull request
- π Improve documentation - Help make the docs better
- π Add language support - Help with translations
- π¨ UI/UX improvements - Enhance the user experience
- Fork the repository
- Create a feature branch
git checkout -b feature/your-feature-name
- Make your changes
- Test thoroughly
npm run build make test - Commit with clear messages
git commit -m "feat: add new audio format support" - Push to your fork
git push origin feature/your-feature-name
- Open a Pull Request
- Use clear, descriptive commit messages
- Follow existing code style and formatting
- Add comments for complex logic
- Test your changes before submitting
- Update documentation if needed
-
Build the extension
npm run build
-
Load in Chrome
- Go to
chrome://extensions/ - Click reload on the extension
- Test on various websites
- Go to
-
Run API tests
make test
When reporting issues, please include:
- Browser version and OS
- Extension version
- Steps to reproduce
- Expected vs actual behavior
- Screenshots (if applicable)
- Console logs (if errors occur)
- Content Script (
src/main.js): Injected into web pages to extract text and handle user interactions - Popup (
popup.html/js): Extension UI for settings and controls - Background Script (
background.js): Service worker for background tasks - Audio Handler (
src/audio-handler.js): Manages TTS API communication and audio playback - Text Extractor (
src/text-extraction.js): Extracts readable content from web pages - UI Controller (
src/ui-controller.js): Manages visual indicators and UI state
- User clicks "Read" in popup or context menu
- Content script extracts text from the page
- Text is sent to local TTS API via audio handler
- Audio is streamed back and played through Web Audio API
- UI updates to show progress and current text position
The TTS service can be configured with these environment variables:
environment:
- HOST=0.0.0.0
- PORT=8880
- WORKERS=1
- MODEL_PATH=/app/models
- CACHE_DIR=/app/cache
- LOG_LEVEL=INFO
- VOICE_CACHE_SIZE=100
- AUDIO_CACHE_SIZE=100
- MAX_TEXT_LENGTH=5000- API URL: Your local TTS service endpoint
- Voice: Choose from 60+ available voices
- Speed: Adjust playback speed (0.5x to 2.0x)
- Audio Format: PCM, MP3, or WAV
- Chunk Size: Text chunk size for processing
- Auto-play: Automatically play next chunk
- Highlighting: Highlight current text being read
-
"Cannot connect to API"
- Ensure Docker container is running
- Check if port 8880 is accessible
- Verify API URL in extension settings
-
"No readable content found"
- Try selecting specific text
- Check if page has detectable content
- Some JavaScript-heavy sites may not work
-
Audio not playing
- Check browser audio settings
- Ensure user interaction occurred
- Try refreshing the page
Enable debug logging by setting LOG_LEVEL=DEBUG in your Docker environment:
docker run -d --name local-tts-cpu -p 8880:8880 \
-e LOG_LEVEL=DEBUG \
ghcr.io/remsky/kokoro-fastapi-cpu:latestThis project is licensed under the MIT License - see the LICENSE file for details.
- Built with Local TTS API
- Chrome Extension Manifest V3
- Web Audio API for audio processing
- Docker for containerization
- π§ Email: [your-email@example.com]
- π Issues: GitHub Issues
- π Documentation: Wiki
- π¬ Discussions: GitHub Discussions
- Support for more TTS models
- Voice cloning capabilities
- Offline mode
- Mobile browser support
- Advanced text processing
- Integration with more browsers
- Plugin system for custom voices
Made with β€οΈ by the Local TTS community
For security issues, see SECURITY.md. For contribution guidelines, see CONTRIBUTING.md. For community standards, see CODE_OF_CONDUCT.md.