Re: Text to File programme

 

Dear Richard,

I tried this programme and got following error message :

« PROC_callmethod failed in module c:\Program Files\BBC BASIC for Windows\lib\COMLIBA ».

 

But with the example from wiki below, everything is ok except that numbers are readed in english.

 

REM. Text-to-speech demonstration program using COMLIB

      REM. R.T.Russell, 24-Apr-2007

 

      INSTALL @lib$+"COMLIBA"

 

      ON ERROR PROC_comexit : PRINT 'REPORT$ : END

      ON CLOSE PROC_comexit : QUIT

 

      PROC_cominit

 

      Pitch% = 0

      Speed% = 0

      Voice$ = ""

 

      tts% = FN_createobject("Sapi.SpVoice")

      REPEAT

        READ phrase$

        PRINT phrase$

        PROCspeakasync(tts%,phrase$,Pitch%,Speed%,Voice$)

        REPEAT

          WAIT 100

          PRINT "Waiting..."

        UNTIL NOT FNisspeaking(tts%)

      UNTIL phrase$ = ""

      PROC_releaseobject(tts%)

      PROC_comexit

      END

 

      DATA "BBC BASIC for Windows is an advanced implementation of BBC BASIC for Microsoft Windows,"

      DATA "providing the programmer with a familiar language but with a modern interface."

      DATA "It combines the simplicity of BASIC with the sophistication of a structured language,"

      DATA "allowing you to write utilities and games, use sound and graphics, perform calculations"

      DATA "and create complete Windows applications."

      DATA "In short, using BBC BASIC you will be able to make your PC do what you want it to."

      DATA

 

      DEF PROCspeakasync(tts%,phrase$,pitch%,speed%,voice$)

      LOCAL qual$

      qual$ = "<PITCH ABSMIDDLE="""""+STR$pitch%+"""""/><RATE ABSSPEED="""""+STR$speed%+"""""/>"

      IF voice$<>"" qual$ += "<VOICE REQUIRED=""""NAME="+voice$+"""""/>"

      PROC_callmethod(tts%, "Speak("""+qual$+phrase$+""",3)")

      ENDPROC

 

      DEF FNisspeaking(tts%)

      = FN_getvaluestr(tts%,"Status.RunningState") <> "1"

So I still need your help.


Salomon


2017-04-05 18:19 GMT+02:00 Richard Russell <news@...>:

On Wed, Apr 5, 2017 at 09:05 am, CHABI Salomon wrote:
My computer is configured in french.
But the programme reads the numbers for instance in english.

Interesting that the text-to-speech defaults to English, I wouldn't have expected that.  But, yes, you can try adding an explicit selection of French as the language to use:

      INSTALL @lib$+"COMLIBA"

      ON ERROR PROC_comexit : PRINT 'REPORT$ : END
      ON CLOSE PROC_comexit : QUIT

      PROC_cominit

      Pitch% = 0
      Speed% = 0
      Voice$ = ""
      Lang$ = "40C"

      REPEAT
        READ phrase$
        PRINT phrase$
        PROCspeak(phrase$,Pitch%,Speed%,Voice$,Lang$)
      UNTIL phrase$ = ""
      PROC_comexit
      END

      DATA "Parlez vous Français?"
      DATA

      DEF PROCspeak(phrase$,pitch%,speed%,voice$,lang$)
      tts% = FN_createobject("Sapi.SpVoice")
      IF tts% THEN
        LOCAL qual$
        qual$ = "<PITCH ABSMIDDLE="""""+STR$pitch%+"""""/><RATE ABSSPEED="""""+STR$speed%+"""""/>"
        IF voice$<>"" qual$ += "<VOICE REQUIRED=""""NAME="+voice$+"""""/>"
        IF lang$<>"" qual$ += "<VOICE REQUIRED=""""LANGUAGE="+lang$+"""""/>"
        PROC_callmethod(tts%, "Speak("""+qual$+phrase$+""")")
        PROC_releaseobject(tts%)
      ENDIF
      ENDPROC

Richard.


Join bb4w@groups.io to automatically receive all group messages.