How do I speak a negative number in math app answer?

0 favourites
  • 3 posts
From the Asset Store
The internet is bombarded daily with new apps (app is the short term for application)
  • The user chooses numbers and operators, and the answer can be spoken. Everything works, but I can't understand how to account for negative answers. Basically when answer.text is less than zero, it should speak "Negative" before the answer, but otherwise follow the rule you see here, which is working fine. Many thanks for any help.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • If the speech synthesis doesn't read numbers properly, you'll just need to parse your number into a string the way you want it to be read.

    For example, you'll want to change/replace "-2934.234" with "negative 2934 point 2 3 4", and apply speech synthesis on the new "readable" string.

  • Be aware that the speech synthesis depends on the voice that is being used and so the voice that is "coded" within your browser, which is not the same in various languages.

    In French for example, the voice reads negative numbers without issue as far as my test go.

    As far as my test go with English as well, the voice does speak a "negative" for a negative result.

    Nevertheless, you are making it speak the text of a text object, so in the end, all depend on what that text is.

    If you have modified it in any way that would make it NOT a number, that might be the reason you are getting issues.

    At any rate, consider the system expressions str() and float() to cast some number into text (string) and some text (string) into a number. That might help out with your issue.

    Consider posting your complete project as well, the issue might be somewhere else rather than where you think it is.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)