cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Work instruction Speech and Step Number to be adjusted

agangaiah
14-Alexandrite

Work instruction Speech and Step Number to be adjusted

Hello,

 

I am using the below script to hear work instruction( on IoS Device ) created in Illustrate as well as show it up on a 3d label.

 

var labelId = "3DLabel-1";
$scope.$on('newStep', function(evt, arg)
{
$scope.setWidgetProp( labelId, "text", arg);
var msg = new SpeechSynthesisUtterance(arg)
window.speechSynthesis.speak(msg);
});

 

But I am facing two challenges here:

 

1. Even before the 3DLabel is made visible, the the first step of the work instruction( Illustrate Sequence Name ) is said out loud as soon as the experience is loaded,  which is not needed, even though the rest of the sequence comes up only after I click the button.

 

2.  Also it pronounces the steps numbers as well (eg., 1/11 Step1, 2/11 Step 2 .,.) I would like to avoid it saying 1/11 or 2/11 step numbers.

 

Any suggestions?

 

Thanks,

Avinash

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi Avinash,

 

For point 1, I think you should look at how you load the experience.  Have you used a button or some other mechanism of launching the java function?

 

For point 2, refer to this thread: https://community.ptc.com/t5/ThingWorx-Studio/Can-Cortana-speak-the-work-instructions-that-you-have-created/m-p/502803#M105.

 

I've used the method originally outlined here to build my version of this.  I split it into 2 functions so I could choose whether or not the experience speaks as well as shows the text and I used 2 labels just to help me visualise/troubleshoot.  Label-1 isn't visible in the final experience.

 

var labelId = "label-1"; 
$scope.$on('newStep', function(evt, arg) {

$scope.setWidgetProp( labelId, "text", arg); // get the currentStep from the arg
var labelText = $scope.view.wdg['label-1'].text;
var InstructText = labelText.substr(labelText.indexOf(")") + 1);
$scope.setWidgetProp( "label-2", "text", InstructText);
});

 

$scope.speak = function(){
var spokenText = $scope.view.wdg["label-2"].text;
var msg = new SpeechSynthesisUtterance(spokenText);
window.speechSynthesis.speak(msg);
}

 

Hope this helps.

 

Allan

View solution in original post

7 REPLIES 7

Hi Avinash,

 

For point 1, I think you should look at how you load the experience.  Have you used a button or some other mechanism of launching the java function?

 

For point 2, refer to this thread: https://community.ptc.com/t5/ThingWorx-Studio/Can-Cortana-speak-the-work-instructions-that-you-have-created/m-p/502803#M105.

 

I've used the method originally outlined here to build my version of this.  I split it into 2 functions so I could choose whether or not the experience speaks as well as shows the text and I used 2 labels just to help me visualise/troubleshoot.  Label-1 isn't visible in the final experience.

 

var labelId = "label-1"; 
$scope.$on('newStep', function(evt, arg) {

$scope.setWidgetProp( labelId, "text", arg); // get the currentStep from the arg
var labelText = $scope.view.wdg['label-1'].text;
var InstructText = labelText.substr(labelText.indexOf(")") + 1);
$scope.setWidgetProp( "label-2", "text", InstructText);
});

 

$scope.speak = function(){
var spokenText = $scope.view.wdg["label-2"].text;
var msg = new SpeechSynthesisUtterance(spokenText);
window.speechSynthesis.speak(msg);
}

 

Hope this helps.

 

Allan

agangaiah
14-Alexandrite
(To:AllanThompson)

Thanks Allan.

 

This works well when i try to play the sequence with a step by step procedure on every button click, but somehow it does not play well if I choose the button that triggers " Play All " Option.

 

Thanks,

Avinash

I"m not sure about using the Play All option.  When I create sequences, I only ever use the Play option as I want the end users to be able to follow through step-by-step.

 

Maybe you need to build the java to get the step info and read it out into a higher level function as I image that when you are using Play All these values will be continually changing as it moves through all the steps and you'll need something to trigger the reading.  Something else that could cause problems would be if it takes longer to read out the instructions than it does to play the step.

but this procedure works only on the preview, once published at least on Android I can not hear the synthesized voice, and 'a lack of Android?

Sorry, not sure on the Android.  I've only got iOS devices and a HoloLens

Perfect , i have to try on the Hololens .THNX

 

Hi, 

 

Could you please guide me how to display work instructions step wise in the experience.

 

I have created steps in illustrate with notes/work instructions. I am able to play the sequence /animation in AR experience. However, I need ability to show each step along with its work instruction as 3D label?? Along with display on screen, I need voice. (Similar to the functionality of PDF "View > Read Out Loud"

 

Could you please help me with this.

 

Thank You

Ravi A

Top Tags