Speech engine - Text to speech - Talking clock

Post any examples or modules that you want to share here
Post Reply
User avatar
tektoog
Posts: 141
Joined: Sat Oct 30, 2010 11:49 pm
Location: Geneva - Switzerland

Speech engine - Text to speech - Talking clock

Post by tektoog »

Hey all,
This is my first post on this forum.
This little project is a talking clock TekTooG
Last edited by tektoog on Thu Jul 24, 2014 2:07 pm, edited 1 time in total.
"Essential random order for chaotic repetitive sequences"
Jay
Posts: 276
Joined: Tue Jul 13, 2010 5:42 pm

Re: Speech engine - Text to speech - Talking clock

Post 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
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Speech engine - Text to speech - Talking clock

Post by trogluddite »

Welcome to FS, tektoog, nce to see you.
Cool example too! :D
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
ccpurno
Posts: 14
Joined: Tue Nov 28, 2006 7:15 pm
Location: NL

Re: Speech engine - Text to speech - Talking clock

Post 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
unkargherth
Posts: 29
Joined: Fri Apr 08, 2005 9:46 pm

Re: Speech engine - Text to speech - Talking clock

Post 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
Free your memory, .. with a free(). Like a pointer
Cast a pointer into an integer and it becomes the integer...
Cast a pointer into a struct and it becomes the struct...
A pointer can overflow... or can crash...
Be a pointer my friend
User avatar
tektoog
Posts: 141
Joined: Sat Oct 30, 2010 11:49 pm
Location: Geneva - Switzerland

Re: Speech engine - Text to speech - Talking clock

Post 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:
"Essential random order for chaotic repetitive sequences"
Tronic
Posts: 539
Joined: Wed Dec 21, 2011 12:59 pm

Re: Speech engine - Text to speech - Talking clock

Post by Tronic »

You could take a cue from here.
https://github.com/djberg96/win32-sapi
unkargherth
Posts: 29
Joined: Fri Apr 08, 2005 9:46 pm

Re: Speech engine - Text to speech - Talking clock

Post 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
Free your memory, .. with a free(). Like a pointer
Cast a pointer into an integer and it becomes the integer...
Cast a pointer into a struct and it becomes the struct...
A pointer can overflow... or can crash...
Be a pointer my friend
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: Speech engine - Text to speech - Talking clock

Post 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?
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
Post Reply