Speech synthesis: Difference between revisions

m
→‎{{header|REXX}}: added/changed whitespace and comments, changed comments in the REXX section header.
m (Added the Sidef language)
m (→‎{{header|REXX}}: added/changed whitespace and comments, changed comments in the REXX section header.)
Line 202:
=={{header|REXX}}==
{{works with|Windowx/XP or later}}
Programming note:   This REXX program uses a freeware program   NIRCMD   to interface with the Microsoft Windows speech synthesizer program   '''SAM''',   a text to speech using a male voice.   SamSAM can possibly be configured to use other voices with later releases of Windows.   More recent Microsoft Windows have another speech synthesizer program:   ANNA.
<lang rexx>/*REXX pgmprogram uses a CLIC.L. cmdcommand to invoke Windows/XP SAM for speech synthesis.*/
parse arg t; t=space(t) /*get the (optional) text from CLthe C.L.*/
if t=='' then exit signal done /*Nothing to say? Then exit pgmprogram.*/
 
homedrive=value('HOMEDRIVE',,'SYSTEM') /*get HOMEDRIVE location of \TEMP*/
tmp homedrive=value('TEMPHOMEDRIVE',,'SYSTEM') /*get " HOMEDRIVE location TEMPof directory name.\TEMP */
tmp =value('TEMP',,'SYSTEM') /* " TEMP directory name. */
if homedrive=='' then homedrive='C:' /*use default if none found. */
if tmphomedrive=='' then tmphomedrive=homedrive'\TEMPC:' /*use " " " " "the default if none was found. */
if tmp=='' then tmp=homedrive'\TEMP' /* " " " " " " " /*code could be added here to get*/
/*acode uniquecould namebe foradded thehere TEMPto get a file···*/
tFN='SPEAK_IT'; tFT='$$$' /*use this··· unique name for the TEMP's fileID file.*/
tFIDtFN=homedrive||'\TEMP\SPEAK_IT'; || tFN"."tFT='$$$' /*createuse tempthis name for the output TEMP's fileID.*/
tFID=homedrive||'\TEMP\' || tFN"."tFT /*create temporary name for the output.*/
call lineout tFID,t /*write text──►a temp output file*/
call lineout tFID ,t /*closewrite thetext file──► justtemporary tooutput be neatfile.*/
'NIRCMD'call lineout tFID "speak file" tFID /*NIRCMD invokesclose the MSoutput file just to Sambe voiceneat*/
'ERASENIRCMD' tfid "speak file" tFID /*cleanNIRCMD up (delete)invokes theMicrosoft's TEMPSam filevoice*/
'ERASE' tFID /*clean up (delete) the TEMP /*stick a fork in it, we're donefile.*/</lang>
 
done: /*stick a fork in it, we're all done. */</lang>
Note: &nbsp; The name of the above REXX program is &nbsp; '''speak.rex'''<br>
'''usage''' &nbsp; using the command:
<pre>
<pre>speak This is an example of speech synthesis.
</pre>