Speech synthesis: Difference between revisions

→‎{{header|REXX}}: added the REXX language. -- ~~~~
m (removed omit for REXX. -- ~~~~)
(→‎{{header|REXX}}: added the REXX language. -- ~~~~)
Line 155:
(speak "This is an example of speech synthesis.")
</lang>
 
=={{header|REXX}}==
{{works with|Windowx/XP or later}}
Programming note: &nbsp; This REXX program uses a freeware program NIRCMD to interface with the Microsoft Windows speech synthesizer program SAM, a text to speech male voice. &nbsp; Sam can be configured to use other voices. &nbsp; Later Microsoft Windows have another program: ANNA.
<lang rexx>/*REXX pgm uses a CLI cmd to invoke Windows/XP SAM for speech synthesis.*/
parse arg t; t=space(t) /*get the (optional) text from CL*/
if t=='' then exit /*Nothing to say? Then exit pgm.*/
homedrive=value('HOMEDRIVE',,'SYSTEM') /*get HOMEDRIVE location of \TEMP*/
tmp =value('TEMP',,'SYSTEM') /* " TEMP directory name. */
if homedrive=='' then homedrive='C:' /*use default if none found. */
if tmp=='' then tmp=homedrive'\TEMP' /* " " " " " */
/*code could be added here to get*/
/*a unique name for the TEMP file*/
tFN='SPEAK_IT'; tFT='$$$' /*use this for the TEMP's fileID.*/
tFID=homedrive||'\TEMP\' || tFN"."tFT /*create temp name for the output*/
call lineout tFID,t /*write text──�a temp output file*/
call lineout tFID /*close the file just to be neat.*/
'NIRCMD' "speak file" tFID /*NIRCMD invokes the MS Sam voice*/
'ERASE' tfid /*clean up (delete) the TEMP file*/
/*stick a fork in it, we're done.*/</lang>
Note: &nbsp; The name of the above REXX program is &nbsp; '''speak_it.rex'''<br>
'''usage''' &nbsp; using the command: &nbsp; <tt> speak_it This is an example of speech synthesis. </tt>
 
 
=={{header|Ruby}}==