Software Archive
Read-only legacy content
17061 Discussions

Voice recognition

Дмитрий_К_
656 Views

Hello,

I work with VoiceRecognition in RealSense Sdk. When I ran voice recognition sample from Visual Studio and after

sts=sr.StartRec(source, handler);

sts was pxcmStatus.PXCM_STATUS_PARAM_UNSUPPORTED
I don't know what does it mean. How can I run it program for example?

 

0 Kudos
4 Replies
Tomasz_B_Intel
Employee
656 Views

Hello,

demo app is working fine for me. Have you tried to change source?

It`s hard to say what may be wrong from manual...

PXC_STATUS_PARAM_UNSUPPORTED : There are invalid/unsupported parameters in the configuration.

   

 

Tomek

 

0 Kudos
Дмитрий_К_
656 Views

I have created new console application from scratch and it is work fine. May be useful for someone.

 class Program
    {
        private static List<PXCMAudioSource.DeviceInfo> devices = new List<PXCMAudioSource.DeviceInfo>();
        static void Main(string[] args)
        {
            PXCMSession session = PXCMSession.CreateInstance();
            Console.WriteLine("SDK Version {0}.{1}", session.QueryVersion().major, session.QueryVersion().minor);
            PXCMSpeechRecognition sr;
            pxcmStatus status = session.CreateImpl<PXCMSpeechRecognition>(out sr);
            Console.WriteLine("STATUS : " + status);
            PXCMSpeechRecognition.ProfileInfo pinfo;
            sr.QueryProfile(0, out pinfo);
            sr.SetProfile(pinfo);

            String[] cmds = new String[3] { "One", "Two", "Three" };
            // Build the grammar.
            sr.BuildGrammarFromStringList(1, cmds, null);
            // Set the active grammar.
            sr.SetGrammar(1);

            //sr.SetDictation();
            PXCMAudioSource source;

            source = session.CreateAudioSource();
            source.ScanDevices();

            for (int i = 0; ; i++)
            {
                PXCMAudioSource.DeviceInfo dinfo;
                if (source.QueryDeviceInfo(i, out dinfo) < pxcmStatus.PXCM_STATUS_NO_ERROR) break;
                devices.Add(dinfo);
                Console.WriteLine("Device : " + dinfo.name);
            }


            source.SetDevice(GetCheckedSource());
  
            PXCMSpeechRecognition.Handler handler = new PXCMSpeechRecognition.Handler();
            handler.onRecognition = OnRecognition;
            // sr is a PXCMSpeechRecognition instance
            status = sr.StartRec(source, handler);
            Console.WriteLine("AFTER start : " + status);
            while (true)
            {

                System.Threading.Thread.Sleep(5);
            }

            session.Dispose();

      
        }

        public static PXCMAudioSource.DeviceInfo GetCheckedSource()
        {
            Console.WriteLine("SELECTED : " + devices[1].name);
            return devices[1];
        }


        static void OnRecognition(PXCMSpeechRecognition.RecognitionData data) {
            Console.WriteLine("RECOGNIZED sentence : " + data.scores[0].sentence);
            Console.WriteLine("RECOGNIZED tags : " + data.scores[0].tags);
        }
    }

 

0 Kudos
Andradige_S_Intel
656 Views

Дмитрий К.

0 Kudos
Дмитрий_К_
656 Views

I ran this program on windows 8.1. Voice recognition doesn't work on windows 7. But voice synthesis works on both OS.

0 Kudos
Reply