48K Spectrum Speaks No hardware add-ons, just your faithful cassette recorder - John Edwards makes micros talk. It is popular belief that to get a personal computer to speak requires an expensive hardware add-on. This program, written for the ZX-Spectrum will prove otherwise. Unfortunately the program will only work effectively on a 48K machine, because a lot of memory is required to store any useful amount of speech with sufficiently high fidelity. The speech is recorded and generated by two extremely short machine-code routines, which take only a few moments to enter. To obtain maximum storage capacity each byte of memory is used to store eight pieces of speech information as opposed to one. In the following routines the following rule applies: the longer the piece of speech the lower the fidelity. This means that if the short phrase "Good morning" is required, then the fidelity will be high, but if the computer is required to count from one to 100 the fidelity will be so low that the speech will be nothing but indecipherable grating. The routines are designed to store speech above 32768 which means that if speech is used the user is left with the equivalent of a 16K machine. The machine code is entered by first typing and running the program in figure 1 which allows machine code to be entered in hexadecimal form. Run the program and Enter 65280 to the prompt, then enter the hexadecimal code line by line pressing Enter after each line of code. After you have finished typing in the hexadecimal code just press Enter and the program will stop with an error. Save the machine code with SAVE "speech"CODE 65279,100 [As should be obvious, those numbers are wrong. The code starts at 65280, not 65279; and although it does no harm, in this case, to save a few more bytes than needed, it is only 60 bytes long.] Then type CLEAR 32767 and New; the program will disappear but the machine code will remain intact. As the routine standard you have about six seconds of recording time. Set up your cassette recorder to record sounds through a microphone and record something clearly and plainly onto tape. It will be easier if you make a noise before you start so that you will be able to locate your speech easi- ly. Then play your piece of speech through and adjust tone and volume to minimise tape noise. When you are ready type RANDOMIZE USR 65280 but do not press Enter. Plug the Ear lead between the tape recorder and your computer then start the tape playing. When you hear the noise that precedes your speech through the computer's loudspeaker press Enter. After about six seconds a report code should appear at the bottom of the screen and when this happens you can stop the tape recorder. You can now test the speech by typing RANDOMIZE USR 65308 If the speech is not very clear then repeat the process of recording with different levels. You will find that the speech sounds better if you connect the Mic lead to an external amplifier. If you cannot get the machine code to work, reload it and check it through, by Peeking the locations from 65280 onwards. Any speech recorded by the program can be Saved by SAVE "speech"CODE 32767,65279-32767 [More off-by-one numbers. If you've just done CLEAR x, you should save from x+1, not from x...] and Load by LOAD ""CODE The program can also be used for realistic sound effects. [Figure 1, the hexloader, is on the TZX. So, obviously, is the machine code, but since it is short, and listed with labels, I've appended it here as well:] Figure 2. Machine-code listing HEX MNEMONIC F3 HEAR DI 210080 LD HL,32768 0608 HLP1 LD B,8 DBFE HLP2 IN A,(254) CB77 BIT 6,A 2002 JR NZ,2 CBFE SET 7,(HL) CB3E SRL (HL) 10F4 DJNZ HLP2 CB0E RRC (HL) 23 INC HL 7C LD A,H FEFE CP 254 20EA JR NZ,HLP1 FB EI C9 RET F3 TALK DI 210080 LD HL,32768 0608 TLP1 LD B,8 CB46 TLP2 BIT 0,(HL) 2804 JR Z,4 3E00 LD A,0 D3FE OUT (254),A 3EFF LD A,255 D3FE OUT (254),A CB06 RLC (HL) 10F0 DJNZ TLP2 CB06 RLC (HL) 23 INC HL 7C LD A,H FEFE CP 254 20E6 JR NZ,TLP1 FB EI C9 RET