PowerShell has a speech synthesis class with a speak method (who knew ?) so that the host console can now 'talk' with your user.
I have been having a little fun with it.
#The engine is exposed through the class [System.Speech] by adding the type:
Add-Type -AssemblyName System.Speech
#We then build a named instance (an instance of the class).
#We store ours in the variable tts (text to speech):
#create the instance with new-object
$tts = New-Object System.Speech.Synthesis.SpeechSynthesizer
#Now we can call the speak method on the instance by dot sourcing but before that we need to have a text to read:
$readFileOutLoud = <path to text file>
#I used my config script path location.
#I can now call the method:
$tts.Speak($readFileOutLoud)
It worked flawlessly.
Could we just as readily include any custom spoken out-put through means of a variable that stores our custom message ?
$myPhrase = {"PowerShell ROCKS"}
#test our variable
#$myPhrase shows the expected output "PowerShell ROCKS"
#call the speak method:
$tts.Speak($myPhrase)
Success !
You can use any variable from your current session with the correct data type or you can create one for your use
and that, that is all, just 'to cool for school'.
#Let's build a function that will both tell my user something and write the same output to the console host:
function showAndTell
{$myPhrase,
$tts.Speak($myPhrase)
}
#call the function by typing its' name
#showAndTell
That's pretty cool.
But not cool enough.
Include a little boiler-plate so that the custom in session function is findable to PowerShell's' get-Help and Get-Command functionalities:
function showAndTell
{<#
.SYNOPSIS
The function is an advanced command that out-puts both a verbose message and an audio message.
.DESCRIPTION
The function both 'speaks' to your user and outputs to the
console host screen your custom message.
.PARAMETER ParameterA
The description of the ParameterA parameter.
.PARAMETER ParameterB
The description of the ParameterB parameter.
.EXAMPLE
type: showAndTell
This example shows how to run the command.
.INPUTS
System.Object
.OUTPUTS
The function writes an informational message to the
console host and outputs an audio message to your user.
.NOTES
The function is executed in serial fashion as
a first in first out operation.
#functionName : showAndTell
#codeAuthor : Steven McKnight
#Company : MpMxLabs
#ParallelLevel : OrderOneSerial (-s-)
#Source : Cyberex
#written at : Piety Hill
#Copyright (c) : 2016
.ROLE
OrderOne
.COMPONENT
Dependencies
.FUNCTIONALITY
Serial (-s-)
.LINK
about_Functions_Advanced
.LINK
about_Comment_Based_Help
.LINK
about_Functions
#>
$myPhrase,
$tts.Speak($myPhrase)
}
There you have it. Deeply cool.
I want to thank #Ryan Mattfield for his fine post here of
previous that got me to partying on text to speech.
The Internet of Everything
Monday, December 5, 2016
Sunday, September 18, 2016
What is a string Value....?
So then what is a string value..?
Unary operators and parathetical statements are strings indeed and
they are central in our discovery as to..."What is a string value ?".
To the system everything is an object. The initial object is termed <void>. Void is not nothing.It is a model.
It is a blueprint of an idea.The idea is one of a space for action.
For example, in Mathematics the plus sign ("+") denotes the operation 'addition'....
In operations like addition, take 2+3=5 for instance, the place of action is with the unary operator at the begining of the equation
2[+]3 followed by the '=' operator [=] followed by the result [5]. Note that it is a sequence of states.
The unary operator "+", the plus sign, does one thing (it is unary) and operates upon the data stores in one way only.
No matter the numbers being added together the operation produces the sum of the munbers.
In commputer programming as in Mathematics certain sigils denote something other and that other is concretely defined.
In computer science as in Math the paranthesis () is mapped to the idea or concept to 'do this first' within the operation.
The string composed of the two sigils in certain arangement "()" tells us how to proceed...do this first.
The two marks thus placed are signified as an expression telling us and the system without ambiguity what is intended in the order of operation.
So then the results of 9/(4+5)+5 is: 6, where-as the results of 9/4+(5+5) is: 12.25. This is fundemental to the correctness of our programs.
The square brackets also denote or are mapped to an idea.. that of a schema or model of a space to define unambigousely a specific data structure.
[<TypeName>]...read CLASS is a model of, or, blueprint for an instance of a thing, but,
it's not the actual thing...just a specification for describing the thing (the CLASS). Those something
elses are again and again and again data structures or stores and each is an object.
[]... is not a data structure. It is a place where there is a data structure.....To the system everything is a data structure
to be operated upon or a place where the operations "()" and data "[]" reside.... a kind of of conceptual <void> where stuff happens
or things can be built like models of objects and the objects themselves and these objects can then interact in meaningful and powerfull ways.
Unary operators and parathetical statements are strings indeed and
they are central in our discovery as to..."What is a string value ?".
To the system everything is an object. The initial object is termed <void>. Void is not nothing.It is a model.
It is a blueprint of an idea.The idea is one of a space for action.
For example, in Mathematics the plus sign ("+") denotes the operation 'addition'....
In operations like addition, take 2+3=5 for instance, the place of action is with the unary operator at the begining of the equation
2[+]3 followed by the '=' operator [=] followed by the result [5]. Note that it is a sequence of states.
The unary operator "+", the plus sign, does one thing (it is unary) and operates upon the data stores in one way only.
No matter the numbers being added together the operation produces the sum of the munbers.
In commputer programming as in Mathematics certain sigils denote something other and that other is concretely defined.
In computer science as in Math the paranthesis () is mapped to the idea or concept to 'do this first' within the operation.
The string composed of the two sigils in certain arangement "()" tells us how to proceed...do this first.
The two marks thus placed are signified as an expression telling us and the system without ambiguity what is intended in the order of operation.
So then the results of 9/(4+5)+5 is: 6, where-as the results of 9/4+(5+5) is: 12.25. This is fundemental to the correctness of our programs.
The square brackets also denote or are mapped to an idea.. that of a schema or model of a space to define unambigousely a specific data structure.
[<TypeName>]...read CLASS is a model of, or, blueprint for an instance of a thing, but,
it's not the actual thing...just a specification for describing the thing (the CLASS). Those something
elses are again and again and again data structures or stores and each is an object.
[]... is not a data structure. It is a place where there is a data structure.....To the system everything is a data structure
to be operated upon or a place where the operations "()" and data "[]" reside.... a kind of of conceptual <void> where stuff happens
or things can be built like models of objects and the objects themselves and these objects can then interact in meaningful and powerfull ways.
What is a string value...?
What is a string value ?
Seems like a fair question. Five simple words.
Computational thinking can help us to solve this most interesting question.
Type into the shell your name.
An error message will be displayed. In my example the host console screen displays this error message:
...
Seems like a fair question. Five simple words.
Computational thinking can help us to solve this most interesting question.
Type into the shell your name.
An error message will be displayed. In my example the host console screen displays this error message:
...
Steve : The term 'Steve' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Steve
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (Steve:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The error message is very informative.
First it echoes the input requesting action from the system. In my example it outputs my name Steve followed
by a colon separator and the familiar "The term 'steve' is not recognized as the name of a cmdlt, function, script file,
or operable program..." Notice that in the output of the error message that the data expressed in the part, 'The term 'Steve', is
in single quotes. A clue.
The experience of PowerShell is interactive. Interactive means that PowerShell is doing at least three things. It is
accepting input, interprting it, and operating upon it. This is fundemental I know, but, it is not trivial. It is interactive.
The error message encourages us to '...and try again.'
So we type: 'Steve' (with single quotes) and PowerShell quickly echoes to the hosts console screen: Steve
All is right with the world.
I then type '55555' (with the single quote marks) and the engine echoes to the hosts console monitor: 55555
As was to be expected.
I type 55555 (with no single qoute marks) and the engine displays 55555.
I type: 12 + 2.
The engine displays 14.
Hmmmm.
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Steve
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (Steve:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The error message is very informative.
First it echoes the input requesting action from the system. In my example it outputs my name Steve followed
by a colon separator and the familiar "The term 'steve' is not recognized as the name of a cmdlt, function, script file,
or operable program..." Notice that in the output of the error message that the data expressed in the part, 'The term 'Steve', is
in single quotes. A clue.
The experience of PowerShell is interactive. Interactive means that PowerShell is doing at least three things. It is
accepting input, interprting it, and operating upon it. This is fundemental I know, but, it is not trivial. It is interactive.
The error message encourages us to '...and try again.'
So we type: 'Steve' (with single quotes) and PowerShell quickly echoes to the hosts console screen: Steve
All is right with the world.
I then type '55555' (with the single quote marks) and the engine echoes to the hosts console monitor: 55555
As was to be expected.
I type 55555 (with no single qoute marks) and the engine displays 55555.
I type: 12 + 2.
The engine displays 14.
Hmmmm.
Wednesday, December 9, 2015
Variable, Assignment, and Trains ?
It will help in our programming to think in terms of Trains. A train has an engine...connected to the engine are cars...in those cars are boxes...and within those boxes are items....or if you like each car has people in them...and each of those people have a name. I will use standard notation now and the dollar sign is to be read variable. So then [Train] = $engine AND $Car AND $Box AND $Item. One of the true beauties of programming is this...there can be any number of trains...with engines of any sort...with any number of cars...with any number of boxes containing any item that you assign...you can have any variable that you choose...and you can assign its' value as anything...anything at all. Beautiful. Variable and Assignment.
Saturday, December 14, 2013
Communication is a good thing
Communication is a good thing. Tools for communication have driven technological innovation and scientific advances for nearly a century.
First telephone and television to today with video conferencing and three dimensional multi party telepresence interaction. We are driven to interact, to connect, to talk.
Hardware vendors now have made readily available very sophisticated camera/ microphone array devises built for the masses at about a hundred dollars a pop. Telepresence is a reality on even the most common modern computer. People now…”Skype it up”.
Engagement in social media has become a global activity. From the earliest reports of world events to what my cat did this morning every minute of every day throughout the world somebody is tweeting about it, sharing it on Face-book, and creating collage with the elements on So.cl.
Soon many distantly located small to large companies and organizations will be able to attend many meetings and directly collaborate in real time through the intelligent use of these forms of communication technologies.
Friday, November 1, 2013
The Device
The idea of a device that can act as a ‘personal assistant’
is now close at hand. Our smartphones, laptops, and tablets are every bit as
capable and powerful as the full desktop console of ten years ago.
Imagine a handheld device seamlessly connected with every
other machine at the home and the office. Then imagine the device also
connected with massive private and public databases accessing every keystroke
and website record created from your entire Internet experience.
Such a device can and will enable you to be more productive
at work and more capable at home. With the current reality of nearly infinite
compute and storage this humble genius that is always at your disposal is just
around the corner and will become reality very soon.
This assistant will ‘know’
you, your preferences, your wants, your needs, and desires and will make
recommendations and, as well, will be able to coach the individual in every
important aspect of life.
The ‘device’ will always be on and connected and will
becomes as common as todays’ smartphones’.
Natural language recognition combined with other methods
will created wholly novel and profoundly different systems of user interface.
Insight gained through the access to ‘big data” will enable
students to consider career choices that may not be ones that they themselves
are thinking of.
Doctors will be able
to diagnose conditions and recommend treatments that consider the totality of a
person’s health record…as well as a patient’s personal profile compiled from
this massive individualized database.
Emergency workers will benefit greatly from access to such
information when considering the best and safest course of action…safest for
themselves and the people that they serve.
Companies and department store will be able to custom tailor
their offerings to the individual consumer.
The Device is coming… I’m going to name mine Cari.
Monday, October 28, 2013
Bill Gates this summer stated that we are, ‘… just now
entering the golden era of computer science’.
Software is just now beginning to show use what nearly
unlimited compute can do. The types of modelling that will be required in order
to get a handle on global scale issues will require even more.
We are most nearly there now on the hardware side. Amdahl’s
law is currently in action making the returns in hardware development less than
the last advancements. The remarkable advances in software will continue.
We need it to. Global
scale issues are now on the agenda…and large scale, distributed cluster,
parallel systems will be a primary tool in helping to solve these issues. Climate
modeling, global disease transmission vectors, and stochastic simulations are
in their entirety to vast for any other method of resolution.
The era of the pocket genius…or intelligent assistant made
possible through the newest console whatever the form factor, smart-phone,
tablet, and laptop, desktop, all connected and a now with proudly novel,
continuous, interface is close at hand.
Getting answers is
just the beginning. Imagine a device that prompts you to ask the right
questions. Or, that monitors your breathing and skin temps…and asks you when
the last time you ate…or even, a carton of milk that ‘knows’ when it is nearly
empty…and adds it to the weekly shopping list. All these and more will occur in
the foreseeable future.
In the bigger picture, on the global scale technology can
and will help benefit the lives billions of people.
Let’s start getting ready…the future is bright ahead.
Subscribe to:
Posts (Atom)