Skip to content

Voice-to-Speech Extension

2023 · Prototype

status
Prototype, not published

A Chrome extension prototype for voice input and text-to-speech, built with accessibility in mind. Tested locally and never published to the Chrome Web Store.

Problem

Accessibility and productivity for text dictation.

Solution

A lightweight extension that adds voice input and read-aloud to any web page.

My Role

Developer

Tech Stack

Chrome Extension API
Web Speech API
JavaScript

Overview

A Chrome extension prototype that adds voice input and text-to-speech to web pages, built with accessibility in mind. It uses the browser's Web Speech API for both recognition and synthesis, so quality and language coverage depend on the browser's own speech engine.

Status: prototype. It was tested locally and never published to the Chrome Web Store. The public repository currently holds only the README and licence.

Problem & Solution

The Accessibility Challenge

  • Digital Divide: 15% of the global population lives with some form of disability, yet most websites lack adequate accessibility features
  • Input Barriers: Traditional keyboard/mouse input can be challenging for users with motor disabilities
  • Reading Difficulties: Users with dyslexia, visual impairments, or learning disabilities need alternative content consumption methods
  • Productivity Gaps: Voice input can be 3x faster than typing for many users, but most websites don't support it natively

Our Solution

The Voice-to-Speech Extension provides:

  • Universal Voice Input: Convert speech to text on any website input field
  • Intelligent Text-to-Speech: Read any selected text or entire web pages aloud
  • Browser-Based: Uses the browser's built-in speech APIs
  • Customizable Experience: Adjustable speech rate, pitch, volume, and language settings
  • Seamless Integration: Works with existing websites without requiring modifications

Technical Architecture

Core Technologies

Web Speech API Integration

  • Speech Recognition: Real-time voice-to-text conversion using browser's native capabilities
  • Continuous Listening: Advanced noise filtering and pause detection
  • Multi-language Support: the languages available depend on the browser's speech engine
  • Confidence Scoring: Quality assessment for transcription accuracy

Speech Synthesis API

  • Natural Voice Output: High-quality text-to-speech using system voices
  • Voice Selection: Access to all installed system voices
  • Prosody Control: Fine-tuned control over speech rate, pitch, and volume
  • SSML Support: Advanced speech markup for enhanced pronunciation

Chrome Extensions API

  • Content Script Injection: Seamless integration with web pages
  • Background Processing: Persistent functionality across browser sessions
  • Context Menus: Right-click integration for quick access
  • Keyboard Shortcuts: Customizable hotkeys for power users

Extension Architecture

Manifest V3 Implementation

{
  "manifest_version": 3,
  "name": "Voice-to-Speech Chrome Extension",
  "version": "1.0.0",
  "permissions": [
    "activeTab",
    "storage",
    "contextMenus"
  ],
  "background": {
    "service_worker": "background.js"
  },
  "content_scripts": [{
    "matches": ["<all_urls>"],
    "js": ["content.js"]
  }]
}

Component Structure

  • Background Script: Manages extension lifecycle and cross-tab communication
  • Content Script: Handles webpage interaction and DOM manipulation
  • Popup Interface: User-friendly control panel for quick settings
  • Options Page: Comprehensive settings and customization panel

Privacy

Recognition uses the browser's Web Speech API. In Chrome this may send audio to Google's speech service, so the extension should not be treated as fully local processing.

Key Features & Capabilities

Voice Input System

  • Instant Activation: Click-to-talk or keyboard shortcut activation
  • Smart Field Detection: Automatically focuses on text input fields
  • Continuous Mode: Hands-free dictation with voice commands
  • Punctuation Commands: Voice-controlled punctuation and formatting
  • Multi-field Support: Seamless switching between input fields

Text-to-Speech Engine

  • Selective Reading: Read highlighted text, paragraphs, or entire pages
  • Smart Parsing: Intelligent content extraction ignoring navigation elements
  • Reading Controls: Play, pause, stop, and skip functionality
  • Progress Tracking: Visual indicators showing reading progress
  • Auto-scroll: Synchronized scrolling with speech output

Accessibility Features

  • Screen Reader Compatibility: Works alongside existing assistive technologies
  • High Contrast Mode: Enhanced visual indicators for low-vision users
  • Keyboard Navigation: Full functionality accessible via keyboard
  • Focus Management: Proper focus handling for screen reader users
  • ARIA Compliance: Comprehensive accessibility markup

Customization Options

  • Voice Profiles: Save different settings for different use cases
  • Language Switching: Quick switching between input/output languages
  • Hotkey Customization: User-defined keyboard shortcuts
  • Visual Themes: Multiple UI themes including high contrast options
  • Behavioral Settings: Configurable auto-pause, speed adjustment, and more

Technical Challenges & Solutions

1. Cross-Site Compatibility

Challenge: Ensuring consistent functionality across diverse website architectures and frameworks Solution: Developed robust DOM manipulation system with fallback strategies for different input field types

2. Real-time Speech Processing

Challenge: Minimizing latency between speech input and text output while maintaining accuracy Solution: Implemented optimized speech recognition with predictive text suggestions and confidence-based auto-correction

3. Browser Performance Optimization

Challenge: Maintaining minimal performance impact while providing rich functionality Solution: Lazy loading of speech engines, efficient event handling, and memory management optimization

4. Multi-language Support

Challenge: Supporting diverse languages with different speech patterns and writing systems Solution: Dynamic language model loading with automatic language detection and switching

Innovation Highlights

1. Adaptive Speech Recognition

  • Context-Aware Processing: Adjusts recognition based on webpage content type
  • Learning Algorithm: Improves accuracy based on user correction patterns
  • Noise Filtering: Advanced background noise suppression
  • Accent Adaptation: Personalizes recognition for user's speech patterns

2. Intelligent Content Parsing

  • Semantic Analysis: Identifies readable content vs. navigation elements
  • Structure Recognition: Maintains document hierarchy in speech output
  • Link Handling: Special treatment for links, buttons, and interactive elements
  • Table Reading: Structured reading of tabular data

4. Universal Web Integration

  • Framework Agnostic: Works with React, Angular, Vue, and vanilla websites
  • Dynamic Content: Handles single-page applications and AJAX updates
  • Form Integration: Seamless integration with complex form systems
  • E-commerce Compatibility: Optimized for shopping and checkout processes

User Experience Design

Interface Design Principles

  • Minimalist Approach: Clean, uncluttered interface focusing on core functionality
  • Accessibility First: High contrast, large touch targets, clear visual hierarchy
  • Contextual Controls: Relevant options appear based on current webpage context
  • Progressive Disclosure: Advanced features hidden until needed

Interaction Patterns

  • One-Click Activation: Single click to start voice input or text reading
  • Visual Feedback: Clear indicators for listening, processing, and speaking states
  • Error Handling: Graceful error messages with suggested solutions
  • Undo/Redo: Easy correction of speech recognition errors

Browser Compatibility & Support

Primary Support

  • Chrome: Version 90+ (Full feature support)
  • Microsoft Edge: Version 90+ (Full feature support)
  • Brave Browser: Latest version (Full feature support)

Partial Support

  • Opera: Version 76+ (Core features, limited voice selection)
  • Chromium: Latest builds (Full support with manual installation)

API Requirements

  • Web Speech API: Required for voice recognition functionality
  • Speech Synthesis API: Required for text-to-speech features
  • Chrome Extensions API: Required for browser integration

Installation & Distribution

Distribution

Not published. The extension has only been loaded locally as an unpacked extension.

Developer Installation

# Clone the repository
git clone https://github.com/NaoiseLaw/Voice-to-speech-Chrome-Extenstion.git
 
# Navigate to Chrome Extensions
chrome://extensions/
 
# Enable Developer Mode
# Click "Load unpacked" and select the extension directory

Licence

The repository is licensed under GPL-3.0.

Technical Documentation

API Reference

// Voice Recognition API
const recognition = new webkitSpeechRecognition();
recognition.continuous = true;
recognition.interimResults = true;
recognition.lang = 'en-US';
 
// Speech Synthesis API
const utterance = new SpeechSynthesisUtterance(text);
utterance.rate = 1.0;
utterance.pitch = 1.0;
utterance.volume = 1.0;

Extension Messaging

// Background to Content Script Communication
chrome.tabs.sendMessage(tabId, {
  action: 'startListening',
  options: { language: 'en-US', continuous: true }
});
 
// Content Script Response
chrome.runtime.sendMessage({
  action: 'speechResult',
  text: recognizedText,
  confidence: confidenceScore
});

Lessons Learned & Development Insights

Technical Learnings

  1. Browser API Limitations: Working within Web Speech API constraints required creative solutions
  2. Cross-Site Compatibility: Different websites require adaptive DOM manipulation strategies
  3. Performance Optimization: Balancing feature richness with minimal resource usage
  4. Privacy Implementation: Building trust through transparent, local-only processing

User Experience Insights

  1. Accessibility First: Designing for disability creates better experiences for everyone
  2. Feedback Importance: Visual and audio feedback crucial for voice interface confidence
  3. Customization Value: Users have diverse needs requiring flexible configuration options
  4. Error Recovery: Graceful error handling more important than perfect accuracy

Development Process

  1. User Testing: Early and frequent testing with target accessibility community
  2. Iterative Design: Rapid prototyping and feedback incorporation
  3. Documentation: Comprehensive documentation essential for open source adoption
  4. Community Building: Engaging with accessibility advocates and developers

Making the web accessible, one voice at a time.

The Voice-to-Speech Chrome Extension represents the future of inclusive web browsing—where technology serves everyone, regardless of ability.

Try it: GitHub Repository