Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
Okay, let me explain. So my goal is to find a specific book on a bookshelf model by using the following command sequence:
Me - Find Book
App - What book are you looking for?
Me - A Tale of Two Cities
Once I speak the title of the book, I want whatever JavaScript to convert that phrase to text so I can find the book. Only problem is, I have no Idea how to do that. I'm also using ThingWorx to hold a list of book data for me to port over to display to the user. As far as topics go, I realize how broad this is and I apologize for the ambiguity. Let me know if further clarification is needed.
Hi @rrzink91 ,
so far I know, currently we can use only commands defined as voice commands/with voice alias.
for example, here the commands "test" and "foo" will executed some code defined in the Home.js
Possibly you can define some command "atoms" where you can combine them to get a more complex message / to recognize it as spoken text
example: "book two open start " where in this example the voice commands are “book”, “two”, “open” and “start” are different commands. In this case “book”, “two” and “open” will write setting of some variables to the program stack and then when “start” is called it will start the main procedure which will check the current program stack e.g. what was called before to execute the desired action. You can also define some commands to reset the current program stack or start a new command sequence
There is an API "Using the Web Speech API" which I tested and it work fine in a preview mode / inside chrome but unfortunately it does not work on the HoloLens device.
Also another points is that according to PTC article "Article - CS300379" currently for the voice command only English is supported.
I tested and it seems that the spoken text as output from device is working fine. Some code like this
$scope.app.foo= function() {$scope.app.speak("foo was called here");}
//==============
$scope.app.speak = function (msg_txt)
{
console.log("speak :: "+ msg_txt);
// $scope.app.speech.synthesizeSpeech(textSpeech[i]);}
if(twx.app.isPreview() == true){
var msg = new SpeechSynthesisUtterance(msg_txt);
speechSynthesis.speak(msg)
} else { //HoloLens
$scope.app.speech.synthesizeSpeech({'text':msg_txt});
}
}
///////////////////////////
Here the funciton foo could be called from the voice command define in UI: