User Tools

Site Tools


asynchronous_20speech

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
asynchronous_20speech [2018/03/31 13:19] – external edit 127.0.0.1asynchronous_20speech [2024/01/05 00:22] (current) – external edit 127.0.0.1
Line 1: Line 1:
 =====Asynchronous speech===== =====Asynchronous speech=====
  
-//by Richard Russell, October 2016//\\ \\  The supplied example program **SPEAK.BBC** outputs the speech synchronously, that is **PROCspeak()** does not return to the caller until the speech output is complete. That will often be what is wanted, but in some circumstances you may wish to get on with doing something else while a phrase is being spoken. The programs below illustrate how that may be achieved; the first uses the **ActiveX** (COM automation) approach used in SPEAK.BBC and the second uses direct calls to the **SAPI5 COM objects**.\\ \\ +//by Richard Russell, October 2016//\\ \\  The supplied example program **SPEAK.BBC** outputs the speech synchronously, that is **PROCspeak()** does not return to the caller until the speech output is complete. That will often be what is wanted, but in some circumstances you may wish to get on with doing something else while a phrase is being spoken. The programs below illustrate how that may be achieved; the first uses the **ActiveX** (COM automation) approach used in SPEAK.BBC and the second uses direct calls to the **SAPI5 COM objects**. 
 + 
 ===== ActiveX method ===== ===== ActiveX method =====
-\\  The **PROCspeakasync()** routine returns immediately and the **FNisspeaking()** function allows the current status to be polled so you can discover when the speech is finished:\\ \\ + 
 +The **PROCspeakasync()** routine returns immediately and the **FNisspeaking()** function allows the current status to be polled so you can discover when the speech is finished.  The parameter ''3'' passed to the **Speak** method is a combination of SVSFlagsAsync (1) and SVSFPurgeBeforeSpeak (2).  If you want to 'queue' multiple phrases change the parameter to ''1'' and move the 'waiting' loop to just before the **PROC_releaseobject()**: 
 + 
 +<code bb4w>
         REM. Text-to-speech demonstration program using COMLIB         REM. Text-to-speech demonstration program using COMLIB
         REM. R.T.Russell, 24-Apr-2007         REM. R.T.Russell, 24-Apr-2007
Line 49: Line 53:
         DEF FNisspeaking(tts%)         DEF FNisspeaking(tts%)
         = FN_getvaluestr(tts%,"Status.RunningState") <> "1"         = FN_getvaluestr(tts%,"Status.RunningState") <> "1"
-\\ +</code> 
 + 
 ===== COM object method ===== ===== COM object method =====
-\\  The **PROC_voice_speak()** routine returns immediately and the **FN_voice_status()** function allows the current status to be polled so you can discover when the speech is finished:\\ \\ + 
 +The **PROC_voice_speak()** routine returns immediately and the **FN_voice_status()** function allows the current status to be polled so you can discover when the speech is finished: 
 + 
 +<code bb4w>
         REM. Text-to-speech demonstration program: asynchronous         REM. Text-to-speech demonstration program: asynchronous
         REM. Richard Russell, 18-Apr-2012         REM. Richard Russell, 18-Apr-2012
Line 116: Line 125:
         SYS !(!V%+8), V%         SYS !(!V%+8), V%
         ENDPROC         ENDPROC
 +</code>
asynchronous_20speech.1522502346.txt.gz · Last modified: 2024/01/05 00:18 (external edit)