[Test] Plugin voice remote controle (2 Viewers)

mzemina

Retired Team Member
  • Premium Supporter
  • February 23, 2005
    2,065
    14
    Tulsa, OK
    Home Country
    United States of America United States of America
    Khris said:
    ...
    *In his best Scotty voice from Star Trek IV:
    "Hello Computer"

    "WORKING"

    "Volume Up"

    "WORKING"

    :D

    Yes - All the while holding and speaking into the mouse. Priceless!
     

    guilhem

    Portal Member
    April 2, 2006
    23
    0
    44
    France
    Then the next step would be audio sound feedback (using Majel Barrett Roddenberry - sound clips) for each command - that would be cool! Yes - I know... Not permitted due to copyright. But it still would be cool!

    It's quite easy to add audio sound feedback but with Microsoft voice. so it is not so pretty or funny :p

    but it's a possibility.

    In the french forum we found a bug. When you have this plugin running and you use a contextual display ( F9 ), MediaPortal froze and the only thing we can do it's to kill it.

    So if you have any idea or if somebody know how the modal dialog are implemented thanks to help me.
     

    guilhem

    Portal Member
    April 2, 2006
    23
    0
    44
    France
    guilhem said:
    In the french forum we found a bug. When you have this plugin running and you use a contextual display ( F9 ), MediaPortal froze and the only thing we can do it's to kill it.

    So if you have any idea or if somebody know how the modal dialog are implemented thanks to help me.

    It's the first process plugin i made, so i don't know if i made error on it and i find no explantion in my code in MP code.

    Here my code (sorry comments are in most case in FRench)

    Code:
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Windows.Forms;
    using MediaPortal.GUI.Library;
    using ACTIVELISTENPROJECTLib;
    
    namespace TelecommandeVocale
    {
        public class Main : ISetupForm, IPlugin
        {
    
            // ******************************************
            // ***   D2claration
            // ******************************************
            private const String CRLF = "\r\n";
            private DirectSRClass _vcrVoice = new DirectSRClass();
            private String _speechGrammer = "[Grammar]" + CRLF +
                                             "langid = 1033" + CRLF +
                                             "type=cfg" + CRLF +
                                             "[<Start>]" + CRLF +
                                             "<start>=tv down" + CRLF +
                                             "<start>=tv up" + CRLF +
                                             "<start>=tv left" + CRLF +
                                             "<start>=tv enter" + CRLF +
                                             "<start>=tv right" + CRLF +
                                             "<start>=tv back" + CRLF
                                                ;
    
            //
            // Constructeur
            public Main()
            {
            }
    
    
            // ******************************************
            // ***   Partie du formulaire du SETUP
            // ******************************************
            #region ISetupForm Members
    
            // Returns the name of the plugin which is shown in the plugin menu
            public string PluginName()
            {
                return "Telecommande Vocale";
            }
    
            // Returns the description of the plugin is shown in the plugin menu
            public string Description()
            {
                return "Télécommander MP à la voix";
            }
    
            // Returns the author of the plugin which is shown in the plugin menu
            public string Author()
            {
                return "Guilhem";
            }
    
            // show the setup dialog
            public void ShowPlugin()
            {
                MessageBox.Show("Non encore implementé");            
            }
    
            // Indicates whether plugin can be enabled/disabled
            public bool CanEnable()
            {
                return true;
            }
    
            // get ID of windowplugin belonging to this setup
            public int GetWindowId()
            {
                return 6780;
            }
    
            // Indicates if plugin is enabled by default;
            public bool DefaultEnabled()
            {
                return true;
            }
    
    
    
            // indicates if a plugin has its own setup screen
            public bool HasSetup()
            {
                return true;
            }
    
            /// <summary>
            /// If the plugin should have its own button on the main menu of Media Portal then it
            /// should return true to this method, otherwise if it should not be on home
            /// it should return false
            /// </summary>
            /// <param name="strButtonText">text the button should have</param>
            /// <param name="strButtonImage">image for the button, or empty for default</param>
            /// <param name="strButtonImageFocus">image for the button, or empty for default</param>
            /// <param name="strPictureImage">subpicture for the button or empty for none</param>
            /// <returns>true  : plugin needs its own button on home
            ///          false : plugin does not need its own button on home</returns>
            public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage)
            {
                strButtonText = PluginName();
                strButtonImage = String.Empty;
                strButtonImageFocus = String.Empty;
                strPictureImage = String.Empty;
                return true;
            }
            #endregion
    
    
            // ******************************************
            // ***   Plugin process
            // ******************************************
            #region IPlugin Members
    
            public void Start()
            {
                
                _vcrVoice.GrammarFromString(_speechGrammer);
                _vcrVoice.Activate();
    
                _vcrVoice.PhraseFinish += new _DirectSREvents_PhraseFinishEventHandler(vcrVoice_PhraseFinish);
           
            }
    
            public void Stop()
            {
                _vcrVoice.Deactivate();
            }
            #endregion 
    
            // ******************************************
            // ***   TELECOMMANDE 
            // ******************************************
            
    
    
            /// <summary>
            /// Gestion de l'action
            /// </summary>
            /// <param name="flags"></param>
            /// <param name="beginhi"></param>
            /// <param name="beginlo"></param>
            /// <param name="endhi"></param>
            /// <param name="endlo"></param>
            /// <param name="Phrase"></param>
            /// <param name="parsed"></param>
            /// <param name="results"></param>
            public void vcrVoice_PhraseFinish(int flags, int beginhi, int beginlo, int endhi, int endlo, String Phrase, String parsed, int results)
            {
                
                switch (Phrase)
                {
                    
                    case "tv down":
                        SendKeys.Send("{DOWN}");
                        break;
                    case "tv up":
                        SendKeys.Send("{UP}");
                        break;
                    case "tv left":
                        SendKeys.Send("{LEFT}");
                        break;
                    case "tv right":
                        SendKeys.Send("{RIGHT}");
                        break;
                    case "tv enter":
                        SendKeys.Send("{ENTER}");
                        break;
                    case "tv back":
                        SendKeys.Send("{ESC}");
                        break;
                }
               
            }
        }
    }

    If anyone find the enormous error, thanks to tell me.
     

    mPod

    Portal Pro
    January 26, 2005
    2,084
    3
    Berlin
    Home Country
    Germany Germany
    Use SendKeys.SendWait.

    But another suggestion: Use the InputMapper in Core/InputDevices/InputHandler.cs. This makes it possible that your commands are user-configurable at the end. See for example the Hauppauge or X10 remotes how this can be used. For the mapping editor, see MediaPortal.Configuration/Sections/Remote.cs.

    This makes your plugin much more flexible at the end.
     

    guilhem

    Portal Member
    April 2, 2006
    23
    0
    44
    France
    mPod said:
    Use SendKeys.SendWait.

    But another suggestion: Use the InputMapper in Core/InputDevices/InputHandler.cs. This makes it possible that your commands are user-configurable at the end. See for example the Hauppauge or X10 remotes how this can be used. For the mapping editor, see MediaPortal.Configuration/Sections/Remote.cs.

    This makes your plugin much more flexible at the end.

    For the SendKeys.SendWait it's better but MP froze later.
    With SendKeys.Send it froze on contextual display init
    With SendKeys.SendWait, you can use the "voice control" 2 or 3 time but it's very slow and at the end it froze.

    So, I'll got to look your others propositions this evening

    Thanks a lot
     

    kwazi

    Portal Member
    May 1, 2006
    6
    0
    Israel
    Voice Remote control vs. Voice User Interface

    Voice Remote Control is a great idea, but it doesn't really improve user experience and gives us a power of "Star Trek" :) isn't it?

    I was just scribing some requirements for new PlugIn, when I ran into this topic. Good VUI (Voice User Interface) can significantly shorten the time and be a great fun. Imagine that you, based on your database, can say something like "Find me all my Jazz music" or play Mozart, or ask "what's the weather in New York tomorrow",
    or "Record all Start Trek movies on Sci-Fi channel today" without even being in the relevant screen. You can set Alarms, check e-mails and zillion other things. So I thought about plugin that will have the following basic functionality:
    1. Hotword support (something that must be said to wake the system up)
    2. Dynamic, template based grammars generation. (Plugin will scan the database and based on the templates will create sets of "commands" that will be understood by the SR engine). Plugin will scan the list of already installed plugins and generate for them commands list. Actually any plugin creator will be able to create template for VUI for his own plugin by himself.
    3. Being template based, plugin will support different languages
    4. Reference implementation of integration with basic MP functionality such as Music, Pictures, Videos, probably Live TV
    5. Free MS Speech Rec engine is .... free and it is the only good word I can say about it. It will not work well in even slightly noisy environment and it's functionality is highly limited. Thus it will probably be much better choice to integrate this plugin with Sphinx http://cmusphinx.sourceforge.net/html/cmusphinx.php. There are several other options.

    Being a veteran in the field of Speech Recognition and VUI, I'm still not familiar with MediaPortal internals. So if this plugin seems interesting to you, ppl, I'll be happy to join forces and develop it
    (Actually, I'll develop it anyway, it just will take longer :wink: )

    Your opinion, gurus ....[/url]
     

    johnbobjamesson

    Portal Pro
    June 17, 2004
    91
    0
    Crailsheim
    I'm definately no guru, but I am very willing to worship thy existence!

    If you could give us that plugin and make us feel like Jean-Luc Picard - I'd pay for it (if I had any money....).

    J
     

    FlipGer

    Retired Team Member
  • Premium Supporter
  • April 27, 2004
    2,658
    115
    48
    Leipzig, Germany
    Home Country
    Germany Germany
    Hi,

    I would love to have this implemented! :)

    I also considered to make such a plugin, but (as always) no time...

    Any progress here?

    Flip.
     

    guilhem

    Portal Member
    April 2, 2006
    23
    0
    44
    France
    Hello

    Thanks for your proposition, i look too Sphinx.

    With the Ms Speech Rec Engine, MP frooze in popup menu so it's not the solution maybe it can work with sphinx.

    I look at this tomorrow .

    th
     

    Users who are viewing this thread

    Top Bottom