An offline-first, zero-paid-API screen reader and audio assistant that speaks or explains any highlighted text on your screen (in PowerPoint, Word, PDFs, Browsers, IDEs, Discord, etc.) using high-quality neural voices and local LLMs.
- Overview
- Key Features
- Tech Stack
- Prerequisites
- Getting Started
- How It Works & Controls
- Architecture & Data Flow
- Testing
- Configuration & Customization
- Troubleshooting
- License
When reviewing dense documents, code, or PowerPoint slides, reading long blocks of text can cause severe eye fatigue. Local Screen Reader Agent provides an instant, ambient audio reading layer:
- Highlight text anywhere with your mouse.
- Press
F8to hear a 100% verbatim, natural neural voice readout. - Press
F9to have your local LLM (qwen2.5:1.5bor any Ollama model) explain/summarize the text before reading. - Press
Escto silence speech immediately.
100% Free & Private: No paid API keys (like ElevenLabs or OpenAI) required. Uses Microsoft Edge Neural TTS with offline Windows SAPI fallback and local Ollama inference.
- ποΈ Natural Neural Voice (Free): Powered by Microsoft Edge TTS (
edge-tts) for ultra-realistic neural speech. - β‘ Offline SAPI Fallback: Instant fallback to Windows native
SAPI.SpVoiceif internet connectivity is lost. - π§ Local LLM Intelligence: Connects to local Ollama (
qwen2.5:1.5b) for zero-cost, private summaries and explanations of technical text. - π― 100% Verbatim Accuracy: Direct Windows UI Automation (
IUIAutomationTextPattern) extracts exact selected text across PowerPoint, Word, Chrome, Edge, Acrobat, and VS Code with zero keystroke simulation artifacts. - π Instant Stop Hotkey: Tap
EscorF10at any time to instantly cut audio playback. - π§ͺ Fully Tested: Comprehensive
pytesttest suite covering capture, TTS reader, local LLM, and agent loops.
| Layer | Technology |
|---|---|
| Language | Python 3.10+ (Tested on Python 3.12.9) |
| TTS Engine | edge-tts (Microsoft Neural Voices) + Windows SAPI.SpVoice COM |
| Audio Playback | pygame.mixer (Direct low-latency hardware audio streaming) |
| Selection Capture | Windows UI Automation (uiautomation, comtypes) + pywin32 Clipboard |
| Local LLM | Ollama (qwen2.5:1.5b, llama3.1, phi3, etc.) |
| Hotkeys | keyboard global listener |
| Test Suite | pytest |
- Operating System: Windows 10 or Windows 11.
- Python: Python 3.10 or higher.
- Ollama (Optional, for F9 Explanations):
- Download and install Ollama from ollama.com.
- Pull the lightweight model:
ollama pull qwen2.5:1.5b
git clone https://github.com/ronaksarda/side-project.git
cd side-projectInstall the required Python packages:
pip install edge-tts pygame pywin32 uiautomation comtypes keyboard requests pytestEnsure Ollama is running in the background:
# Verify Ollama is reachable and model is installed
ollama list(Note: If Ollama is not installed or running, direct verbatim reading with F8 still works 100% normally).
Run the main agent:
python agent.pyYou will see the startup banner:
===================================================================
LOCAL SCREEN READER AGENT (HIGH ACCURACY)
===================================================================
Ollama Status : Ready (qwen2.5:1.5b)
Voice Engine : Microsoft Neural (en-US-ChristopherNeural)
CONTROLS:
[ F8 ] or [ Ctrl+Alt+R ] -> READ exact highlighted text (100% Verbatim)
[ F9 ] or [ Ctrl+Alt+E ] -> EXPLAIN highlighted text with Local LLM
[ Esc ] or [ F10 ] -> STOP / MUTE immediately
[ Ctrl+C ] in terminal -> Exit application
===================================================================
Highlight text anywhere (PPTX, PDF, Browser, IDE) and press F8!
| Primary Hotkey | Alternative Hotkey | Action | Description |
|---|---|---|---|
F8 |
Ctrl + Alt + R |
Verbatim Readout | Speaks highlighted text word-for-word with zero AI alterations. |
F9 |
Ctrl + Alt + E |
LLM Explanation | Sends highlighted text to Ollama for a concise spoken summary/explanation. |
Esc |
F10 |
Stop / Mute | Immediately halts ongoing speech and resets the playback engine. |
Ctrl + C |
(in terminal) | Exit Agent | Gracefully shuts down audio threads and exits. |
-
Verbatim Read Mode (
F8):- Highlight any sentence, paragraph, bullet point, or code block.
- Press
F8. - The agent reads the exact text aloud in natural spoken English.
-
Smart Explain Mode (
F9):- Highlight complex math, architecture docs, dense technical slides, or foreign concepts.
- Press
F9. - Local
qwen2.5:1.5bparses the content, extracts the core concepts, and reads an easy-to-understand conversational explanation.
side-project/
βββ agent.py # Main daemon entry point & global hotkey orchestration
βββ capture.py # Direct Windows UI Automation & clipboard text extractor
βββ reader.py # Dual-engine TTS player (edge-tts + SAPI + pygame.mixer)
βββ llm.py # Local Ollama client with strict grounding prompts
βββ tests/ # Automated test suite
β βββ test_agent.py # Agent hotkey & state dispatch tests
β βββ test_capture.py # UI Automation & clipboard mock tests
β βββ test_llm.py # Ollama request/fallback tests
β βββ test_reader.py # TTS audio playback & SAPI fallback tests
βββ README.md # Complete project documentation
βββ .gitignore # Git ignore rules
[User Highlights Text on Screen]
β
βΌ
[Presses F8 or F9 Hotkey]
β
βΌ
[capture.py: get_selected_text()]
βββ 1. Windows UI Automation (IUIAutomationTextPattern)
βββ 2. Clean Win32 Clipboard (Fallback)
β
ββββββββββ΄βββββββββ
β (F8) β (F9)
βΌ βΌ
[Direct Text] [llm.py: LocalLLM (qwen2.5:1.5b)]
β β
β βΌ
β [Spoken Summary]
ββββββββββ¬βββββββββ
β
βΌ
[reader.py: TextToSpeechReader]
βββ Primary: edge_tts Neural Stream (.mp3) -> pygame.mixer
βββ Fallback: Windows SAPI.SpVoice (COM)
β
βΌ
[π Speaker Audio Output]
capture.py: Uses Windows Accessibility APIs (IUIAutomationTextPattern) to directly query the selected text ranges of the focused control. This eliminates keypress collision and works in PowerPoint shapes, browser text, and PDF viewers.reader.py: Usesedge-ttsto generate crisp neural audio streams and plays them throughpygame.mixer. Handles thread lifecycle, cleanup of temporary media, and provides instant cancellation viastop().llm.py: Issues low-temperature (temp=0.2), strictly grounded prompts to Ollama (/api/generate) to avoid hallucinations and retain technical terms.agent.py: Manages the background execution loop, hotkey bindings, busy states, and terminal status logging.
Run the automated test suite with pytest:
python -m pytest -vExpected output:
============================= test session starts =============================
platform win32 -- Python 3.12.9, pytest-9.0.3, pluggy-1.6.0
rootdir: C:\Users\rocky\OneDrive\Documents\side-project
plugins: anyio-4.13.0
collected 13 items
tests/test_agent.py::test_agent_init PASSED [ 7%]
tests/test_agent.py::test_agent_read_selection_verbatim PASSED [ 15%]
tests/test_agent.py::test_agent_read_selection_empty PASSED [ 23%]
tests/test_agent.py::test_agent_stop PASSED [ 30%]
tests/test_capture.py::test_get_selected_text_from_uia PASSED [ 38%]
tests/test_capture.py::test_get_selected_text_from_clipboard PASSED [ 46%]
tests/test_capture.py::test_get_selected_text_empty PASSED [ 53%]
tests/test_llm.py::test_llm_init PASSED [ 61%]
tests/test_llm.py::test_explain_text_mock PASSED [ 69%]
tests/test_llm.py::test_explain_text_fallback_on_error PASSED [ 76%]
tests/test_reader.py::test_reader_init PASSED [ 84%]
tests/test_reader.py::test_sapi_fallback PASSED [ 92%]
tests/test_reader.py::test_stop_speaking PASSED [100%]
============================= 13 passed in 1.95s ==============================
In agent.py, change the voice parameter in ScreenReaderAgent(voice=...):
# Available high-quality voices:
# - "en-US-ChristopherNeural" (Default: Clear, natural male)
# - "en-US-GuyNeural" (Deep, broadcast male)
# - "en-US-JennyNeural" (Warm, natural female)
# - "en-US-AriaNeural" (Expressive female)
# - "en-GB-RyanNeural" (British male)
# - "en-GB-SoniaNeural" (British female)
agent = ScreenReaderAgent(voice="en-US-JennyNeural")To list all available voices installed on Edge TTS:
edge-tts --list-voicesIf you have other models downloaded in Ollama (e.g., llama3.1:8b, phi3:mini, gemma2:9b), specify it in agent.py:
agent = ScreenReaderAgent(model="llama3.1:8b")- Ensure your default Windows audio output device is set correctly.
- Check if your terminal prints
[Agent] Exact Text (...). If it showsNo text selected, make sure text is highlighted before pressingF8. - If internet is unavailable,
reader.pywill automatically switch to offline Windows SAPI voice.
- Verify Ollama is running: open
http://localhost:11434in your browser or runollama listin PowerShell. - Make sure
qwen2.5:1.5b(or your chosen model) is installed:ollama pull qwen2.5:1.5b.
- If the application you are highlighting text in (e.g., an elevated CMD/PowerShell window or task manager) is running as Administrator, run
python agent.pyin an Administrator Terminal so Windows permits global hotkey hooks across elevated windows.
This project is licensed under the MIT License.