The tnum instruction speaks a number with natural speech.
Synopsis
tnum(type.src{[, 'inflection'],[type.style]})
Description
The tnum instruction accepts the numeric value specified by the first argument, translates it into a string of phrases, and puts it in a queue for speaking. The second argument, when specified, controls the speech inflection. The optional type.style argument specifies the coding style.
The tnum instruction does not support speaking numbers in the billions and trillions because most of these numbers are too big to fit into an integer variable. However, the phrases billion and trillion are included in the Enhanced Basic Speech package. If your script requires such large numbers, we suggest that you start with an ASCII string, parse the string (getting the amounts of billions and trillions as substrings), then convert the three resulting substrings to integer values and speak them with the tnum instruction. Insert a talk instruction with the phrase for trillion or billion, where appropriate.
Example
In the following example, the program says it could not understand the caller. Then the system pauses for 500 milliseconds of silence, and asks if the number is the n-digit number that is stored in r.1 or the number six-hundred-fourteen. The tnum instruction says the number to the caller in natural-sounding speech.
The atoi conversion instruction is needed since the getinput instruction returns information as a null terminated character string, but the tnum instruction uses integers.
The tnum instruction is used when it is desired to hear the words hundred, thousand, thirty, etc. in the response. The tchars instruction differs from tnum by only speaking the numbers individually.
GET_ID:
getinput(ch.DG,9)
atoi(r.1,ch.DG)
.............. ...............................
talk("i could not understand you","sil.500","did you say")
tnum(r.1)
talk("or")
tnum(614)
.............. ...............................