Speech routine in GFA-basic - 2 bombs

Speech routine in GFA-basic - 2 bombs

Post by Gisle Fr?ysla » Thu, 19 Sep 1996 04:00:00



Hi!

Gfaexpert to work in GFA-basic 3.5, but all I get is 2 bombs.
Does anybody have any experience with using these routines or know
what could be  wrong with the code.
Here are the routines:

'
PROCEDURE initio.speech
  ' *** uses STSPEECH.TOS to speak
  ' *** RESERVE doesn't function, therefore reset necessary
  ' *** don't be surprised by a sudden freeze or some bombs
  ' *** routine by Dave Morrison
  ' *** uses Standard Procedure
  LOCAL i%,k%,bpage%,prg%,phoneme$,speech$,m$
  file$="I:\HIGH_MED\SOUND\STSPEECH.TOS"                ! or other
path
  IF NOT EXIST(file$)
    ALERT 3,"Can't find| |STSPEECH.TOS|",1,"EXIT",button

  ENDIF
  RESERVE FRE(0)-29000
  bpage%=EXEC(3,file$,"","")
  IF bpage%>0
    prg%=bpage%+&H100
    POKE prg%+&HE,&H4E
    POKE prg%+&HF,&H75
    POKE prg%+&H6C,&H4E
    POKE prg%+&H6D,&H75
    speech_buf%=prg%+&H6EEE
    POKE speech_buf%,&HFE
    phoneme%=prg%+&H32
    speech%=prg%+&H88
    RESTORE speech_data
    FOR i%=1 TO 6
      READ k%
      phoneme$=phoneme$+CHR$(k%)
      speech$=speech$+CHR$(k%)
    NEXT i%
    phoneme$=phoneme$+MKL$(phenome%)
    speech$=speech$+MKL$(speech%)
    FOR i%=1 TO 6
      READ k%
      phoneme$=phoneme$+CHR$(k%)
      speech$=speech$+CHR$(k%)
    NEXT i%
    phoneme%=VARPTR(phoneme$)
    speech%=VARPTR(speech$)
  ELSE
    m$="*** ERROR ***| |EXEC 3 returns|    "+STR$(bpage%)
    ALERT 3,m$,1,"EXIT",k

  ENDIF
  '
speech_data:
  DATA &h48,&he7,&hff,&hfe,&h4e,&hb9,&h4c,&hdf,&h7f,&hff,&h4e,&h75
RETURN
' ***
PROCEDURE talk(txt$)
  ' *** use phonetic spelling to improve pronunciation
  POKE speech_buf%+1,LEN(txt$)
  txt$=txt$+CHR$(0)
  BMOVE VARPTR(txt$),speech_buf%+2,LEN(txt$)
  CALL phoneme%
  CALL speech%
  PAUSE 5
RETURN