Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !

RECONNAISSANCE VOCALE AVEC LES MS AGENT


Information sur le tutorial

Catégorie :Multimédia Tutorial .NET ( DotNet ) Date de création : 13/06/2007 18:30:26 Vu : 3 728 fois

Note :
Aucune note

Commentaire sur cette source (1)
Ajouter un commentaire et/ou une 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.

signaler à un administrateur
Commentaire de some_one le 15/08/2008 14:07:12

Parfait.

Merci pour ton tutoriel.

Ajouter un commentaire



Nos sponsors

Sondage...

CalendriCode

Novembre 2008
LMMJVSD
     12
3456789
10111213141516
17181920212223
24252627282930

Consulter la suite du CalendriCode



Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel BAÏSE, 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
Temps d'éxécution de la page : 0,062 sec

Google Coop CodeS-SourceS Google Coop CodeS-SourceS


Certaines images présentes sur le site (notament certains avatars) sont issues des collections IconShock, donc si vous souhaitez utiliser ces icons vous devez les acheter, ne les copiez pas et ne utilisez pas dans vos sites et applications sans les avoir commandé.