A sleek, lightweight, and offline-capable Voice Assistant built in C# using Windows Forms, leveraging the native System.Speech library for text-to-speech (TTS) and speech recognition. It allows users to control system volume, toggle system-wide dark/light themes via registry values, manage files, open/close common Windows apps, and use a dedicated hands-free Voice Calculator with vocal confirmations.
- ๐ฃ๏ธ Speech Recognition & Synthesis: Fully offline, local speech processing using
System.Speech.RecognitionandSystem.Speech.Synthesis. - ๐ป System Commands: Lock workstation, check time, current date, and perform volume controls (up/down).
- ๐จ PC Theme Control: Toggle system-wide Windows Immersive Dark Mode and Light Mode dynamically using registry hooks and DWM (Desktop Window Manager) updates.
- ๐งฎ Voice Calculator Subsystem: Activating with
"voicecal"launches a standalone hands-free math utility, allowing verbal equations (e.g.,"10 plus 15","50 times 3") and vocalizing the answers. - ๐ File System Operations: Voice commands to programmatically create or delete specific operational directories on the
D:drive (D:\Check\Folder). - ๐ App Launcher & Controller: Launch and close native and third-party desktop applications (Notepad, Calculator, Paint, Word, Excel, Chrome, Firefox, Windows Camera, Settings panel).
The following diagram illustrates the flow of voice input processing, decision matching, and system response/action execution within the Voice Assistant:
graph TD
A[๐ค User Voice Input] --> B[๐ง Speech Recognition Engine]
B --> C{๐ช Command Parser & Matcher}
C -->|Voice Calculator Command| D[๐งฎ Voice Calculator Form]
C -->|System Commands| E[โ๏ธ OS & Volume Controller]
C -->|Theme Commands| F[๐จ Windows Registry Theme Changer]
C -->|Application Commands| G[๐ Process Launcher/Closer]
C -->|File Commands| H[๐ File System Manager]
D --> I[๐ฃ๏ธ Speech Synthesizer Response]
E --> I
F --> I
G --> I
H --> I
I --> J[๐ Audio Feedback via Speakers]
I --> K[๐ฌ UI Console Update]
Speak the following phrases clearly into your microphone to control the console:
| Voice Command | Action Description | Assistant Response |
|---|---|---|
"hello" |
Greetings | "Hello! How Can I help you?" |
"time" |
Reads current system time | "10:30 AM" (Current time) |
"day" |
Reads current weekday and date | "Today is Friday, June 12" |
"lock" |
Locks your Windows workstation | "Locking your computer" |
"volume up" |
Simulates system volume-up keypresses | "Volume increased" |
"volume down" |
Simulates system volume-down keypresses | "Volume decreased" |
"exit" |
Closes the application | (Exits app) |
| Voice Command | Action Description | Supported Applications |
|---|---|---|
"open <app>" |
Launches the application | notepad, calculator, paint, winword (Word), excel, chrome, firefox, camera, settings, control (Control Panel) |
"close <app>" |
Terminates running process safely | Same as above |
| Voice Command | Action Description |
|---|---|
"pc dark" / "dark" |
Switches Windows App/System settings to Dark Theme |
"pc light" / "light" |
Switches Windows App/System settings to Light Theme |
| Voice Command | Action Description | Target Path |
|---|---|---|
"create" |
Creates folder structure | D:\Check\Folder |
"delete" |
Safely deletes the empty folder | D:\Check\Folder |
Activate by saying "voicecal". The main app window hides, and the custom Calculator form opens.
- Synthesized Cue: "Voice calculator ready. Please say your calculation."
- Format:
"[Number] [Operation] [Number]"(Supports numbers0to100). - Supported Operations:
"plus"(Addition)"minus"(Subtraction)"times"(Multiplication)"divide"(Division)
- Examples:
"12 plus 45"โก๏ธ "Answer is 57""10 times 8"โก๏ธ "Answer is 80"
- To exit calculator and return to main panel, say:
"close"or"exit".
| Method | Description |
|---|---|
recognizer_SpeechRecognized() |
Handles all recognized voice commands |
SetSystemDarkMode() |
Enables or disables dark mode |
OpenApp() / CloseApp() |
Opens or closes applications |
CreateFolderInDDrive() / DeleteFolderFromDDrive() |
Folder management in D: |
ToggleSpeechRecognition() |
Enables or disables the speech engine |
GetGreeting() |
Time-based greetings (morning, afternoon, etc.) |
voice-assistant/
โโโ .gitignore # Standard Visual Studio gitignore
โโโ voice asistant.sln # Visual Studio Solution file
โ
โโโ voice asistant/ # Main Source Project
โ โโโ App.config # App configurations (.NET runtime settings)
โ โโโ voice asistant.csproj # MSBuild Project specification
โ โโโ Program.cs # App entrypoint
โ โโโ Form1.cs # Main GUI & voice parsing loop
โ โโโ Form1.Designer.cs # Main designer code
โ โโโ Form1.resx # Main form resources
โ โโโ calculator.cs # Voice Calculator subsystem Form
โ โโโ calculator.Designer.cs # Calculator designer code
โ โโโ calculator.resx # Calculator form resources
โ โโโ Properties/ # Assembly and resource properties
โ
โโโ Voice-Assistant-App/ # Setup and Deployment Project folder
โ โโโ Voice-Assistant-App.vdproj
โ
โโโ assets/ # Shared media assets
โโโ screenshot.png # Console User Interface mockup
โโโ architecture-diagram.png # Generated architecture diagram
| Component | Version / Details |
|---|---|
| OS | Windows 10 or 11 |
| .NET Framework | 4.7.2 or higher |
| IDE | Visual Studio 2019 / 2022 |
| Libraries | System.Speech, System.Drawing, Microsoft.Win32, System.Runtime.InteropServices, System.Diagnostics |
| Hardware | Microphone (for speech input) |
The voice assistant is packaged as a portable executable or a compressed installer:
- Navigate to the Releases v1.0.0 page on the GitHub repository.
- Download the Voice.Assistant.zip.
- Extract the
.ziparchive to any directory on your computer. - Double-click
voice asistant.exeto run the app instantly. No configuration is required!
Note
Make sure your microphone is connected and configured as the default recording device in Windows Sound settings before launching.
- Clone this repository to your local machine:
git clone https://github.com/PTharanan/voice-asistant.git
- Open the solution file
voice asistant.slninside Visual Studio. - Verify references to the native assemblies:
System.Speech(Speech recognition engine)System.Windows.Forms(User Interface)
- Set the solution configuration to
ReleaseorDebug. - Press
F5or click Start in Visual Studio to build and run the project.
| Issue | Solution |
|---|---|
| Speech not recognized | Check microphone input; set as default device |
| Theme not changing | Run Visual Studio as Administrator |
| App not opening | Ensure the app (e.g., Chrome, Word) is installed |
| โAccess deniedโ during folder creation | Grant write permission to D: drive |
- ๐ Add internet-based commands (weather, news, search)
- ๐๏ธ Calendar and reminder integration
- ๐ช Custom user-defined commands
- ๐ต Music and media control
- ๐ง LLM integration for advanced conversational mode
This project is licensed under the MIT License โ feel free to modify, distribute, and use it in your own projects.
Perinpamoorthy Tharanan
๐ฌ Developer โข Voice UI Enthusiast โข C# Automation Engineer
๐ง ptharanan@gmail.com
๐ GitHub Profile

