FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Voices
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Voices
Posted: Sun Jun 09, 2013 08:43 PM
Listing available voices:

Code (fw): Select all Collapse
#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
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Voices
Posted: Sun Jun 09, 2013 08:47 PM
Earing the descriptions

Code (fw): Select all Collapse
// 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 nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Voices
Posted: Sun Jun 09, 2013 10:01 PM

SAPI.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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Voices
Posted: Sun Jun 09, 2013 11:50 PM
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Voices
Posted: Mon Jun 10, 2013 07:28 AM
To make it read an external file:

Code (fw): Select all Collapse
#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 nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Voices
Posted: Mon Jun 10, 2013 07:39 AM
Here you have new voices for different languages that work really fine:

http://www.freedomscientific.com/downloads/RealSpeak-Solo-Direct-Voices/RealSpeak-Solo-Direct-Downloads.asp

They work fine on a Windows 8 32 bits. On a Windows 8 64 bits I have not been able to install them. If you are able to install them and use them, please share it :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Voices
Posted: Mon Jun 10, 2013 07:40 AM

With this FiveWin app (full source provided) you can make your app "talk" the text of a PDF:

viewtopic.php?f=6t=26511p=146422#p146422

&&

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Voices
Posted: Mon Jun 10, 2013 08:00 AM
If you want the computer to listen to what the user says, you can easily use the google voice recognition controls:

http://blogs.sitepointstatic.com/examples/tech/speech-input/index.html

html:
Code (fw): Select all Collapse
<input type="text" x-webkit-speech />
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Voices
Posted: Mon Jun 10, 2013 08:23 AM
Convert a text or a file into wav file:

Code (fw): Select all Collapse
#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 nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Voices
Posted: Mon Jun 10, 2013 10:38 AM
In order to install new voices, you have to install the Speech SDK 51 first:

http://www.microsoft.com/en-us/download/details.aspx?id=10121
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
Re: Voices
Posted: Thu Jun 13, 2013 11:27 PM

Antonio;

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.

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Voices
Posted: Fri Jun 14, 2013 06:29 AM

Reinaldo,

See this:

viewtopic.php?p=146429#p146429

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: Voices
Posted: Fri Jun 14, 2013 01:50 PM

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 Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Voices
Posted: Fri Jun 14, 2013 04:46 PM

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)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Voices
Posted: Fri Jun 14, 2013 04:47 PM

Tim,

You could use TRY ... CATCH ... END to control if voice is supported on a computer

regards, saludos

Antonio Linares
www.fivetechsoft.com