How harvinderkaur02/proton-voice-assistant works
Project Type and Purpose
• PROTON is a standalone, desktop‐based “voice assistant” application written in Python.
• It combines a GUI front end (using tkinter and a small local web interface) with a speech I/O layer, a core command‐processing engine, and a set of action modules (file navigation, web search, date/time retrieval, etc.).
File Structure
• Top Level:
• requirements.txt – lists all Python dependencies.
• memory.txt – simple persistent store for “memory” or context.
• demo_media/ – screenshots and assets for demos (not part of runtime).
• src/ directory:
• Proton.py – the heart of the application: listens for voice, dispatches commands, invokes modules, drives TTS.
• app.py – initializes and runs the GUI (tkinter window), loads the local web UI (src/web/index.html + CSS + JS).
• web/ – static assets (HTML, CSS, JS) providing a chat‐style UI embedded in the tkinter window.
Key Components
a. GUI Layer (Frontend)
• tkinter main window hosting a tiny embedded browser (or webview) that renders src/web/index.html
• JavaScript + CSS (jquery.convform) for interactive chat widget
b. Voice I/O Layer
• SpeechRecognition module captures microphone input
• pyttsx3 module synthesizes voice responses
c. Core Processing Engine
• Proton.py orchestrates:
• Voice input → speech‐to‐text
• Command parsing / intent recognition (keyword‐based)
• Dispatch to appropriate action module
• Text output → text‐to‐speech
• Date/Time module (datetime)
• Web Search module (webbrowser + wikipedia API)
• Location Finder module (webbrowser → Google Maps)
• File Navigator module (os, list & read directories)
• Automation module (pyautogui, keyboard for simulating mouse/keyboard)
• Memory module (simple read/write from memory.txt)
e. Concurrency
• Python threading used to prevent blocking UI during speech recognition and long‐running tasks
f. External Services
• Wikipedia API
• Google Search / Google Maps (via default web browser)
Relationships and Data Flows
• User speaks → Microphone → SpeechRecognition → Core Engine
• Core Engine parses → selects an Action Module → executes (e.g., opens browser, lists files)
• Action result → Core Engine → updates UI (chat HTML/JS) + sends text to pyttsx3 → audio response
• Core Engine optionally reads/writes memory.txt to store simple state
• UI events (button clicks, typed text) flow back into Core Engine via app.py
Architectural Patterns and Design Principles
• MVC-style separation:
• View = tkinter + web UI
• Controller = Proton.py (core engine)
• Model = Action Modules + memory.txt
• Plugin-style modularity: each “skill” is a self-contained module/function that the engine invokes
• Event-driven: voice OR UI events trigger the same central dispatcher
• Single-process, multi-threaded – no external servers or microservices