This tutorial will provide you with everything you need to install, build and run a sample project.
The sample simple-application will be used during this tutorial, but the workflow stays the same for all sample projects.
It consists of two parts:
Some voice recognition to be able to detect some sentences,
Some voice synthesis to be able to get audio feedback upon recognition.
In order to compile the project, you will need to install the C++ dependency manager called Conan. You can relate to the dedicated guide on this topic for more detailed steps: Compiling C++ samples with Conan
Once you have your environment set up with Conan, just follow those simple steps to build your sample executable:
cd simple-application conan install -if build/Release . -o asr_engine=vasr -o tts_engine=csdk conan build -if build/Release .
Android samples are pre-packaged with the required libraries.
Skip this step and go to the Usage section.
Configuration & Data
Before running the sample, you must generate its configuration and install the data needed by the engines you selected during the install step.
Open the project inside the VDK Studio by double-clicking the
project.vdk file (Windows) or using the
Import Project menu in the Home screen.
On the left side-bar, you will find cards for Voice Recognition, Voice Synthesis, or both categories depending on the sample being tested. Click on them to open the corresponding widget, edit their properties to match the engine providers you’ve used during the Conan install phase prior, and compile the grammar or save the voice list configuration.
Once the grammar has been compiled, and/or the voice list has been saved, you can install the data into the project. On the bottom of the project side-bar, click the
Export Project button.
Select the root directory of the sample project as the export location and your target platform (leave default to test on the current machine).
Note: If you are using the same operating system as the target one, you can also use the
Install Resources button which will save you the choice of project path and current architecture.
Make sure that you have both directories
data in your project directory before proceeding to the next step.
You can run your application with the following command:
cmd /c "build\generators\conanrun.bat && build\Release\simple-application.exe"
//c instead if executing this command from a Git Bash instance!
conanrun.bat script is only needed when starting the program from the build tree, its purpose is to add the dependencies' DLL to the PATH before attempting to run the program.
Open the sample in Android Studio and run the application.
Once started, you should see some logs in your terminal.
Since this sample project uses voice recognition, you can find the set of possible commands in the grammar file under the
grammars folder in the project root.
Grammar files follows the Backus Naur Form (BNF) format, which is further explained in its own article.
In the case of the
simple-application program, you could say things like:
I would like a coffee
I would like an orangina
(Any number like) 42
Once you say a sentence that gets recognized, the application will answer you with a sentence such as: “You just said <number> right?” or “Gotcha, you want a <drink>, I knew it.”