Author Topic: Say numbers  (Read 1603 times)

Tripwire

  • Guest
Say numbers
« on: May 22, 2019, 03:41:45 AM »
Me again - thanks again for all the assistance so far - I'm getting the hang of a lot the various commands and my Elite profile is coming along nicely. I've hit another snag which I just can't seem to get right.

The VA plug in pulls across the following from EDDI : {DEC:EDDI commander continued credits} but when I use this in a TTS scenario it just reads the numbers like 3,2,1 how do I get it to say the number as Three hundred and twenty one ?

Thanks again for all the help.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Say numbers
« Reply #1 on: May 22, 2019, 06:12:04 AM »
You can use SSML to specify how it should be read:
Code: [Select]
<speak version="1.0" xml:lang="en-US">
       <say-as interpret-as="cardinal">{DEC:EDDI commander continued credits}</say-as>
</speak>
Make sure to check the "Use Speech Synthesis Markup Language (SSML)" option.

More information on this SSML tag can be found here.
« Last Edit: May 23, 2019, 02:33:36 AM by Pfeil »

Tripwire

  • Guest
Re: Say numbers
« Reply #2 on: May 22, 2019, 04:44:02 PM »
Thank you ! There was no way in hell I would have ever worked that out !!

Tripwire

  • Guest
Re: Say numbers
« Reply #3 on: May 23, 2019, 02:04:25 AM »
I seem to have found a far easier solution using Convert a Variable Value

Convert decimal [{DEC:EDDI commander continued credits}] to integer [creditsheld]
Say, '{INTFORMAT:creditsheld}'

Works like a charm :)

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Say numbers
« Reply #4 on: May 23, 2019, 02:32:51 AM »
On my machine, the default TTS voices will only pronounce numbers up to 999999 (nine-hundred-thousand-nine-hundred-ninety-nine), and will speak digits above that, which the SSML snippet remedies (up to 999999999999999; Though I assume getting to nine-hundred trillion credits presents other challenges).

I will say it should be "cardinal", not "ordinal", which also explains why it didn't work with fractions.

Tripwire

  • Guest
Re: Say numbers
« Reply #5 on: May 23, 2019, 03:06:15 AM »
Not sure why, but using that code I put in it is currently reading 134,586,209,113 (the number of credits assigned to that variable currently) correctly without using SSML on a default windows TTS voice.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4759
  • RTFM
Re: Say numbers
« Reply #6 on: May 23, 2019, 07:39:36 AM »
That's because the thousand separators also make the TTS speak it as a number; Those are added because you're using the "{INTFORMAT:}" token.

That'll work. Simpler than using SSML.