User Tools

Site Tools


speech_20synthesis_20_28lbb_29

Differences

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

Link to this comparison view

speech_20synthesis_20_28lbb_29 [2018/03/31 13:19]
127.0.0.1 external edit
speech_20synthesis_20_28lbb_29 [2018/04/17 18:53] (current)
tbest3112 Added syntax highlighting
Line 2: Line 2:
  
 //by Richard Russell, November 2015//\\ \\  The program below illustrates the use of the **speak** sub; it is compatible with both LB and LBB. Note that it is necessary to declare **speechInit** as global:\\ \\  //by Richard Russell, November 2015//\\ \\  The program below illustrates the use of the **speak** sub; it is compatible with both LB and LBB. Note that it is necessary to declare **speechInit** as global:\\ \\ 
 +<code lb>
      '​ LB speech synthesis without a helper DLL!      '​ LB speech synthesis without a helper DLL!
      '​ by Richard Russell, 26-Mar-2012      '​ by Richard Russell, 26-Mar-2012
Line 57: Line 58:
                       wtext$ as ptr, 0 as long, 0 as long, r as long                       wtext$ as ptr, 0 as long, 0 as long, r as long
      end sub      end sub
 +</​code>​
 The default voice is used; it may be a male or female voice depending on the version of Windows. If you prefer to specify the gender (assuming both a male and a female voice are installed, which may not always be the case) you can insert '​tags'​ in the string to achieve that:​\\ ​ The default voice is used; it may be a male or female voice depending on the version of Windows. If you prefer to specify the gender (assuming both a male and a female voice are installed, which may not always be the case) you can insert '​tags'​ in the string to achieve that:​\\ ​
 +<code lb>
      data "<​voice optional='​gender=female'>​This is a demonstration of speech synthesis</​voice>"​      data "<​voice optional='​gender=female'>​This is a demonstration of speech synthesis</​voice>"​
      data "<​voice optional='​gender=male'>​using Liberty BASIC code without a helper DLL</​voice>"​      data "<​voice optional='​gender=male'>​using Liberty BASIC code without a helper DLL</​voice>"​
      data ""​      data ""​
 +</​code>​
 It is also possible to control the speed and the volume in a similar way:​\\ ​ It is also possible to control the speed and the volume in a similar way:​\\ ​
 +<code lb>
      data "<​rate absspeed = '​4'>​This is a demonstration of speech synthesis</​rate>"​      data "<​rate absspeed = '​4'>​This is a demonstration of speech synthesis</​rate>"​
      data "<​volume level = '​50'>​using Liberty BASIC code without a helper DLL</​voice>"​      data "<​volume level = '​50'>​using Liberty BASIC code without a helper DLL</​voice>"​
      data ""​      data ""​
 +</​code>​
 The speed should be specified as a value between -10 and +10, and the volume as a value between 0 and 100.\\ \\  This alternative format for the tags may also be used:​\\ ​ The speed should be specified as a value between -10 and +10, and the volume as a value between 0 and 100.\\ \\  This alternative format for the tags may also be used:​\\ ​
 +<code lb>
      data "<​rate absspeed = '​4'/>​This is a demonstration of speech synthesis"​      data "<​rate absspeed = '​4'/>​This is a demonstration of speech synthesis"​
      data "<​volume level = '​50'/>​using Liberty BASIC code without a helper DLL"      data "<​volume level = '​50'/>​using Liberty BASIC code without a helper DLL"
      data ""​      data ""​
 +</​code>​
 \\  If you want to select a specific SAPI5 voice (and you know it is installed on your PC) you can do that as follows:​\\ ​ \\  If you want to select a specific SAPI5 voice (and you know it is installed on your PC) you can do that as follows:​\\ ​
 +<code lb>
      data "<​voice required='​name=IVONA 2 Brian OEM'>​This is a demonstration of speech synthesis</​voice>"​      data "<​voice required='​name=IVONA 2 Brian OEM'>​This is a demonstration of speech synthesis</​voice>"​
 +</​code>​
 In this case the voice selected is Ivona Brian (a British English male voice) which can be purchased from http://​www.textaloud.com/​ In this case the voice selected is Ivona Brian (a British English male voice) which can be purchased from http://​www.textaloud.com/​
speech_20synthesis_20_28lbb_29.txt ยท Last modified: 2018/04/17 18:53 by tbest3112