Skip to main content
1-Visitor
August 22, 2023
Solved

Using currentStep to Narrate an Animation with Text-to-Speech

  • August 22, 2023
  • 1 reply
  • 1140 views

Hi,

I don't have much experience with Vuforia Studio or javascript. I am trying to narrate each step in an animation with text-to-speech. I have the desired narration script in an array and I wanted to use the currentStep variable to step through the narration array. I am unable to get the currentStep variable to register. I have used the console log to monitor the state of the currentStep but the state never changes even while the animation is playing.  

 

I am using Vuforia Studio 9.11.4.0

 

 

 

Best answer by sgreywilson

 

 

playAudio = function() {
 var audio = new Audio('app/resources/Uploaded/Flying.wav');
 audio.play();
};
$scope.$on('stepstarted', function(event, targetID, unused_targetType, data) {
// Check to make sure this event applies to the correct model.
// since angular events are broadcast from the root scope we may get events pertaining to other twx-dt-models.

var stepInfo = JSON.parse(data);
console.log("stepNumber "+stepInfo.stepNumber);
console.log("stepName "+stepInfo.stepName);
console.log("totalSteps "+stepInfo.totalSteps);
console.log("nextStep "+stepInfo.nextStep);

playAudio();



});

1 reply

16-Pearl
August 22, 2023

 

 

playAudio = function() {
 var audio = new Audio('app/resources/Uploaded/Flying.wav');
 audio.play();
};
$scope.$on('stepstarted', function(event, targetID, unused_targetType, data) {
// Check to make sure this event applies to the correct model.
// since angular events are broadcast from the root scope we may get events pertaining to other twx-dt-models.

var stepInfo = JSON.parse(data);
console.log("stepNumber "+stepInfo.stepNumber);
console.log("stepName "+stepInfo.stepName);
console.log("totalSteps "+stepInfo.totalSteps);
console.log("nextStep "+stepInfo.nextStep);

playAudio();



});