Speech synthesis in DOS

DOS specific questions.
angros47
Posts: 1212
Joined: Jun 21, 2005 19:04

Speech synthesis in DOS

Postby angros47 » Dec 29, 2013 21:28

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/SPEECH/MSDOS/TALK/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/freebasic-dos-speech/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

Postby d3pd » May 15, 2014 17:00

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: 1212
Joined: Jun 21, 2005 19:04

Re: Speech synthesis in DOS

Postby angros47 » May 17, 2014 9:00

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

Re: Speech synthesis in DOS

Postby d3pd » May 18, 2014 20:03

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: 1212
Joined: Jun 21, 2005 19:04

Re: Speech synthesis in DOS

Postby angros47 » May 19, 2014 16:40

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-speaker-speech-resynthesized/

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_federalScronemeSpeechSynthesizerDataSheet1980_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

Postby JonHornstein » Apr 04, 2017 4:26

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: 1212
Joined: Jun 21, 2005 19:04

Re: Speech synthesis in DOS

Postby angros47 » Apr 08, 2017 12:31

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: 851
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: Speech synthesis in DOS

Postby St_W » Apr 08, 2017 17:34

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: 1212
Joined: Jun 21, 2005 19:04

Re: Speech synthesis in DOS

Postby angros47 » Apr 13, 2017 12:30

Updated

Return to “DOS”

Who is online

Users browsing this forum: No registered users and 1 guest