Audio Clip
Data Sheet:
See previous SP0256-AL2 post to download the data sheet.
Circuit Diagram:
sp0256-al2.sch

Note: the LM386 amplifier circuit provided in Robot Builder's Bonanza
The Code:
SP0256AL2.bs2
' {$STAMP BS2}
' {$PBASIC 2.5}
' SP0256-AL2 Speech Chip
' Control Code
' Text: HELLO WORLD.
' Phoneme: HH EH LL AX OW (PAUSE) WW ER1 LL PA2 DD1 (PAUSE)
' Octal: 033 007 055 017 065 003 056 063 055 001 025 004
' Dec: 27 7 45 15 53 3 46 51 45 1 21 4
text DATA 27,7,45,15,53,3,46,51,45,1,21,4,0
ptr VAR WORD
char VAR BYTE
setup:
' P7 <- SBY ' P6 -> 'ADL
' P0-P5 -> Data
DIRL = %01111111
HIGH 6
ptr = text
PAUSE 2000
go:
' Set char to the next phoneme
' Send it
READ ptr,char
DEBUG DEC char, CR
IF char <> 0 THEN cont
END
cont:
GOSUB pout
ptr = ptr + 1
GOTO go
' Phoneme Output
pout:
' Now just set OUTL P6='ADL=1, (P0-P5) = phoneme byte
OUTL = char | %10000000
DEBUG BIN ? OUTL
' And set P6='ADL=0 for 2usec to tell the chip to read
PULSOUT 6,1
' Wait for P7=SBY (standby) to indicate chip is done speaking
notdone:
IF IN7 = 0 THEN notdone
RETURN
Quick Code Explanation:
The data sheet goes into this in detail, but in short: the program puts the 6-bit phoneme data on data lines A1-A6, then pulses ^ALD low for a short time to let the chip know data is ready, then polls SBY until it goes high, then repeats until it runs out of phonemes.
That's it. This is just a prototype so there's lots more to do before this becomes useful. For example, wouldn't it be nice if a handy dandy AVR of some flavor could front end this chip and accept data over serial and/or I2C? Maybe even do true TTS?
truely amazing!
ReplyDeletelook at the bright side... in 20 some years, there's bound to have been some progress right? microsoft sam? eh I guess not... ;)
First, thanks for this. I have a few of these chips around. First one I bought years ago at RS.Grabbed the others on a discount/clearance table at RS also. One I have from a Coleco Speech Unit.
ReplyDeleteI originally was going to interface one to my SX-64 (which I still have and works). I really would like some help on an RS-232 interface for one of these.
One or two of the packages has a speech ROM included with the AL2...
:)
Jack,
ReplyDeleteThanks for the note!
Cool you still have an SX 64. I vaguely remember them, must be kind of rare? I can help with an interface to the 64 if it uses a similar connector to the C64; I can dig up some pics / instructions for that.
Re: RS232 -- happy to help if I can. Since the SP0256 takes parallel data, the trick is to convert parallel to serial, and also to set up a proper RS232 receiver.
MAX232 is an RS232 driver / receiver chips out there that do proper voltage levels -- datasheet: http://www.atmicroprog.com/download/ci/max232.pdf So that should take care of the reciever side.
For converting serial to parallel, there are some chips that will do this, tho I can't think of any off the top of my head. Some googling will probably turn something up. Then it is a question of wiring in the various control pins on the AL2 appropriately...
Let me know how I can help... (send me an email...)
Michael