With millions of Web sites out there on the Internet, you’re going to have to think up some pretty innovative ways for your Web site to be noteworthy. And let’s face it, without a Web site that stands out, users won’t stick around and spend much time, or even come back.
You’re looking for more than just a pretty Web site?there are more important things than just luring people in. A lot of people just plain have trouble reading. And if your Web applications are speech enabled, users won’t have to do too much reading to benefit from the contents. Or how about users who might be seriously visually impaired or blind? By speech-enabling your Web site, even these people can benefit from the contents.
One more very powerful argument for using these Microsoft Agent technologies in your Web site is that they can provide not only speech, but also animation and interactivity. With them, your Web site visitors can get a guided tour of your site’s products and services. They can ask questions and get answers. They can point to the rise in sales for your company’s chart, which will be much more powerful than a plain graph.
The technology is actually built on ActiveX. Two ActiveX controls provide the Microsoft Agent character, animation, and speech capabilities. These controls are not server-side components, but they are embedded into the HTML and are invoked just as any other ActiveX controls would be in an HTML page.
You need to be aware of a few things before you use the Microsoft Agent components. The first is that the core components must be installed on the client computer before a speech-enabled Web site will work properly. The second thing you must make sure of is that the agent characters have been installed on the computer. And the third thing you must be sure about is that the speech module, which lets the Microsoft Agent components speak through your sound system, is installed.
You can download all the agent requirements from Microsoft Agent home Page:
Note: if you have Windows Xp ,or Windows 2000, Microsoft has already being installed on your Computer, You can find it in: C:Windows msagent
You need to Download:
1.Agents, you can download the from :
http://www.microsoft.com/msagent/downloads/user.asp there are 4 characters from Microsoft (Merlin the wizard ,Genie the Genie ,Robby the Robot, Peedy the bird)
Note: that each agent has its own animations ,but there are certain common animation between them, I have included only a sample animations in the project .
2. Speech engine, you can download the from :
Now let us look at some samples and the code to work with the Microsoft Agent:
Agent Can speak!!!!
Agent can play an animation!!!
Agent can move!!!
Now for the code, as you have seen above, these controls (the agent and the speech) are not server-.side components, but they are embedded into the HTML, so you need to write a script to run it.
What I did here is that I wrote a class Called AgentClass.cs (you will find it with the project attached), which encapsulates the Agent functionality, and here are all the methods used in the class with their functionality
|Causes the Agent character to hide from view.||AgentClass.cs||Hide()|
|Causes the Agent character to show itself.||AgentClass.cs||Show()|
|Uses special values such as AgentCenterX and AgentBottomY to move to screen-relative locations.||AgentClass.cs||MoveToSpecial()|
|Causes the Agent character to speak.||AgentClass.cs||Speak()|
|Causes the Agent character to gesture from some predefined gestures.||AgentClass.cs||Gesture()|
|Causes the Agent character to go through thinking motions.||AgentClass.cs||Think()|
|Causes the Agent character to play an animation.||AgentClass.cs||Play()|
|This is a property. It allows the selection of the Agent character, such as Genie or Merlin.||AgentClass.cs||Character()|
|This method calls OutputAgentControl() and OutputSpeechControl() so that the objects are emitted into the HTML stream.||AgentClass.cs||OutputObjects()|
|This method outputs the Agent control object into the HTML stream.||AgentClass.cs||OutputAgentControl()|
|This method outputs the speech control object into the HTML stream.||AgentClass.cs||OutputSpeechControl()|
|This method emits the script start tag.||AgentClass.cs||StartScript()|
|This method emits the method that gets the special screen positions that can be used to center the Agent character.||AgentClass.cs||OutputGetPositions()|
|This method emits the method that is called when the window loads.||AgentClass.cs||OutputOnLoad()|
|This method emits the method that loads the Agent character.||AgentClass.cs||OutputLoadAgent()|
|This method emits the method that sets the character.||AgentClass.cs||OutputSetCharObj()|
|This method emits the method that checks the load status.||AgentClass.cs||OutputCheckLoadStatus()|
|This method emits the method that shows a load error.||AgentClass.cs||OutputLoadError()|
|This method outputs the method that contains all of the Agent commands.||AgentClass.cs||OutputCommands()|
|This method emits the script end tag.||AgentClass.cs||EndScript()|
The OutputAgentControl() method simply emits the HTML code that embeds the Agent control ActiveX into the HTML document
You can also see the OutputSpeechControl() method,is the speech object that is emitted into the HTML document that embeds the speech ActiveX controls.
Just to show you how easy it is to use the AgentClass class to create an Agent script, let’s take a look at a simple code snippet. The following example shows how to substantiate an Agent class, make the Agent character show itself, and have the Agent character say something:
Just add the AgentClass.cs to your project and write this code in the page
Note: By default I have used Merlin(the wizard) ,if you want to use another one,just add this line of code: ag.setChar( Agent Name); as a string e.g.
Agent ag = new Agent();
ag.Speak( “Hi there!” );
Agent ag = new Agent();
You will find more examples in the project attached
Summary – C# MS Speech Agent:
Microsoft Agent characters are a great way to speech-enable your applications and make them come alive. Your applications can become interactive and hold the attention of your users.
Not only will the Agent characters add a lot of spice to your Web site, but they also can add functionality for people with reading and vision problems. This chapter has shown you a class that makes it easy to programmatically add Microsoft Agent characters to your Web site. The class is easy to use, and with it you won’t have any problem taking your application to the next step.
Project File: Speech.zip