Difference between revisions of "Speech Editor"
m (→String Variables with the word to say or the code for the word)
|Line 198:||Line 198:|
120 CALL SAY("I","","AM","","A","","COMPUTER")
120 CALL SAY("I","","AM","","A","","COMPUTER")
Latest revision as of 17:54, 11 November 2020
Initially the manual for Speech Editor referenced the flip up lid on the Speech Synthesiser and the ability to extend the built in vocabulary with mini-modules, but these were never released and whilst the flip up cover remained, the tiny module socket in the synthesiser was not seen.
The Speech Editor gave two options- to type into a specific screen the words in the built in vocabulary for the computer to say, and the ability to use the built in vocabulary in TI Basic programs using CALL SAY.
The following paragraphs have been taken from the Speech Editor manual - many of the uses were carried over to Extended BASIC.
- 1 Speech Pauses
- 2 Missing a space between words?
- 3 Using preconstructed phrases
- 4 Numbers
- 5 Homonymns (different spelling, same pronunciation)
- 6 Homographs (same spelling differing pronunciations)
- 7 New words from the built in list
- 8 Using Speech with TI BASIC
Punctuation marks and several other symbols listed in the table below are called separator characters. Separator characters serve a dual purpose in the Speech Editor Command Module. They are used to indicate the end of a word, phrase, or sentence.
Each time the computer encounters a separator character, it checks the preceding word against the vocabulary. Also, these symbols specify the length of time the computer pauses between words. You can use these separator characters to give synthesized speech the cadence of natural conversation.
The speech separator characters and the time pauses they represent are:
Speech separator characters Symbol Pause (seconds) + 0 space .1 - .2 , .3 ; .5 : .8 . 1.0
Missing a space between words?
Type the words ITHINK without including a separator symbol, and press ENTER. Instead of hearing the computer say "I THINK", the letters "ITHINK" appear and flash at the bottom of the screen, indicating that no such word is in the vocabulary.
Using preconstructed phrases
Some frequently used combinations of words are stored as single phrases in the Speech Synthesizer. These include phrases such as I WIN, TRY AGAIN, and TEXAS INSTRUMENTS.
To designate the use of a phrase from the Speech Synthesizer vocabulary, place the number sign (#) at the beginning and end of the phrase. Try typing I AM A #TEXAS INSTRUMENTS# COMPUTER. Then, press ENTER.
The Speech Synthesizer unit recognizes the names of whole numbers from 0 through 999 and the digits 0 through 9. Try entering numbers in both ways.
The computer recognizes the plus sign (+) for positive numbers and the minus sign (-) for negative numbers. If you type a sign before a number, the computer says the word "positive" or "negative" before reciting the number.
You can also type fractions in decimal form. A period typed between numerals is considered a decimal point. Type 12.34 and press ENTER. The computer says "one-two-point-three-four".
Homonymns (different spelling, same pronunciation)
Many words in the English language are pronounced similarly but spelled differently (homonyms). An example of homonyms is TO, TWO, TOO, and 2. The Speech Synthesizer recognizes these different ways of spelling words that sound the same.
Homographs (same spelling differing pronunciations)
Homographs pose a different problem. Since both spellings are identical, the computer can't tell which pronunciation is wanted. To differentiate between two pronunciations a number is placed immediately after one of the homographs.
For example, READ is pronounced "read" like reed. READ1 is pronounced "red" like the color red.
Check the vocabulary list for the designations for these and other homographs.
To hear the different pronunciations, try the following example:
THE THE1 A A1 READ READ1
New words from the built in list
Even though THEREFORE is not in the vocabulary, you can form it by using words that are in the vocabulary list. THERE and FOUR are a part of the vocabulary and can be connected with the plus sign (+) to form a word that sounds like THEREFORE.
The plus sign connects words without a pause between them and thus creates the desired effect. Use the constructed word THERE + FOUR.
Using Speech with TI BASIC
The Speech Editor Command Module contains two subprograms that enable you to include speech in TI Basic programs. These two subprograms are labeled CALL SAY and CALL SPGET. CALL SAY instructs the computer to speak the word or phrase you type. CALL SPGET assigns the speech code for a word you designate to a string variable.
You can apply this string variable in a variety of ways, including using it immediately with CALL SAY, or viewing the speech code patterns.
Both subprograms can be used in either the Immediate Mode or in TI Basic programs. The Speech Editor Command Module must be plugged into the console, and the Speech Synthesizer must be attached to the computer. If not, the program stops, and an error message is displayed.
Using CALL SAY
CALL SAY("HELLO, I LIKE YOU.")
The words you want the computer to speak are enclosed in parentheses and quotation marks.
If you type in a word or phrase that isn't in the resident vocabulary, the computer says "UHOH".
The following program uses CALL SAY to give verbal prompts when it's time to enter certain information. Enter the program and RUN it to see how the verbal prompts and on-screen messages can work together.
NEW 100 CALL CLEAR 110 PRINT "TYPE A NUMBER." 120 CALL SAY("TYPE A NUMBER.") 130 INPUT FIRST 140 PRINT "ONE MORE TIME." 150 CALL SAY("ONE MORE TIME.") 160 INPUT SECOND 170 LET SUM=FIRST+SECOND 180 CALL SAY("HERE IS THE SUM") 190 PRINT "THE SUM IS"; SUM 200 END RUN
Lines 110 and 120 prompt you, both visually and audibly, to enter your first number. When the program stops at line 130 for your first entry, type a number and press ENTER. Lines 140 and 150 prompt you for the second number. When the program stops at line 160, type in the second entry and press ENTER. At line 170, the computer adds the numbers. Line 180 tells you the sum will be shown, and line 190 prints the answer.
Occasionally, you may want to include the same verbal message several times in a program. For example, the phrase "PLEASE ENTER YOUR GUESS" may be said several times in a game program. You don't have to type the words each time. Instead, you can assign a string variable to the word or phrase, as follows:
NEW 10 A$="PLEASE ENTER YOUR GUESS" 20 CALL SAY(A$)
You can join two or more string variables by using the symbol for concatenation (&). For example:
NEW 10 B$="#YOU WIN#" 20 C$="#I WIN#" 30 D$="ONE POINT" 40 CALL SAY(B$&D$) 50 CALL SAY(C$&D$)
You can also join string variables by placing an empty (or null) string between the string variables. The null string is symbolized by "". Using the null string, you'd type line 40 as
40 CALL SAY(B$,"",D$)
The use of the nul string is also referenced in the paragraph below- it is used to separate string variables representing words in the vocabulary. When you have placed a word code into a variable using CALL SPGET that string variable is used as the 2nd, 4th, 6th variable passed to CALL SAY. See the next paragraph.
Using CALL SPGET
The words and phrases are stored in the Speech Synthesizer unit as unique patterns of code. CALL SPGET actually calls the code pattern for a resident word and assigns it to a string variable. You can then apply this string variable in a variety of ways including using it with CALL SAY in the same program, storing the speech data on a mass-storage device, or viewing the actual speech data.
To assign the speech data for the word "HELLO" to the string variable R$, type
Notice the use of parentheses, quotation marks, and the comma in the above example.
The computer searches for the code for HELLO and assigns that code to the string variable R$.
When you want the computer to speak the word assigned to R$, use the string variable with CALL SAY. The format is
You must include the null string because the CALL SAY statement can utilize two kinds of string expressions.
Why use SPGET
The most straightforward method of including speech in a TI Basic program is with CALL SAY and a word-string. For example,
CALL SAY("HELLO. I AM A COMPUTER.")
However, more natural sounding speech is produced if you first use CALL SPGET to assign the speech code for each word to a string variable, and then use the string variables with CALL SAY to instruct the computer to speak the phrase. To produce the same words as above, you'd type
10 CALL SPGET("HELLO.",A$) 20 CALL SPGET("I",B$) 30 CALL SPGET("AM",C$) 40 CALL SPGET("A",D$) 50 CALL SPGET("COMPUTER",E$) 60 CALL SAY("",A$,"",B$,"",C$,"",D$,"",E$) RUN
Listen for the slight difference in the timing of the phrase when you assign the speech data to variables with CALL SPGET and then use the variables with CALL SAY.
String Variables with the word to say or the code for the word
Using CALL SAY string expressions must be listed in a specified order.
First, CALL SAY makes the computer speak words and phrases as discussed previously.
10 A$ = "HELLO" 20 CALL SAY(A$)
These specified words or phrases are referred to as word-strings.
The second type of string expression is called a direct-string. A direct-string is the speech data assigned to a string variable through the CALL SPGET subprogram.
If you are designating both kinds of string expressions in a CALL SAY statement, you must alternate between word-strings and direct-strings. The format is:
CALL SAY(word-string[,direct-string, word-string. . .] )
The first specified word or phrase (word-string) is all that is required with CALL SAY. Any additional string expressions (direct-strings or word-strings) are optional.
If you use more than the first word-string, you must use the alternating sequence. Here's an example of the format:
CALL SPGET("AM",B$) CALLS SPGET("COMPUTER",C$) CALL SAY("I",B$,"A",C$)
You may also use CALL SAY("I AM A COMPUTER") or
100 B$="AM" 110 C$="COMPUTER" 120 CALL SAY("I","","AM","","A","","COMPUTER")