Classic Computer Magazine Archive ANTIC VOL. 8, NO. 1 / MAY 1989

SUPER DISK BONUS

Covox Coach and Yak-Spell

By Matthew Ratcliff

This month's Super Disk Bonus shows you how to add true digitized speech and sounds to any program you write. The May 1989 Antic Disk brings you a double-feature by Matthew Ratcliff--a stand-alone talking program called Yak-Spell, plus the Cover Coach tutorial that enables you to create your own talking programs with the $49.95 Covox Voice Master Junior.

You can use Yak-Spell even if you don't have the Voice Master Junior. You'll find it on the Side B of this month's Antic Disk as YAKSPELL.BAS, along with the speech and spelling files that it needs.

GETTING STARTED

Just RUN "D:YAKSPELL.BAS" and you'll see a list of available spelling files. Type in the name of the file you want to use. You don't need to type the .SPK extender, Yak-Spell will quiz you--in Matt Ratcliffs own voice.

If you own the Covox Voice Master Junior you can create your own Yak-Spell speech files. Later in this article we'll explain how to do this, using the Yak-Spelll Builder, SPLBLD.BAS, also found on your Antic monthly disk.

Yak-Spell prompts you for the drive where the dictionary files are located (matching speech files are expected to be on the same disk). A directory of all the spelling files is then listed. You only need to type the name of the lesson to study, such as ANIMALS from this month's Antic Disk. The spelling and speech files are loaded into memory, the main screen of the program is displayed and the first word is spoken.

At the top ofthe display is the program title, followed by the name of the lesson now under way. Below this is a line indicating the number of the word to be spelled and the total words in the quiz. At the bottom of the display is a box with information about special keys that Yak-Spell understands.

Press the asterisk key [*] to hear a word spoken again, as often as desired with no penalty. Pressing the [ESCAPE] key will display a series of dashes (-) below the word line, one "blank" for each letter which has not been spelled. If the current problem has multiple words, the spaces will be shown as underline (_) characters. These spaces must be typed in the correct position by pressing the [SPACEBAR]. Near the center of the screen is a question mark (?), wh the actual spelling takes place.

To spell the word, simply type it out. If you are really stumped, pressing the question mark key [SHIFT] [/] will coax the next correct letter out of Yak-Spell. However, this is the same as misspelling the word! Pressing [ESCAPE] to get "blanks assistance" comes with no penalty, but results in a warning at the end of the lesson.

If you make a typing mistake, the "try again" phrase will be spoken and the error logged. For each correct key press, a pleasant "ding" is heard, until the word is completed. If the word was spelled correctly, Yak-Spell will say you are "correct" and move on to the next word.

After all words have been spelled, a percentage score is computed and displayed, along with a letter grade and rating. You are then prompted to quit or practice some more. If you continue, you can study the same lesson again, or select a new one.

Your May 1989 Antic Disk-- featuring the talking double-bonus Yak-Spell and Cover Coach--as well as every type-in program from this issue--will be shipped to you within 24 hours after receiving your order. Just phone Toll-Free to the Antic Disk Desk at (800) 234-7001. The monthly disk is only $5.95 (plus $2 for shipping and handling) on your Visa or MasterCard. Or mail a $5.95 check (plus $2 shipping and handling) to Antic Disk Desk, 544 Second Street, San Francisco, CA 94107.

TALKING SOFTWARE

The Covox Voice Master Junior ($49.95) is a magnificent educational tool. With it, you can add true digitized voice and sounds to any program. Covox Inc. is at 675-D Conger Street, Eugene, OR 97402. (503)342-1271.

This coaching session will help you create your own talking programs. We'll use Yak-Spell as a demonstration. There are two steps in developing talking software. First, you must write a program which uses the Covox software and hardware to create your speech files.

Second, you must write another program to read these speech files and "speak" them to the user. This should be a "stand-alone" program--it should not need any Covox hardware. Any Atari owner should be able to RUN and hear your program.

Covox provides excellent subroutines for controlling the Voice Master Junior. These make it a snap to create speech files. With their PLAY utility, you can easily create your own stand-alone talking programs.

There is one significant limitation with the PLAY utility, however. It always loads speech data files to the same location, 16384 ($4000), right in the middle of BASIC memory. This leaves only five or six kilobytes of main memory for your own program This is too inflexible for any serious talking software.

So for more flexibility I wrote an assembly language USR routine which loads a speech file into a BASIC string. BASIC will manage the string's location in memory, keeping it clear of your program (and giving you one less detail to worry about). Now, you can control the amount of memory allocated for speech data.

For example, Yak-Spell uses a 12,000 byte buffer for speech data. This buffer will hold about 20 words leaving another 20K of RAM for your program. That's about four times more RAM than the original Covox load-and-play utility gives you.

RECORDING SPEECH

You'll need the Covox Voice Master Junior hardware and software to record your own speech files. To write a speech builder program, you must first RUN "D:VM800" from the Voice Master Junior program disk. This installs the VM.800 handler, letting your Atari LEARN, SPEAK, and SSAVE words. For Yak-Spell, I first wrote SPLBLD.BAS, the program that creates the speech files.

Next, load SPLBLD.BAS from this month's disk. SPLBLD.BAS must be RUN with the VM.800 Covox Voice Master handler installed! When RUN, SPLBLD.BAS asks you to plug a joystick into port 1, and to plug the Voice MasterJunior microphone into port 2. It also asks if VM800 has been RUN. Next, SPLBLD.BAS asks you to type in the number of the drive on which the speech files will be saved.

Next, SPLBLD displays a directory of all spelling files. These files have .SPL extenders. Now type in the name of the new spelling file. If the file already exists, it will be replaced with the new one.

Yak-Spell Builder then prompts you to type in the first word in your spelling list. It's best to work from a prepared word list with carefully checked spelling. After each word is entered, you'll be asked to to verify the spelling and correct any mistakes. Now speak the word. Remember, the word must be spoken clearly, distinctly and carefully. You'll see the familiar reverse video plus sign at the top left of the screen. This means that the program is learning the current word.

Yak-Spell Builder will immediately play back the word. If doesn't sound right, pull back on the joystick. Then you can re-record the word. You can do this as many times as necessary to get just the right sound. When you hear a sound you like, press the joystick button to save it, and continue with the next word.

Immediately after the word is learned, Yak-Spell Builder displays the "vocabulary size." This number shows you how much RAM your speech file is using.

The session ends when 20 words have been typed in, or when you press [RETURN] instead of typing a word.

Next, the program will ask you to say "correct" and "try again." Yak-Spell uses these words to tell you if you spelled the word correctly.

Of course, you can get creative and make special sound effects, sing a few notes of a favorite ditty, or execute a Bronx cheer instead of the above phrases.

The spell builder then writes all the words to a disk file, using the name previously specified with an .SPL extender. All the speech data learned by the Voice Master is saved to another file by the same name, but with an .SPK extender. Finally the user is prompted to print a hardcopy list of the words.

Generally it is a good idea to print the list, and let the "student" review it before taking a Yak-Spelling exam No matter how carefully the words are pronounced, something is always lost in the translation from human voice to computerized digital data. Occasionally, foreknowledge of the word is a necessity for understanding what the computer is "saying."

It would be nice to have a separate editor program for updating speech and dictionary files. But if the spell builder had gotten any larger, it just would not run under Atari DOS. When SPLBLD.BAS is loaded and its arrays initialized, there are only 65 bytes of free memory.

A separate editor program could LOAD the speech data and word file, and then let the user correct spelling mistakes, make additions, deletions, or relearn words. It would be a real challenge to provide all that flexibility with only 2K or 3K of BASIC code.

TECHNICAL NOTES

When RUN, Yak-Spell first initializes all its arrays, including TALK$, a 12000 byte speech data buffer. Then a subroutine DIMensions and initializes COVL$ and COVP$ strings, which will contain the load and play assembly language routines, respectively. Lines 1010 through 1250 and the file COVOX.SYS make up a complete "toolkit" for writing talking programs which require no extra hardware or memory-hungry support software to use existing speech data files.

There are several steps to follow to put the Covox Coach tool kit to work. First, initialize all working strings, including the speech buffer string. A 12K buffer can hold about 20 to 25 separate words.

Next, call the subroutine to load the file COVOX.SYS into the COVL$ and COVP$ strings. This begins at line 1130 in YAKSPELL.BAS. (All lines 1010 through 1250 from YAKSPELL.BAS are required.)

After initializing these strings, a speech file may be loaded as follows: TALK$ = "D:FOOD.SPK":REM TALK$ was DIMendioned to 12000 bytes.

ERR = USR(ADR(COVL$), ADR(TALK$), 12000):REM This is the COVox Load USR routine. The assembly language USR routine, above, expects three values:

--The address of the string containing the actual machine language code for the USR routine, ADR(COVL$).

--The address of the speech buffer, ADR(TALK$).

--The total size of the speech buffer,12000.

The speech buffer (TALK$) must contain the filename of the speech file before the USR call. After the USR call is through, an error status code is returned in the variable ERR. If ERR=136 is there, the end of the file was reached before 12000 bytes were loaded. This means the entire speech file fit into the speech buffer, TALK$.

If ERR = 1, the USR routine was able to load 12000 bytes of speech data, but did not reach the end of the file---more data is available to load. In other words, the speech file is bigger than TALK$.) The only problem this causes is that some words may get "chopped off"' when played back.

The formula for calculating memory and total words for a speech file which has just been loaded is:

BASE = PEEK(256) *256
MEM = PEEK(BASE + 256)+ 256*PEEK(BASE + 257)-BASE + 256
TW = PEEK(BASE+259)

These equations, when used immediately after loading a speech file with the USR routine described above, give you three pieces of information:

--BASE is the starting address ofthe Covox speech data. Note that BASE is not necessarily the same address as the buffer string. It will be rounded up to the next page (256 byte boundary address)

--MEM tells you how much RAM you need to hold the entire speech data file.

---TW is the total number of words defined in the data file.

If MEM is larger than the speech buffer, TALK$, then you must increase the string size, then adjust the USR call which loads the file into the string. Altematively, you may re-record the speech file, talking faster to make it fit.

There is no need to worry when the speech file is larger than the string reserved to hold it, since the load routine will not load any more than the amount specified in the USR call.

Use the equation for MEM, above, to find out how much larger the buffer string must be if the error code is a 1 instead of 136.

The Covox play utility requires speech data to begin on a page boundary (an address evenly divisible by 256). The loader places the page number in memory location 256 ($0100). For example, 16384 ($4000) is an address which is evenly divisible by 256 ( 16384/256 = 64 ). In this case, the loader will place a 64 into memory location 256.

Now, use the BASE equation above, instead of "BASE = 16384", as shown in the Covox Voice Master Jr. manual, appendix I. Then all the other sample computations given in pages 2 through 32 of the manual will work properly.

After a speech file has been successfully loaded, the words may be spoken. The USR call is:

A=USR(ADR(COVP$),WORDNO, VOL,SPEED, SCREENMODE)

This USR routine expects five values:

--The address of the string containing the actual machine language code for the USR routine, ADR(COVP$).

--The number of a word previously LEARNed with the assistance of the VM800 software, WORDNO. This may be any value from 0 through 63.

--The amplitude, or volume of the speech, VOL. This may be any value from 0 to 15, and works like BASIC's SOUND command. You'll normally keep this parameter fixed at 15.

--The SPEED of playback, which may be any value from 0 to 4. Normally LEARN mode is done at a speed of 2. For correct sound, the playback speed should match it. Experimentation with the SPEED results in some interesting effects which are of very limited usefulness.

--The SCREENMODE should be 34 to keep the display on during playback, or 0 to turn it off. With the screen off, the speech quality is only slightly better.

SOURCE CODE

The file VMLOAD.MG5 is the MAC/65 assembly language source code for the relocating loader utility. Study of this file, along with the notes in the Voice Master Junior user manual (pages 29-32), will reveal the internal structure of the data files.

The play routine is simply coded as .BYTE statements, taken from the PLAY program provided on the Voice MasterJr. disk. With minor modifications, VMLOAD.M65 may be used in stand-alone assembly language or ACTION! programs.

Employing this new load utility for Covox speech files, Yak-Spell can grow by another 12K of code, even with its 12K speech buffer initialized. With a little study of the Yak-Spell program, you should be able to create some very educational and entertaining verbose software for your Family and friends.

Note: The author wishes to thank Kevin Gevatosky and Brad Stewart of Covox Inc. for their generous, infinitely patient assistance with the Covox Coach project.

Listing 1: YAKSPELL.BAS Download
Listing 2: COVOX.SYS Download
Listing 3: SPLBLD.BAS Download
More files: ANIMALS.SPK Download
BIRDS1.SPK Download
BIRDS2.SPK Download
FLOWERS.SPK Download
FOODS.SPK Download