[comp.sys.mac.programmer] Speech Synthesis

sgrae@megatest.UUCP (Steve Graesser) (10/07/89)

I'm looking for software that can convert
a text file into to speech.  What I am
trying to do is to read in documents with
a scanner and OCR software and have the text
spoken to visually impaired students.

I know the OCR program Read-It! 2.1 has this feature,
but the reviews say it is not the
best OCR program.  I would like to use either
Accutext or OmniPage for the OCR software,
but I am stuck as to what to use for the
speech synthesis part.

Thanks

steve

Steve Graesser
Megatest Corp.
880 Fox Lane			{decwrl | amdcad}!sgrae@megatest.uucp
San Jose, CA 95131	|	(800) 292-0200 Ext. 3388
-- 
Steve Graesser
Megatest Corp.
880 Fox Lane
San Jose, CA 95131	|	(800) 292-0200 Ext. 3388

rahardj@ccu.umanitoba.ca (Budi Rahardjo) (10/10/89)

][ Steve Graesser (sgrae@megatest.uucp) wrote :
][ I'm looking for software that can convert
][ a text file into to speech.  What I am
][ trying to do is to read in documents with
][ a scanner and OCR software and have the text
][ spoken to visually impaired students.

I believe in Turbo Pascal ver.1.0 there is an example
of text to speech program ...

                                 Budi Rahardjo
                            ------------------------
                            rahardj@ccu.UManitoba.CA

legg@sirius.ua.oz.au (Christian Legg) (10/11/89)

Steve Graesses (sgrae@megatest.uucp) wrote
| I'm looking for some software that can convert a text file into speech..

Well Steve, if you feel up to a bit of programming, this program should show
you at least how to get the Mac talking. It is written for Lightspeed Pascal,
but should be easily modifiable to MPW.

Budi Rahardjo (rahard@ccu.umanitoba.ca) wrote
|I believe in Turbo Pascal ver.1.0 there is an example
|of text to speech program ...

This is true, and this code is freely adapted from that code.

The number of characters that can be stored and spoken as words is defined
as the constant maxstoresize.

A line can be said by calling the say procedure.

Several lines can be spoken by calling the insertstore procedure, then by
calling the speakstore procedure. Clearstore will clear out the text store
in preparation for further insertions.

This program needs Macintalk dated 13 April 1989 (or later) to work on
a Mac II or later. As Lightspeed II did not come with a speech.lib file, it
is necessary to use the convert->lib2 program to convert the original speech
file that came with Lightspeed I to a format that can be used with LS II.

----cut here----

program talker;

uses speechintf;        {lightspeed pascal speech interface}

const
  maxstoresize = 1000;

var
  thespeech: speechhandle;
  speechstore: packed array[1..maxstoresize] of char;
  storesize : integer;

procedure init_speech;
var
  error : integer;
begin
  error := speechon(noexcpsfile, thespeech);
end;

procedure finish_speech;
begin
  speechoff(thespeech);
end;

procedure clearstore;
var
  i: integer;
begin
  for i := 1 to maxstoresize do
    speechstore[i] := ' ';
  storesize := 0;
end;

procedure insertstore (what: str255);
var
  i: integer;
  temp: integer;
begin
  temp := length(what);
  if temp > 0 then
  begin
    for i := 1 to temp do
      begin
        storesize := storesize + 1;
        speechstore[storesize] := what[i];
      end;
  end;
end;

procedure speakstore;
var
  phonetics: handle;
  error: speecherr;
begin
  phonetics := newhandle(0);
  error := reader(thespeech, @speechstore,storesize, phonetics);
  error := macintalk(thespeech, phonetics);
  disposhandle(phonetics);
end;

procedure say (m: str255);
begin
  clearstore;
  insertstore(m);
  speakstore;
end;

begin
  init_speech;
  say('Hello');
  insertstore('Hello ');
  insertstore('from ');
  insertstore('MACINTALK  ');
  speakstore;
  finish_speech;
end.


*****************************************************************************
* Christian Legg,                *                                          *
* University Computing Services, *  'Base 8 is just like base 10 really...  *
* University of Adelaide,        *  ...if you're missing two fingers.'      *
* South Australia.               *                                          *
*                                *                       Tom Lehrer         *
* ACSnet : legg@sirius.ua.oz.au  *                                          *
*****************************************************************************