PowerShell Speech Recognition: How To Set up Voice Commands & Responses

  Рет қаралды 305

ITPro Today

ITPro Today

Күн бұрын

Learn how to create a PowerShell script that can listen to your voice and respond with spoken words.
01:37 Setting up Speech Synthesis
04:01 Configuring Speech Recognition
06:22 Implementing the Script Logic
09:14 Running the Script
*The Script Used in This Tutorial*
Adapted from outnull.wordpr...
Allow PowerShell to Speak
Add-Type -AssemblyName System.Speech
$Talk = New-Object -TypeName System.Speech.Synthesis.SpeechSynthesizer
Setup the Speech Recognition Engine Object
$SpeechRecognitionEngine = New-Object -TypeName System.Speech.Recognition.SpeechRecognitionEngine
Define the verbal commands to be supported by the script
$Grammar = New-Object -TypeName System.Speech.Recognition.GrammarBuilder
$Grammar.Append(“Hello”);
$SpeechRecognitionEngine.LoadGrammar($Grammar);
$Grammar = New-Object -TypeName System.Speech.Recognition.GrammarBuilder
$Grammar.Append(“Exit”);
$SpeechRecognitionEngine.LoadGrammar($Grammar);
$SpeechRecognitionEngine.InitialSilenceTimeout = 15
$SpeechRecognitionEngine.SetInputToDefaultAudioDevice();
$CMDBoolean = $false;
While ($CMDBoolean -eq $False) {
$SpeechRecognize = $SpeechRecognitionEngine.Recognize();
$Conf = $SpeechRecognize.Confidence;
$MyWords = $SpeechRecognize.text;
if ($MyWords -match “hello” -and [double]$conf -gt 0.85) {
$Talk.Speak(“Hello”);
}
if ($MyWords -match “exit” -and [double]$conf -gt 0.85) {
$Talk.Speak(“Goodbye”);
$CMDBoolean = $True;
}
}
Brien Posey is a bestselling technology author, speaker, and 21x Microsoft MVP. In addition to his ongoing work in IT, Posey has trained as a commercial astronaut candidate in preparation to fly on a mission to study polar mesospheric clouds from space.
For daily news, analysis, opinions and how-to’s about the IT industry, visit us at ITPro Today: www.itprotoday...
Music by AudioCoffee on Pixabay
#powershellscripting #voicerecognition #texttospeech #powershell

Пікірлер
5 Tips to Help You Learn Windows PowerShell
18:34
Gary Explains
Рет қаралды 44 М.
PowerShell Scripts
49:37
TechThoughts
Рет қаралды 82 М.
DID A VAMPIRE BECOME A DOG FOR A HUMAN? 😳😳😳
00:56
Я сделала самое маленькое в мире мороженое!
00:43
Кушать Хочу
Рет қаралды 4,8 МЛН
Бенчик, пора купаться! 🛁 #бенчик #арти #симбочка
00:34
Симбочка Пимпочка
Рет қаралды 3,5 МЛН
This is How I Scrape 99% of Sites
18:27
John Watson Rooney
Рет қаралды 129 М.
Become a PowerShell Master Writing Advanced Functions! [Part 1]
24:18
Using PS2EXE To Turn PowerShell Scripts Into Executables
11:14
ITPro Today
Рет қаралды 5 М.
Dynamic Parameters in PowerShell Functions
8:35
ITPro Today
Рет қаралды 622
How To Perform Exploratory Data Analysis
17:53
ITPro Today
Рет қаралды 123
The Worst Programming Language Ever - Mark Rendle - NDC Oslo 2021
1:00:41
NDC Conferences
Рет қаралды 1,3 МЛН
Learn and use PowerShell with just three commands - OLD
13:26
TechThoughts
Рет қаралды 251 М.
Think Fast, Talk Smart: Communication Techniques
58:20
Stanford Graduate School of Business
Рет қаралды 41 МЛН
DID A VAMPIRE BECOME A DOG FOR A HUMAN? 😳😳😳
00:56