Author Topic: Dictation Read Back  (Read 2115 times)

twells5

  • Guest
Dictation Read Back
« on: February 01, 2019, 08:23:21 AM »
I can put a coordinate into the dictation buffer and read it back when I say a command...but it reads back the coordinate as one very large number....I would like to to say each digit of the coordinate with a pause in between so that I can enter it into a control panel.  I am in vr so I cannot just make a note of the coordinate and read it....I need it verbally announced to me.  So is it possible to either add pauses into the dictation buffer (verbally is ok too...) and then upon saying it,  have a pause between each digit?  Or any other method to accomplish this?
Thank you
tim

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Dictation Read Back
« Reply #1 on: February 01, 2019, 04:14:21 PM »
How are these coordinates formatted? Do they include non-numeric characters?

If not, you can have the TTS engine do this for you using SSML:
Code: [Select]
<speak version="1.0" xml:lang="en-US">
       <say-as interpret-as="characters">{DICTATION}</say-as>
</speak>
Make sure you check the "Use Speech Synthesis Markup Language (SSML)" option of the "Say Something with Text-To-Speech" action.

More information on this SSML tag can be found here.



If your dictation string contains a mix of alphanumeric characters, try this(C#) inline function:
Code: [Select]
using System.Text;

public class VAInline
{
public void main()
{
string input = VA.ParseTokens("{DICTATION}");

StringBuilder s = new StringBuilder();

foreach (char c in input)
{
s.Append(c);
if (char.IsDigit(c))
{
s.Append(" ");
}
}

VA.SetText("output", s.ToString().Trim())
}
}
It'll take the dictation buffer and append a space to each numeric character.

You can use the result in a TTS action by using the {TXT:} token to get the value of "output".

twells5

  • Guest
Re: Dictation Read Back
« Reply #2 on: February 02, 2019, 09:17:51 AM »
Pfeil, First, Thank you for the quick reply...this looks very promising.  I am just learning  to do VA coding...more of a C++ coder...complete VA nubie... (and C#).

 Ideally, the spoken coordinate string is alph-numeric and will always be something like: N12345678E12345678....Northerly and Easterly coords...its for DcsWorld.  So far I just tried a strictly numeric example...thats where I got the giant number read back to me....once i closed the map...a small step in the right direction.

So the second suggestion of yours seems like the way to go....being able to set up a buffer and parse through it, speaking out each char one at a time would work fine I think.  So I will try that but I have a question for you...I've done nothing ever with C#...so to use an inline C# method, do I need to get a C# compiler or something...or does the VA engine understand C# syntax and just handles it?  And if I do need a compiler...can you suggest one...preferably open source?

 Thank you very much again,
tim

 

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Dictation Read Back
« Reply #3 on: February 02, 2019, 03:35:11 PM »
VoiceAttack can compile C#.

You can add an inline function action("Other >", "Advanced", "Execute an Inline Function", "C# Code") and replace the default template with the second code block I posted. Make sure to check the "Wait for the inline function to finish before continuing" option(otherwise the function is executed asynchronously, and if the TTS action runs before the variable is set, it'll just speak "Not Set"; I.E. a race condition may occur).

If you want more delay between digits, try ", "(a comma and a space character) instead of just a space.

You can also combine this with SSML for more granular control over TTS(tokens are essentially functions, and once they're parsed they are replaced by the output of their execution, so they can be used wherever literal text would be, in fields that parse them).
« Last Edit: February 12, 2019, 09:03:45 AM by Pfeil »

twells5

  • Guest
Re: Dictation Read Back
« Reply #4 on: February 02, 2019, 04:10:32 PM »
Wow, that's opens up a lot of possibilities...like maybe not even needing the readback and just entering directly into the jet ufc  by parsing the string after speaking the coordinates read on the map...that would be really awesome...I've got to get to work.
Thank you,
tim

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: Dictation Read Back
« Reply #5 on: February 12, 2019, 08:37:31 AM »
There is a forum folder dedicated to various inline functions and their discussion. That's a great place to start for both reading through C# and learning the basics and nuances of VA's inline functions.