Download free music MP3s on genuine quality, the world’s largest online music catalogue, powered by your scrobbles. Free listening, videos, photos, The world’s largest online music catalogue, powered by your scrobbles. Free listening, videos, photos, stats, charts, biographies and concerts. stats, charts, biographies and concerts.
Saturday, August 2, 2025
SP0256A-AL2 Speech Synthesis
I had one of those moments recently when reading an article online sent me into a bit of a major tangent. The article in question was talking about the SP0256-AL2 speech synthesizer chip. And if you heard a computer talking in the 1980s, then chances …
I had one of those moments recently when reading an article online sent me into a bit of a major tangent. The article in question was talking about the SP0256-AL2 speech synthesizer chip. And if you heard a computer talking in the 1980s, then chances are it was probably this chip doing all the hard work.
These aren't very easy to come by these days, but you might get lucky with the usual places and find a legit, used, working one, but apparently an awful lot of those that can be found online are likely to be fake (see: https://www.smbaker.com/counterfeitfakejustplainbad-sp0256a-al2-chips).
So whilst on particularly a musical project (at least, not at the moment), this details how I got it up and running.
Warning! I strongly recommend using old or second hand equipment for your experiments. I am not responsible for any damage to expensive instruments!
If you are new to microcontollers, see the Getting Started pages.
The SP0256A-AL2
This is a pretty amazing device. It was present in the Currah uSpeech peripheral (that unfortunately I never had myself) back "in the day" and a whole load of other cheap(ish) add-ons for 1980s computers.
It works by having a set of samples encoded in ROM for the basic phonetic sounds of the English language (called "allophones"). Then it is told which to sound by a controlling CPU, or these days MCU probably.
Of course, text to speech has come on enormously since then, and there are all sorts of nuance now possible. It will be interesting to see if the recent rounds of AI use become a pinnacle of text to speech or a curse, but we shall see.
But there is something pretty nostalgic about hearing an allophone-based, lo-fi (by today's standards) chip in action. And this style of voice is iconic for the sounds of computer voices used in films such as War Games, 2001, and The Forbin Project, among many others.
"The SP0256-AL2 is perhaps the most commonly encountered variant. It contains 59 allophones primarily intended for use with English language phrases and five pauses in its internal 16 Kb (2 KB) ROM."
Here is the full allophone table from the datasheet:
The datasheet also includes some words that show how the allophones can be used, for example:
I sort of imagined that somewhere there might be a library that has the data structures that represent the details provided in the datasheet, but I've not found it yet if it exists.
But thankfully there are means of getting allophones from English Text, which I'll get to shortly.
The Basic Code
The code to drive the chip from BASIC is pretty straight forward. This is my code based on the example provided in the manual:
10 DATA 18,12,55,12,43,18,51,35,5,55,0 15 DATA 24,35,46,52,45,21,41,51,11,13,14,53,45,0 20 LET LE=11+14 30 DIM XX(LE) 40 FOR Y = 1 TO LE 50 READ XX (Y) 60 NEXT Y 70 FOR Z=1 TO LE 80 IF (INP(31) AND 2) = 2 THEN GOTO 100 90 GOTO 80 100 OUT 31,XX(Z) 105 NEXT Z
There is a list of the phonemes required and they are sent to the chip in turn.
As already mentioned of course, the real trick is how to get that list of allophones. Whilst it is possible to walk through the datasheet for the SP0256A-AL2 and pick out the correct ones in turn, that is a lot more difficult that it might initially seem, as it perhaps highlighted above.
Text to Allophone Data Workflow
As with may of these things we are fortunately that there are tools out there that can do all this for us. In this case, two tools are required:
I used espeak-ng which has a MSI installer for Windows, and lexconverter which is a python script.
Install steps:
Install espeak-ng as required. This is a command line utility for Linux or Windows and instructions for installation can be found in "Documentation" -> "User Guide".
Grab the lexconvert.py script.
I had to ensure that the location of espeak-ng was present in my system PATH, but also had to edit lexconvert.py to change several instances of espeak to espeak-ng. There were three places that looked like they would need changing, all associated with "os.system", "os.popen" or "subprocess.Popen" calls or similar.
I suspect copying the original executable to a more handy location and renaming it to "espeak" would probably work too.
To get allophones suitable for use with the SP0256A-AL2 requires the "cheetah" option to lexconvert, as detailed below:
cheetah : Allophone codes for the 1983 "Cheetah Sweet Talker" SP0256-based hardware add-on for ZX Spectrum and BBC Micro home computers. The conversion from phonemes to allophones might need tweaking. Set the CHEETAH_SYM environment variable to see the mnemonic symbols from the instruction sheet (not actually used by the system).
The command I used was as follows, which then waits for keyboard input and creates a data structure of allophones which can be used almost directly in the BASIC program.
C:\Users\Kevin\Stuff>python lexconvert.py --phones cheetah Enter text (EOF when done) Hello World DATA 27,51,45,53,46,52,45,21,0 Greetings Professor Falcon DATA 36,14,19,13,12,44,43,9,14,51,40,7,55,52,40,26,45,41,51,11,0 Would you like to play a game? DATA 46,30,21,25,22,45,6,41,13,51,9,45,20,51,36,20,16,0 This is the Voice of World Control DATA 18,12,55,12,43,18,51,35,5,55,24,35,46,52,45,21,41,51,11,13,14,53,45,0
C:\Users\Kevin\Stuff>
One issue I had in using these DATA statements directly is that they get capped when pasted into the RC2014 terminal, hence using two DATA statements in my final code.
But in general terms, this works surprisingly well.
Closing Thoughts
I now feel like I should build up DATA statements of allophones for well-known quotes from computers in films.
I also now want to work out how to drive the SP0256A-AL2 directly from a microcontroller myself, so that will probably be next.
Then I would like to tie this up to MIDI somehow, but my initial thought, of linking allophones to MIDI notes, seems to have been done already: https://rarewaves.net/products/midi-narrator/
But I still might have to overdub it saying "Concerto for a Rainy Day". Getting it in time with the music might be an interesting challenge, but maybe there might be a computer-voice-vocoder-like thing possible now.
And of course, this now presents all sorts of interesting possibilities for some more Philip Glass...
No comments:
Post a Comment