#include "FiveWin.ch"
function Main()
local oVoice := TOleAuto():New( "Sapi.SPVoice" )
local voice
for each voice in oVoice:GetVoices()
MsgInfo( voice:GetDescription )
next
return nil#include "FiveWin.ch"
function Main()
local oVoice := TOleAuto():New( "Sapi.SPVoice" )
local voice
for each voice in oVoice:GetVoices()
MsgInfo( voice:GetDescription )
next
return nil// Listing voices
#include "FiveWin.ch"
function Main()
local oVoice := TOleAuto():New( "Sapi.SPVoice" )
local voice
for each voice in oVoice:GetVoices()
oVoice:Speak( voice:GetDescription )
next
return nilSAPI.SpVoice Properties:
'.Pause = pause speaking
'.resume = resume after pause
'.Rate = speed at which voice speaks
'.Voice = you can use set and a voice value to change the voice (if multiple exist on machine)
'.Volume = volume of voice (not system volume, just voice)
'.WaitUntilDone = wait until done
#include "FiveWin.ch"
function Main()
local oVoice := TOleAuto():New( "Sapi.SPVoice" )
oVoice:Speak( "c:\texto.txt", 4 ) // 4 means it is an external file
return nilWith this FiveWin app (full source provided) you can make your app "talk" the text of a PDF:
viewtopic.php?f=6t=26511p=146422#p146422
&&
<input type="text" x-webkit-speech />#include "FiveWin.ch"
#define SSFMCreateForWrite 3
function Main()
local oVoice := TOleAuto():New( "Sapi.SPVoice" )
local oFile := TOleAuto():New( "SAPI.SpFileStream.1" )
oFile:Open( "c:\reading.wav", SSFMCreateForWrite, .F. )
oVoice:AudioOutputStream = oFile
oVoice:Speak( "c:\text.txt", 4 )
oFile:Close()
return nilAntonio;
How about dictation? I mean, recording the user's voice dictating some text and saving that to some file. Then be able to play back the recording with rewind, ff, and pauses. Any recommendations?
Thank you,
Reinaldo.
I am just starting to play with this. It could be interesting. I would suggest we create a function in our code that we pass the text to so we don't leave the control open. For example, if you use voice in the Main( ) procedure, then the resource is open no matter what you are doing until you actually close the program. If you wish to just have a greeting, this can be problematic.
Also, on some older operating systems, calling the voice will lock up the computer. I have more research to do on this, but within the function we could make sure we have a current OS that will support the call before trying to use it.
Tim
Tim,
The idea is that if you are going to enable your app to talk to the user, then it will do it from many different places, thats why is clever to only use a oVoice object for all the app, intead of creating it and releasing it many times. I think it may work faster (I have not compared the speeds, its just my guess)
Tim,
You could use TRY ... CATCH ... END to control if voice is supported on a computer