Shop OBEX P1 Docs P2 Docs Learn Events
How to code for the EasyVR board — Parallax Forums

How to code for the EasyVR board

rholchrholch Posts: 2
edited 2014-08-08 13:30 in BASIC Stamp
I recently interfaced an EasyVR speech recognition board to a BS2P40 using AUX I/O.
Test code (attached) was generated by the latest version of EasyVR Commander, slightly modified by me for pin numbers and debugging.
The code properly initializes the board and consistently recognizes the Trigger Word Set 0 word, "robot".
When that word is recognized, the code switches to Trigger Word Set 1 (which includes, "action", "move", etc.) and waits for one of those words.
However, it does not recognize any of them and instead returns an error code 12h, meaning "recognition result doubtful". See the error code table on page 39 of the latest EasyVR User Manual V 3.6.6. The trigger word sets are listed on page 38.

The EasyVR module was tested via its motherboard, USB interfaced to a PC running EasyVR Commander. All words in all four groups were consistently recognized. The test was repeated before and after the module was connected to the target system to eliminate hardware faults as a cause of the problem.

I added additional initialization code to set the knob and level values, making recognition as easy a possible, but to no effect.

If someone has some thoughts/experience with this board on a Basic Stamp and some working code, I would appreciate help to determine what, I presume, I have coded incorrectly.

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-08-05 21:33
    Did the basic demo code work?

    Where could I find a version of the unmodified code?

    I'm used the EasyVR with a Propeller and I think I've even used it with a BS2. If you post the unmodified code, I'll try it out with my EasyVR board.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2014-08-06 09:57
    I'm curious what the raw value is that is being sent back before the math is done to it. Can you point out in the manual where the calculation is you're using for the error code? Here's a link to the manual.

    http://download.tigal.com/veear/EasyVR_2/EasyVR_User_Manual_3.6.6.pdf
  • GenetixGenetix Posts: 1,749
    edited 2014-08-06 19:13
    I notice a few things in this program.

    Put parenthesis around VRCOMMAND - ARG_ACK in your SELECT statements.

    Also delete VRA1 = VRA1 - ARG_ZERO from these routines:
    VR_SetLanguage
    VR_SetTimeout
    VR_SetKnob
    VR_SetLevel
    These commands only return "o" for success, so this line isn't needed.

    Also, your WakeUp routine sends the command Break.
    It says after power-up that you only need to a send a character (anything) to wake it up and that it should return a "w" showing that's it's woken up.

    How much of this code did you modify because it's "spaghetti" code with all the GOTO's?

    You are also using different pins than the setup shows.

    I see your problem:
    You main loop calls VR_RecognizeSD, which only allows a 0 for Trigger words.
    You need to call VR_RecognizeSI which will allow to you to use the different word groups.

    SD stands for Speaker Dependent which means you need to teach it every word you want to recognize.
    SI is Speaker Independent which mean it has already for been programmed for a wide range of speakers including people with accents.
  • rholchrholch Posts: 2
    edited 2014-08-07 15:24
    Thanks to Duane, Chris and Genetix for your observations and comments!

    -- The unmodified code, attached, is automatically generated by clicking on Generate under the File tab in the EasyVR Commander program. The code generated is CPU-specific as selected by the format option in the file write. One can select code for Arduino and various Stamps. In this case, I selected bs2. (One can only generate code if the EasyVR carrier board is attached to the PC.)

    -- The calculation for the error code is covered under STS_ERROR on page 30 of the manual.

    -- The SELECT statement, in this case, works the same with or without the noted parentheses.

    -- VRA1 = VRA1 - ARG_ZERO is correct as-is and is in the original code. This is because the board returns characters, so subtracting "A" provides the correct decimal value subsequently tested for which error occurred, if one wanted to add that.

    -- The wakeup command is as in the original code, although anything would work.

    -- All the GOTOs? There is only one, and, as you can see, it is in the original vendor code. A rare GOTO does not make a whole program "spaghetti".

    -- The change to pins was due to my use of AUXIO pins instead of MAIN. This works fine.

    -- Genetix noticed the real problem -- the original program called VR_RecognizeSD instead of ..SI. One would think they would use SI as an initial test because there may not be any speaker-dependent words programmed when first tested. I think the documentation is a bit confusing as to what groups are recognizable for each command.
    In any case, I modified the code as also attached, also adding additional SELECTS to demonstrate functionality through three levels of commands, ie., it recognizes "robot" then "move" then "right". It also seems to do the right things for all of the built-in SI words as well as timeouts and other error conditions.
    It will return the STS_ERROR code if operated in the ...SD mode and the word is not "robot". I presume that is the correct response in that condition.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-08-07 18:34
    rholch wrote: »
    -- Genetix noticed the real problem -- the original program called VR_RecognizeSD instead of ..SI. One would think they would use SI as an initial test because there may not be any speaker-dependent words programmed when first tested. I think the documentation is a bit confusing as to what groups are recognizable for each command.

    I agree. It does seem strange the code would automatically assume SD words were intended instead of the SI words. Good catch Genetix.

    So is your EasyVR working correctly? I hope you stick around and show us what you're making.
  • GenetixGenetix Posts: 1,749
    edited 2014-08-08 13:30
    Duane, I knew about SD and SI from a college project where I wanted to add voice recognition.
    I just read the manual and looked at what each line of code did. I noticed though that the BS2 had only 1 page but the Arduino had dozens.
    The BS2 code definitely needs more commenting and it could be written better.
Sign In or Register to comment.