Speech synthesis in DOS

DOS specific questions.
Post Reply
angros47
Posts: 2321
Joined: Jun 21, 2005 19:04

Speech synthesis in DOS

Post by angros47 »

Under Windows, speech synthesis can be easily achieved using SAPI (although not all languages are always available; usually only "Microsoft Sam" is available by default); speech quality is good. Under Linux, it's even easier: libespeak can be used; speech quality is not perfect, but the it can support many languages with male and female voices.

But under DOS? Is there an equivalent solution? Espeak can be compiled for dos, but it doesn't speak, it just produces .WAV files. There are some readers (usually for blind people) but they usually required dedicated hardware. But... I found some old programs, still in GWBasic, that surprised me: the first one was called TALKFUN, and it produced a somewhat intelligible voice through PC speaker; unfortunately, it could only spell a word, since it played single letters, not phonemes. Also, the real routine was not in basic, it was in machine language and encoded in DATA lines. Anyway, the source code is here:

http://cd.textfiles.com/knowledgemedia/ ... K/TALK.BAS

If you want to run it in dosbox and gwbasic, don't forget to slow down emulation. It's funny, but useless.

A better solution was the SPEECH.COM driver, by Andy McGuire: it was public domain, it supported phonemes, and it could be used with other programs. You can find it here:
http://cd.textfiles.com/soundsensations/VOICE/SPEECHVI/

Unfortunately, on a modern computer it's too fast, you can't hear anything; also, it's made for 16 bit programs. Anyway, it was so successful that another software has been made from it:

http://www.yarrahouse.org/text2speech.html

In this version, source code is available (I doubt that the original SPEECH.COM ever had a source code... maybe it has been written in machine code); since it used a virtual file, maybe it could be used from a FreeBasic program... but I can't test, since it use a .SYS driver, and I can't load it in DosBox.

Anyway, I liked that solution, so I tried to port it to FreeBasic; here is the result:

http://sourceforge.net/projects/freebas ... ech/files/

Phoneme data are the same, but a sound blaster is used

I used the extended phonemes from horndrv, and I restored the "i" phoneme (in SPEECH.COM it was available, in horndrv it wasen't).

Also, I used the rule set of TRAN.EXE (another public domain software) to convert English text into phonemes.

Also, phoneme data are stored as string constants (and not as array initializers) to use less memory in the compiled executable (looks like FreeBasic, when an array initializer is used, store each value in memory with a separate assembly instruction, building an executable much bigger than a C equivalent)

Anyway, try it and let me know what do you hear.
Last edited by angros47 on Apr 13, 2017 12:29, edited 1 time in total.
d3pd
Posts: 2
Joined: May 15, 2014 16:52

Re: Speech synthesis in DOS

Post by d3pd »

Hey there. I'l love to have a listen, but the link to your source code seems to have expired. Is your code available elsewhere, such as on GitHub? Thanks!
angros47
Posts: 2321
Joined: Jun 21, 2005 19:04

Re: Speech synthesis in DOS

Post by angros47 »

d3pd
Posts: 2
Joined: May 15, 2014 16:52

Re: Speech synthesis in DOS

Post by d3pd »

Ah, thanks for that. I see what you're doing by piping the sound data representing the phonemes out for sound processing. I'm familiar with the 1976 papers on the rules for English text to phonemes and I may have a try at implementing them.

Out of interest, would you happen to know who produced the original phoneme sound data? It sounds similar to a basic version of the data used for the Heathkit robots. It might be interesting to reconstruct the sounds represented by the data derived from PHONEME.C using synthesis by live sine wave addition.
angros47
Posts: 2321
Joined: Jun 21, 2005 19:04

Re: Speech synthesis in DOS

Post by angros47 »

Phoneme data inside PHONEME.C are the same data included in SPEECH.COM by Andy McGuire (I used an hex dump, the phoneme bytes are exactly the same). SPEECH.COM exists at least since 1987... I don't know from where they come: maybe they were digitally recorded (but it happened more than 25 years ago... if the man who recorded them is still alive, his voice may be different now), or maybe they have been programmed "by hand": in fact, it's possible to "program" phoneme data, and someone did it:

http://olofsonarcade.com/2012/03/24/pc- ... nthesized/

If you look at the pascal source code, you will see that phonemes are made by mixing noises and different frequencies.
Unfortunately, not all phonemes are included, otherwise that code would have provided an incredibly lightweight solution for speech synthesis.

Anyway, using the same approach to reconstruct phoneme data would be easier than using sine wave addition: in fact, pc speaker cannot produce sine waves (it can approximate them by using PWM, but it doesn't work well on piezoelectric speakers), it can only produce square waves: phoneme data are in fact encoded as 1-bit pcm, and they can be played as a sequence of single square waves by the speaker.

About the Heathkit robots: they used Votrax SC-01; here is the datasheet:

https://archive.org/details/bitsavers_f ... 80_3643376

and here is the code to emulate it (used in MAME):

http://mamedev.org/source/src/emu/sound/votrax.c.html
JonHornstein
Posts: 1
Joined: Apr 04, 2017 4:12

Re: Speech synthesis in DOS

Post by JonHornstein »

Just happened to notice the post.

I wrote horndrv to see if there was any interest in TTS which there wasn't.

I plagiarized the phoneme sounds I think from SPEECH.COM. I got SPEECH.COM to dump to a file each phoneme with appropriate spaces then hex dumping the output file using a homebrew C written dumper. I then incorporating the dump into my source code, hence my comment in my documentation about plagiarized everything.

My effort was to bring together:

Australian English->Phoneme (Adapted from the TRAN program which was written by Stephen Neely)
Phoneme -> sound (SPEECH.COM)
DOS Device driver written mainly in C (Byte Magazine?)

in a DOS device driver with all the source code.
angros47
Posts: 2321
Joined: Jun 21, 2005 19:04

Re: Speech synthesis in DOS

Post by angros47 »

You wrote the horndrv? Very interesting. I looked at it, and at the TRAN program, in an attempt to rebuild dos speech synthesis under FreeBasic. I also made some examples of it, actually
St_W
Posts: 1619
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: Speech synthesis in DOS

Post by St_W »

Unfortunately the original upload is not available anymore, maybe you could re-upload it, angros47? And maybe use a more permanent hoster like github or freebasic-portal.de .
angros47
Posts: 2321
Joined: Jun 21, 2005 19:04

Re: Speech synthesis in DOS

Post by angros47 »

Updated
Post Reply