User Tools

Site Tools


setting_20speech_20parameters

Differences

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

Link to this comparison view

setting_20speech_20parameters [2018/03/31 13:19]
127.0.0.1 external edit
setting_20speech_20parameters [2018/04/15 12:53]
richardrussell Added syntax highlighting
Line 1: Line 1:
 =====Setting speech parameters===== =====Setting speech parameters=====
  
-//by Richard Russell, October 2008//\\ \\ //**This article is specific to the SAPI5 speech system, typically installed on Windows 2000, XP and Vista**//\\ \\  When using Windows'​ built-in speech synthesis capability it is possible to override the default **speed**, **volume** and **voice** parameters with your own preferences. There are two main ways of doing this; the first method (which is used in the supplied example program **SPEAK.BBC**) involves embedding //tags// in the text to be spoken, for example:\\ \\ +//by Richard Russell, October 2008//\\ \\ //**This article is specific to the SAPI5 speech system, typically installed on Windows 2000, XP and Vista**//\\ \\  When using Windows'​ built-in speech synthesis capability it is possible to override the default **speed**, **volume** and **voice** parameters with your own preferences. There are two main ways of doing this; the first method (which is used in the supplied example program **SPEAK.BBC**) involves embedding //tags// in the text to be spoken, for example: 
 + 
 +<code bb4w>
         speed$ = "<​RATE ABSSPEED='"​+STR$speed%+"'/>"​         speed$ = "<​RATE ABSSPEED='"​+STR$speed%+"'/>"​
         volume$ = "<​VOLUME LEVEL='"​+STR$volume%+"'/>"​         volume$ = "<​VOLUME LEVEL='"​+STR$volume%+"'/>"​
         voice$ = "<​VOICE REQUIRED='​NAME="​+name$+"'/>"​         voice$ = "<​VOICE REQUIRED='​NAME="​+name$+"'/>"​
         PROC_callmethod(tts%,​ "​Speak("""​+speed$+volume$+voice$+phrase$+"""​)"​)         PROC_callmethod(tts%,​ "​Speak("""​+speed$+volume$+voice$+phrase$+"""​)"​)
-Here **speed%** should be in the range -10 to +10, **volume%** should be in the range 0 to 100 and **name$** should be a voice name such as **Microsoft Mike** (see [[/​Listing%20available%20voices|this article]] for how to discover the available voices).\\ \\  As an alternative to specifying a particular voice you can express a preference for a male or female voice (if the choice is available):\\ \\ +</​code>​ 
 + 
 +Here **speed%** should be in the range -10 to +10, **volume%** should be in the range 0 to 100 and **name$** should be a voice name such as **Microsoft Mike** (see [[/​Listing%20available%20voices|this article]] for how to discover the available voices).\\ \\  As an alternative to specifying a particular voice you can express a preference for a male or female voice (if the choice is available): 
 + 
 +<code bb4w>
         speed$ = "<​RATE ABSSPEED='"​+STR$speed%+"'/>"​         speed$ = "<​RATE ABSSPEED='"​+STR$speed%+"'/>"​
         volume$ = "<​VOLUME LEVEL='"​+STR$volume%+"'/>"​         volume$ = "<​VOLUME LEVEL='"​+STR$volume%+"'/>"​
         voice$ = "<​VOICE OPTIONAL='​gender=female'/>"​         voice$ = "<​VOICE OPTIONAL='​gender=female'/>"​
         PROC_callmethod(tts%,​ "​Speak("""​+speed$+volume$+voice$+phrase$+"""​)"​)         PROC_callmethod(tts%,​ "​Speak("""​+speed$+volume$+voice$+phrase$+"""​)"​)
-\\  ​The second method involves direct calls to the speech system to set the appropriate parameters, for example:\\ \\ +</​code>​ 
 + 
 +The second method involves direct calls to the speech system to set the appropriate parameters, for example: 
 + 
 +<code bb4w>
         PROC_putvalue(tts%,​ "​Rate("​+STR$speed%+"​)"​)         PROC_putvalue(tts%,​ "​Rate("​+STR$speed%+"​)"​)
         PROC_putvalue(tts%,​ "​Volume("​+STR$volume%+"​)"​)         PROC_putvalue(tts%,​ "​Volume("​+STR$volume%+"​)"​)
Line 17: Line 27:
         PROC_putobject(tts%,​ "​Voice(O vobj%)"​)         PROC_putobject(tts%,​ "​Voice(O vobj%)"​)
         PROC_callmethod(tts%,​ "​Speak("""​+phrase$+"""​)"​)         PROC_callmethod(tts%,​ "​Speak("""​+phrase$+"""​)"​)
 +</​code>​
 +
 Note that this code requires **COMLIB** (or **COMLIBA**) version **3.3** or later, as supplied with //BBC BASIC for Windows// version 5.90a. Note that this code requires **COMLIB** (or **COMLIBA**) version **3.3** or later, as supplied with //BBC BASIC for Windows// version 5.90a.
setting_20speech_20parameters.txt · Last modified: 2018/04/15 12:53 by richardrussell