Page 1 of 1

Speech engine - Text to speech - Talking clock

Posted: Mon Dec 03, 2012 7:42 am
by tektoog
Hey all,
This is my first post on this forum.
This little project is a talking clock TekTooG

Re: Speech engine - Text to speech - Talking clock

Posted: Mon Dec 03, 2012 8:48 am
by Jay
wow thank very much for this demo Tektoog i will have a play with it today! :D

what I would like to do is get the resulting speech into flowstone for further processing and create some kind of bizarre speech instrument! lol I don't know if that is possible but it sounds fun!

Best Regards

Re: Speech engine - Text to speech - Talking clock

Posted: Mon Dec 03, 2012 9:52 am
by trogluddite
Welcome to FS, tektoog, nce to see you.
Cool example too! :D

Re: Speech engine - Text to speech - Talking clock

Posted: Mon Dec 03, 2012 4:32 pm
by ccpurno
vey cool proof of concept!

could this be done directly through ruby?

to prevent the need to run as admin and open up possibilities for vocal effect generator plugins etc.

CC

Re: Speech engine - Text to speech - Talking clock

Posted: Tue Dec 04, 2012 2:10 pm
by unkargherth
@ccpurno: .. i'm trying

Ok firts try..... DON'T WORKS

Scenario i'm trying to amll MS TTS via OLE Automation ( or so I think). Afeter some hour of digging the web i came up with the following. I'm stuck because i'm NOT a windows programer ( i came fom unix world), so i post here hoping some MS Guru is able to finish it, or, at least give me some directions

Code: Select all

require "Win32API"
# CLSID_SpVoice as per http://grokbase.com/t/python/python-list/092cy5hgm7/tts-in-windows
CLSID_SpVoice="96749377-3391-11D2-9EE3-00C04F797396"
# CLSCTSX_ALL as per http://msdn.microsoft.com/en-us/library/windows/desktop/ms686615%28v=vs.85%29.aspx
CLSCTX_ALL=23 #(0x17)
#IID_ISpVoice as per (where the hell its that "DEFINED")
#http://www.masmforum.com/board/index.php?topic=17911.0
#IID_ISpVoice  GUID <06C44DF74h, 072B9h, 04992h, <0A1h, 0ECh, 0EFh, 099h, 06Eh, 004h, 022h, 0D4h>>
IID_ISpVoice="6C44DF74-72B9-4992-A1EC-EF996E0422D4"

def doit

   #api = Win32API.new('user32','MessageBox',['L', 'P', 'P', 'L'],'I') 
   #api.call 0,"Hello Win!!","Alert",0
   begin
      # Initialize COM
      api=Win32API.new("ole32", "CoInitialize", ['P'] , 'I')
      api.call(0)
      
      # Create Voice Interface Object
      pVoice= '\0'*8
      # CoCreateInstance ( CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void**)&Voice );
      api=Win32API.new("ole32", "CoCreateInstance", ["P","P","I","P","PP"],"P")
      hOLE=api.call(CLSID_SpVoice, nil, CLSCTX_ALL, IID_ISpVoice, pVoice )
      watch "OLE" ,hOLE
      watch "pvoice", pVoice
=begin
      # TODO
       # Speak!
       # Voice -> Speak ( L"Hello World!!!", SPF_DEFAULT, NULL );
       # Not sure about it
       api= Win32API.new("sapi","Speak",["P","P","P"],"V")
       @aLines.each { |x|
         api.call(x,0,nil)
      }      

       #TODO
       # Shutdown the voice
       # Voice -> Release(); Voice = NULL if pVoice != nil
=end
       # Shutdown COM
       # CoUninitialize ();      
       api=Win32API.new("ole32", "CoUninitialize", ['P'] , 'I')
       api.call(0)
   rescue Exception => e
      watch e.message
      watch "Exception", e.backtrace.inspect
   end
end


The problem is That the call to Win32API for CoCreateInstance is returning a void pVoice pointer and unknown error (2147746132 is an error code, isn't it?) and i don't know how to continue from here


Any help would be appreciated

Re: Speech engine - Text to speech - Talking clock

Posted: Wed Dec 05, 2012 7:28 pm
by tektoog
Hey,
Thanks for your comments guys ;)
How come I don't have forum notifications in my email like with the SM forum?
Edit: I guess I had to subscribe to the topic :oops:

Re: Speech engine - Text to speech - Talking clock

Posted: Thu Dec 06, 2012 6:07 am
by Tronic
You could take a cue from here.
https://github.com/djberg96/win32-sapi

Re: Speech engine - Text to speech - Talking clock

Posted: Fri Dec 07, 2012 10:35 am
by unkargherth
@Tronic: Thanks for the info. I've been digging around there and there's a lot of useful info. Anyway, without beign able to use "gems" i will need a bunch of time to investigate inside the win32-api ( not WIn32API) structure and hierarchy before being able to use it inside FS3

Re: Speech engine - Text to speech - Talking clock

Posted: Sun Oct 06, 2013 11:18 am
by tester
Something talks here.

Questions:
How to change speaking voice? (how to get list of voices in the system?)
How to change properties of speaking voice?

In other words - how to integrate fully operational TTS into FS app?