ZVOICE Part 2

Authors

Publication

Publication Details

Date

Pages

See all articles from CATS v4 n10

Listing 4 shows how a text to speech program can be implemented.

A text string is scanned one word at a time, with “spaces” as separators. If the word is in the vocabulary, then the word is spoken; if not found, phonetic pronunciation of the word, or the phrase “WORD UNKNOWN” is spoken.

New words are easily added by defining them as NUMERIC VARIABLES which are then used as an INDEX into the VOCABULARY.

B$=PHONEME DATA FOR "ZVOICE" 
B=LEN B$
B$(B)=CHRS(CODE B$(B)+128)
$S(END TO END+B)=B$
ZVOICE=END
END=END+B
RETURN

A$ is a one dimension array which contains the vocabulary in phoneme format.

B$ is a new string of phonemes to be added to the vocabulary with the last phoneme identified by adding 128 (set BIT 7).

In this example the text word “ZXVOICE” becomes the name of a numeric variable which is set to END, the pointer to the. end of the vocabulary.

END is updated by adding the length of the new word in B$ to END.

The advantage of this method is natural sounding speech from text, the disadvantage is memory overhead for the vocabulary.

The concept of a new phoneme editor is described here which uses cursors or a joystick to take the tedium out of composing phonetic words.

This method would arrange the phonemes and common sound element combinations in a matrix or logical array on the screen.

The cursor movement would select an element which is provisionally added to the end of a phoneme string and is tested by voicing the whole string including the new element.

If it sounds good, it is added to the string, by pushing N/L (ENTER), and then the next element is selected and tested.

Words are built up and when complete are added to the vocabulary.

Again the text word can be used as the numeric variable index so that the new phoneme string starts at A$(TEXT).

In this way any word can be accessed and spoken with the simple BASIC routine:

RAND TEXT
RAND USR 16514

These routines are just scratching the surface of a comprehensive speech synthesis package.

So Stay Tuned For More

Next time we connect ZVOICE to the telephone, add some AI and start a French/English dictionary.

Listing 3

BUFF	JR BUFF1;		LOAD SP0256 DATA
INIT	JR INIT1;		INIT 8255 IF ANY
LADR	JR LADR1;		FIND LINE ADDR.
BUFF1	LD HL,(+16400); 	TOP OF VAR
	LD DE,05;		SKIP VAR HEADER
	ADD HL,DE;		NOTE BUFF2 INC
	LD DE,(+16434);		ADD OFFSET
	ADD HL,DE;		IN SEED POINTER
BUFF2	INC HL;			NEXT DATA
SBY1	IN A,27;		TEST BIT 7 BUSY
	BIT 7,A;		BEFORE DATA LOAD
	JR Z SBY1;		REPEAT IF BUSY
DATA	LD A,(HL);		GET BUFF DATA
	OUT 17,A;		LOAD SP0256 DATA
STRB	XOR A;			A=0
	OUT 27,A;		STROBE LOW
	CPL;			A=FF
	OUT 27,A;		STROBE HIGH
LAST	LD A,(HL);		GET BUFF DATA
	BIT 7,A;		WAS IT LAST DATA?
	JR Z BUFF2;		IF BIT 7=0 LOOP
	RET;			BYE...
INIT1	LD A,98;		PORT A,C(4-7) = IN
	OUT 37,A;		PORT B,C(0-3) = OUT
	LD A,0F;		DEFAULT DATA=00
	OUT 27,A;		STROBE HIGH
	RET;			BYE
LADR1	LD HL,(+16434);		LINE NUMBER
	CALL 9D8;		IN SEED CONVERTS
	LD DE,5;		TO ADDR OF LINE
	ADD HL,DE;		SKIP HEADER AND
	LD B,H;			KEY WORD AND PASS
	LD C,L;			ADDR IN REG BC
	RET;			BACK TO BASIC

Listing 4

1 REM\n3 DIM A$(256)\n4 GOSUB 1000\n5 LET HELLO=END\n6 DIM V$(16)\n7 LET END=END+LEN B$\n10 REM PHONEMES ARE ASSEMBLED IN B$ AND WHEN COMPLETED WORDS ARE ADDED TO VOCABULARY A$\n15 CLS\n20 PRINT "PHONEME VOCABULARY LENGTH=";END\n30 PRINT\n40 PRINT "INPUT PHONEMES 0 TO 63"\n50 PRINT """Q"" COMPLETES PHRASE"\n60 PRINT """VOC"" = EXIT TO VOCABULARY"\n110 LET B$=""\n120 INPUT A\n125 IF A=VOC THEN GOTO 310\n130 LET B$=B$+CHR$ A\n140 PRINT A;",";\n150 IF A<>Q THEN GOTO 310\n199 REM TEXTINPUT/B$ TO BUFFER\n200 PRINT AT 19,0;"ENTER TEXT WORD(S)"\n210 INPUT T$\n215 PRINT T$\n217 LET A$(END TO END+LEN B$)=B$\n220 RAND END\n230 RAND USR 16516\n235 PRINT AT 19,0;"PRESS ""R"" TO REPEAT,""C"" TO CANCEL, N/L TO CONTINUE"\n240 INPUT C$\n250 IF C$="R" THEN GOTO 220\n260 IF C$="C" THEN GOTO 10\n270 LET V$(17-LEN T$ TO )=T$\n280 FOR N=1 TO 16\n290 POKE 16586+N,CODE V$(N)\n295 NEXT N\n300 GOTO 5\n310 CLS\n320 PRINT "ENTER WORD TO BE VOICED","NONEXISTING OR MISSPELLED WORDS RESULT IN ERROR 2/360","GOTO VOC OR PHON TO RECOVER"\n330 INPUT C$\n340 IF C$="PHON" THEN GOTO PHON\n350 PRINT AT 0,0;C$\n360 RAND VAL C$\n370 RAND USR 16516\n380 GOTO 310\n1000 LET END=1\n1010 LET Q=128\n1020 LET VOC=9998\n1030 LET PHON=9999\n1060 LET B$=""\n2000 RETURN\n9998 GOTO 310\n9999 GOTO 5

Products

 

Downloadable Media

 
Scroll to Top