Author Topic: Navigation in text-to-speach text  (Read 886 times)

Mcclient150

  • Newbie
  • *
  • Posts: 4
Navigation in text-to-speach text
« on: January 24, 2021, 04:28:14 AM »
Hi all,

may I ask a question: I would like to have a Text-to-speach text red by VA. At the beginning, there is a table of content in the text. Is is possible to stop VA reading the text after the TOC and waiting for a spoken input, which states one chapter of the TOC to jump to and continue at that subchapter the text-to-speach text. It’s a kind of navigation by voice through a text-to-speach text. Can this be done with tokens?

Or is it possible to jump to a position inside a text-to-speach text, which is marked by a token?

Thank you.
« Last Edit: January 24, 2021, 06:01:33 AM by Mcclient150 »

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Navigation in text-to-speach text
« Reply #1 on: January 24, 2021, 09:23:15 AM »
Tokens only retrieve information, they do not actively affect the execution of a command by themselves.

If the text you're having read is static, you could split the different chapters into separate "Say Something with Text-To-Speech" action, each having the "Wait until speech completes before continuing command" option enabled, so they'd be read sequentially, and preceded by an "Add a Jump Marker" action with the marker name set to the chapter name.

At the top, you'd want to have your index read out, followed by a "Wait For Spoken Response" action that listens for a chapter name, after which you can use a "Jump to a Marker" action to jump to said chapter.

If you want to add the option to read just one chapter, you could set a variable (text would be simplest, as the "Wait For Spoken Response" action can set that directly), and then insert a condition after each chapter that stops the command if said variable has a given value.

E.G.
Code: [Select]
Say, 'Chapter index: chapter 1, chapter 2, chapter 3'
Wait for spoken response: 'chapter 1;chapter 2;chapter 3'
Say, 'continue reading after this chapter?'
Wait for spoken response: 'yes please;no thanks'
Jump to Marker: {TXT:~chosenChapter}

Marker: chapter 1
Say, 'This is chapter 1, when it is finished, reading will proceed to chapter 2, provided you spoke "yes please" at the start'  (and wait until it completes)
Begin Text Compare : [~keepReading] Does Not Contain 'yes'
End Condition - Exit when condition met

Marker: chapter 2
Say, 'This is chapter 2, when it is finished, reading will proceed to chapter 3, provided you spoke "yes please" at the start'  (and wait until it completes)
Begin Text Compare : [~keepReading] Does Not Contain 'yes'
End Condition - Exit when condition met

Marker: chapter 3
Say, 'This is chapter 3, when it is finished, reading will stop, as it is the last chapter.'  (and wait until it completes)
Begin Text Compare : [~keepReading] Does Not Contain 'yes'
End Condition - Exit when condition met

"yes please" and "no thanks" are not for politeness; generally longer phrases are more accurately recognized. If you want to change that to something else, just make sure to also modify the conditions further along in the command (assuming your affirmative answer does not contain "yes").

The "Say Something with Text-To-Speech" actions for the chapter index and continuing reading do not have the "Wait until speech completes before continuing command" option enabled, so you don't have to wait through the entire index if you already know which chapter you want, and can speak that name immediately after it begins reading the index.
Do make sure that the "This completes all other currently-playing text-to-speech" option for the "Say Something with Text-To-Speech" actions is enabled as well, at the very least for the second one in the command (but having it enabled for all of them is fine)

The empty lines are blank "Add a Comment to the Action List" actions, which can help visually separate difference sets of actions within a command (they have no noticeable effect on command execution).

If you want a pause, either between speaking the initial chapter and continue options and when the normal reading starts, and/or between the chapters themselves, you can of course add literal pause actions between those.



If on the other hand the text you're having read is dynamic (E.G. from a text file), that'd be more involved.

Mcclient150

  • Newbie
  • *
  • Posts: 4
Re: Navigation in text-to-speach text
« Reply #2 on: January 24, 2021, 09:39:12 AM »
Hi Pfeil,

Thank you for your quick answer, I will try.

Have a nice Sunday,

Andreas

Mcclient150

  • Newbie
  • *
  • Posts: 4
Re: Navigation in text-to-speach text
« Reply #3 on: January 24, 2021, 11:44:48 AM »
Hi Pfeil,

do you see the mistake? The ChosenChapter-TXT-Variable does not recognize the second word 'Culture', the first one 'System' is working fine.

Say, 'System, Culture'
Wait for spoken response: 'System; Culture'
Jump to Marker: {TXT:ChosenChapter}

Marker: Culture
Say, 'Culture chosen'
Exit Command

Marker: System
Say, 'System chosen'
Exit Command

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Navigation in text-to-speach text
« Reply #4 on: January 24, 2021, 11:54:26 AM »
You have a space in there. The options you have defined are "System" and " Culture", so the latter does not match the spoken phrase "culture"

Code: [Select]
Wait for spoken response: 'System;Culture'should work.

Mcclient150

  • Newbie
  • *
  • Posts: 4
Re: Navigation in text-to-speach text
« Reply #5 on: January 24, 2021, 12:00:46 PM »
YOU ARE GREAT, that's it!!!

Thank You :)