begin process at 2010 09 03 07:30:59
  Trouver un code source :
 
dans
 
Accueil > 

Tutoriels

 > 

Multimédia

 > RECONNAISSANCE VOCALE AVEC LES MS AGENT

RECONNAISSANCE VOCALE AVEC LES MS AGENT


 Information sur le tutoriel

Note :
Aucune note

 Description

Voici un tutorial sur programmation des MsAgent pour les utiliser dans une application de reconnaissance vocale.
Mon tutorial est en anglais, mais il est simple à comprendre.

Tutorial

The MsAgent

What do you need to know about the MsAgent?

Do you remember the MsAgent? These small characters which help and guide you in Microsoft office applications?

The MsAgent get several other capabilities like vocal commands, and from this point they seem to be very useful in attractive and interactive ways.

In a speech enabled application they could make the scene as a bridge between the user and the computer : you tell it something and it makes the computer reacts to the thing you said.

The MsAgent is in fact a powerful character full of essential capacities to interact with the user.

So let's get a look on how to make a MsAgent react to your voice, and compare it to the previous components integrated in the Microsoft Speech Sdk.

Implementation and code example

Speech recognition permit you to associate one or many words to a command : when one word is recognized, an event will be generated.

In a first time you will have to declare the different references which correspond to the implementation of the MsAgent and declare the objects AxAgent and IagentCtlCharacterEx.

MsAgent

using AgentObjects;

...

private AxAgentObjects.AxAgent agent;

private IAgentCtlCharacterEx myCharacter;

After that is done, you just have to initialize your agent by this way :

MsAgent

agent = new AxAgentObjects.AxAgent();

this.agent.BeginInit();

this.form.Controls.Add(agent);

agent.EndInit();

agent.Characters.Load("Peedy", (object)"C:/Windows/Msagent/chars/Peedy.acs");

myCharacter = agent.Characters["Peedy"];


You see that you have to begin the initialization of the agent : it is just to add the Agent control to your form or to the object you want the MsAgent to interact with.

Then, You have to load a character, the one you have installed giving its path, and giving it a name.Let's now see how to create some commands for the MsAgent.

Associate a command to one or many words

In this section we will see the way to create a entire command which will be able to be recognize by the MsAgent with an event.

This example is a creation of a command for a menu :

MsAgent

myCharacter.Commands.Caption = "Test";

myCharacter.Commands.Add("Say Hello", // Command name

(object)"Hello", // Display name

(object)"Hello", // SR Name

(object)true, // Enabled

(object)true); // Visible


To add a command, you just have to define a caption, for example here "Test", and then you will have to define the caracteristics of the command.

You add a command by giving it a name, the display name in the agent configuration, the word that the agent will react to, and finally options to activate it and enable it.

Now you just have created your first command, let's see how to make it recognized.

Finally, don't forget to enable the listening on your character :

MsAgent

myCharacter.Listen(true);

Command implementation

The implementation is carried out by factual method called OnCommand. Now let's see how does it work:

MsAgentEvent

private void OnCommand(object sender,

AxAgentObjects._AgentEvents_CommandEvent e)

{

IAgentCtlUserInput ui;

ui = (IAgentCtlUserInput)e.userInput;

if (ui.Name.Equals("Say Hello"))

{

myCharacter.Speak((object)"Hello", null);

}

...

}

We take the user input with the object IagentCtlUserInput and we are able to get the command name you have implemented above.

You can create whatever you want in the if, in this example we have make the agent speak.

Commentaires

Commentaire de some_one le 15/08/2008 14:07:12

Parfait.

Merci pour ton tutoriel.

 Ajouter un commentaire




Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Septembre 2010
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
27282930   

Consulter la suite du CalendriCode

Photothèque

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,047 sec (4)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales