Voices

Voices

Postby Antonio Linares » Sun Jun 09, 2013 8:43 pm

Listing available voices:

Code: Select all  Expand view
#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
User avatar
Antonio Linares
Site Admin
 
Posts: 41414
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Voices

Postby Antonio Linares » Sun Jun 09, 2013 8:47 pm

Earing the descriptions

Code: Select all  Expand view
// 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
User avatar
Antonio Linares
Site Admin
 
Posts: 41414
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Voices

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 41414
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Voices

Postby Antonio Linares » Sun Jun 09, 2013 11:50 pm

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41414
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Voices

Postby Antonio Linares » Mon Jun 10, 2013 7:28 am

To make it read an external file:

Code: Select all  Expand view
#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
User avatar
Antonio Linares
Site Admin
 
Posts: 41414
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Voices

Postby Antonio Linares » Mon Jun 10, 2013 7: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41414
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Voices

Postby Antonio Linares » Mon Jun 10, 2013 7:40 am

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

viewtopic.php?f=6&t=26511&p=146422#p146422
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41414
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Voices

Postby Antonio Linares » Mon Jun 10, 2013 8: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: Select all  Expand view
<input type="text" x-webkit-speech />
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41414
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Voices

Postby Antonio Linares » Mon Jun 10, 2013 8:23 am

Convert a text or a file into wav file:

Code: Select all  Expand view
#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
User avatar
Antonio Linares
Site Admin
 
Posts: 41414
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Voices

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 41414
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Voices

Postby reinaldocrespo » 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.
User avatar
reinaldocrespo
 
Posts: 972
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: Voices

Postby Antonio Linares » Fri Jun 14, 2013 6:29 am

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41414
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Voices

Postby TimStone » Fri Jun 14, 2013 1: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
User avatar
TimStone
 
Posts: 2909
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Voices

Postby Antonio Linares » Fri Jun 14, 2013 4: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41414
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Voices

Postby Antonio Linares » Fri Jun 14, 2013 4: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41414
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 29 guests