[comp.lang.pascal] tspeech.pas from wuarchive.wustl.edu

wayne@cs.odu.edu (C Wayne Huling) (06/22/91)

Sorry for the whole thing, but I think it will help understand my question.

Ok, I have made a parent program which includes the following and the needed
binary speech.bin.  but I don't understand the external definition.  It won't
compile under turbo pascal 5.5??  any one have any ideas or explanations?  or
hey! is the author of this code reading and will give a good example of this?

{ mirrors/msdos/turbopas/tspeech.arc
 This is the Turbo Pascal include-file for the speech driver.  The 
 parameter S must be a character string containing valid phoneme codes: 
 
   CODE   SOUND  (capitalized in sample word) 
   ----   ----- 
    A     mAke   = m-A-k 
    AE    bAt    = b-AE-t 
    AH    cAr    = k-AH-r 
    AW    dOg    = d-AW-g 
    B     Bat    = B-ae-t 
    CH    CHeese = CH-ee-z 
    D     Dog    = D-aw-g 
    ZH    viSion = v-ih-ZH-eh-n 
    -     inter-phoneme separator 
   space  inter-word pause 
} 
 
type 
  SpeechString = string[255]; 
 
procedure Speech(S: SpeechString); 
  external 'SPEECH.BIN';           <---- this is what I don't get??? the 
compiler wants a semi colon after the word external?  Any help would be 
appreciated.
 
{ This procedure speaks the positive integers 1 through 32768. } 
procedure NumSpeech(N: integer); 
  begin 
    case N of 
      01:           Speech(' wh-uh-n'); 
      02:           Speech(' t-oo'); 
      03:           Speech(' th-r-ee'); 
      04:           Speech(' f-oh-r'); 
      05:           Speech(' f-i-v'); 
      06:           Speech(' s-ih-k-s'); 
      07:           Speech(' s-eh-v-eh-n'); 
      08:           Speech(' a-ee-t'); 
      09:           Speech(' n-i-n'); 
      10:           Speech(' t-eh-n'); 
      11:           Speech(' eh-l-eh-v-eh-n'); 
      12:           Speech(' t-w-eh-l-v'); 
      13:           Speech(' th-ih-r-t-ee-n'); 
      14:           Speech(' f-oh-r-t-ee-n'); 
      15:           Speech(' f-ih-f-t-ee-n'); 
      16:           Speech(' s-ih-k-s-t-ee-n'); 
      17:           Speech(' s-eh-v-eh-n-t-ee-n'); 
      18:           Speech(' a-ee-t-t-ee-n'); 
      19:           Speech(' n-i-n-t-ee-n'); 
      20..29:       begin 
                      Speech(' t-w-eh-n-t-ee'); 
                      NumSpeech(N - 20); 
                    end; 
      30..39:       begin 
                      Speech(' th-ih-r-t-ee'); 
                      NumSpeech(N - 30); 
                    end; 
      40..49:       begin 
                      Speech(' f-oh-r-t-ee'); 
                      NumSpeech(N - 40); 
                    end; 
      50..59:       begin 
                      Speech(' f-ih-f-t-ee'); 
                      NumSpeech(N - 50); 
                    end; 
      60..69:       begin 
                      Speech(' s-ih-k-s-t-ee'); 
                      NumSpeech(N - 60); 
                    end; 
      70..79:       begin 
                      Speech(' s-eh-v-eh-n-t-ee'); 
                      NumSpeech(N - 70); 
                    end; 
      80..89:       begin 
                      Speech(' a-ee-t-ee'); 
                      NumSpeech(N - 80); 
                    end; 
      90..99:       begin 
                      Speech(' n-i-n-t-ee'); 
                      NumSpeech(N - 90); 
                    end; 
      100..999:     begin 
                      NumSpeech(N div 100); 
                      Speech(' h-uh-n-d-r-eh-d'); 
                      NumSpeech(N mod 100); 
                    end; 
      1000..maxint: begin 
                      NumSpeech(N div 1000); 
                      Speech(' th-aw-u-s-ae-n-d'); 
                      NumSpeech(N mod 1000); 
                    end; 
    end;

mead@uxh.cso.uiuc.edu (Alan David Mead) (06/22/91)

Yeah.  A while ago another user had this problem.  

You can make it compile by using BINOBJ.EXE (a utility that comes 
with TP).  You need to specify a "public name".  This will be the 
procedure that is declared external.

(Ie, you probably get a mesassage 'Expecting ";"' or something 
right after the EXTERNAL keyword right after a procedure 
declaration:

    procedure SPEECH external 'TPSEECH.BIN';

You need:

{$L TSPEECH.OBJ} 
{$F+}

   procedure SPEECH; external;

{$F-}

In this case, SPEECH (case unimportant) is the public name to be 
used as the third argument when invoking BINOBJ.  The tspeech.OBJ 
file is created from the tspeech.BIN file by BINOBJ.EXE.)

(The net will no doubt correct me if any of the above is wrong.)

BUT, I was still unable to get the beast to work *right* on my
386SX.  The original user was unsuccessful as well (as far as I
know).

I thought that my machine's relatively high speed might be the
problem, but the couple of SLOW utilities I tried didn't help
much (and who wants to slow down their machine so it can speak?)

Good luck.  I'd send you the stuff, but after a long while of not 
working, I deleted all that stuff while house-keeping.

-alan : amead@s.psych.uiuc.edu


--
Alan Mead : mead@uxh.cso.uiuc.edu