world of sound Spectrum - chapter 4.8: Synthesis of speech.

ZX Forum #04
         4.8. Speech synthesis


   Synthesized speech can be just a recording and reproducing 
it as any other sound by using routines from Chapter 4.6,

but usually act differently. First introduced into the computer 
all the phonemes specified language, then the user is prompted

phrase, and finally, the computer consistently reproduces its 
constituent phonemes. This method allows to save memory and 
play absolutely any phrase. Here's a program that allows 
Cpektrumu talk: 


   10 CLEAR 25343: LET L = 3

   20 PRINT "Wait please ..."

   30 FOR A = 25344 TO 25433: READ D: POKE A, D: NEXT A

   40 FOR A = 0 TO 25: POKE 25437, A * L +100

   50 CLS: PRINT "Press any key, then say '"; CHR $ (A +65 
);"'": 

      PAUSE 0

   60 RANDOMIZE USR 25344: NEXT A

   70 CLS: INPUT "Enter phrase:"; LINE A $: PRINT A $

   80 FOR A = 1 TO LEN A $

   90 IF A $ (A) = "" THEN POKE 25433 + A, 32: NEXT A

  100 IF A $ (A)> = "a" THEN LET A $ (A) = CHR $ (CODE A $ (A) 
-32) 

  110 POKE 25433 + A, (CODE A $ (A) -65) * L +100: NEXT A: POKE 
25433 + A, 0 

  120 RANDOMIZE USR 25406: GOTO 1970

  130 DATA 243,33,0,0,17,0, L, 6,8,203,38,219,254,203,119,40,

           2,203,198,16,244,35,27,122,179,32,236,251,201

  140 DATA 243,33,0,0,17,0, L, 62,7,6,8,230,239,203,6,48,2,246,

           16,211,254,16,244,35,27,79,122,179,121,32,234,251,201

  150 DATA 33,90,99,126,183,200,254,32,32,7,6,5,118,16,

           253,24,8,50,32,99,229,205,29,99,225,35,24,231


   Let me explain some of the lines:

 30 - read into the program memory in which
      DAH;
 40 ... 60 - recorded phonemes with microphones
      on;
 70 - input phrases;
 80 ... 110 - the phrase is memorized in

      special format;
 120 - routine is called reproduction
      Denia;
 130 ... 150 - routines in the codes.


   After starting the program asks to wait a bit, reading the 
code part, then you will need to consistently pronounce the 
microphone 26 phonemes. After this You can enter any phrase and 
enjoy their sounds. When you enter these phrases permissible 
upper and lower case Latin letters and spaces. How will sound 
all the other characters, no one knows. Neither no case should 
enter the @ sign, otherwise the program just hangs.


   This program was written as an example, so no additional 
service features (such as changing a single phoneme), but you 
can add them. 

   To change the length of individual
phoneme change in the tenth row value
variable L (in this case it may
be from 1 to 6).

   If you can not right the first time
pronounce all the phonemes with a satisfactory
quality, you can try again
stop the program by pressing
BREAK and use the command GOTO 40. When
phonemes are written, you can save
them on the tape by typing SAVE "name"
CODE 25600,6656 * L (number 6656 turned out
by multiplying the number of phonemes (26) on
256). Best of all, if before the block
will be written to the above program
with the following line:


   35 LOAD "name" CODE 25600: GOTO 1970

Write this program you can use the command SAVE "SPEAKER" LINE 
10. 

   Unfortunately, 26 phonemes - this is not enough
even for the English language, not to mention
about the Russian. Their number can, of course,
increase, but it will increase and the volume
they occupy memory. There's nothing
do.

   If you want your ZX-Spectrum
spoke in Russian, then you need to connect the Russian font 
(for details see [1]); increase the number of phonemes. And 
also replace all messages that appear on the screen.


   Number of Russian phonemes can be greatly reduced, if not 
used soft consonants (in the computer version of their soft 
almost inaudible) and vowels "E", "E", "S" and "I" (instead of 
them enter the "J" and, accordingly, "E", "O", "Y" and "A"). 
Hard sign and replaced by the letters "J".


   Finally, one piece of advice. Much nicer to hear a normal 
human speech than words, pronouncing according to the rules of 
grammar. Therefore, enter the words as you hear: sinclair - 
sinkler, PC - kampyuter.