Recent

Author Topic: Speech from textbox  (Read 4737 times)

codeman

  • Jr. Member
  • **
  • Posts: 78
Speech from textbox
« on: July 19, 2012, 12:32:39 pm »
Hi , how to make speech from a textbox ?


Im using this code

Code: [Select]
procedure TForm1.Button1Click(Sender: TObject);
var
    SpVoice: Variant;
begin
    SpVoice := CreateOleObject('SAPI.SpVoice');
    SpVoice.Speak('bla bla', 0);
end;
Lazarus v2.02 Win10

avra

  • Hero Member
  • *****
  • Posts: 2539
    • Additional info
Re: Speech from textbox
« Reply #1 on: July 20, 2012, 09:49:03 am »
I guess your code is from here:
http://www.lazarus.freepascal.org/index.php/topic,3603.msg16903.html#msg16903

You can take a look at these posts:
http://www.lazarus.freepascal.org/index.php/topic,13401.msg70299.html#msg70299
http://stackoverflow.com/questions/3032739/delphi-sapi-text-to-speech
http://stackoverflow.com/questions/207653/text-to-speech-in-vista

You can also call espeak from the command line which would proabably be most cross platform and many languages friendly solution. I think I have seen somewhere a simple example for Lazarus but I could not find it now. This one is with different feature (creates WAV), but I am sure you can adapt it after studying espeak command line switches:
http://www.delphipages.com/forum/showthread.php?t=208598
http://espeak.sourceforge.net/commands.html

EDIT: I didn't find a simple one I was looking for, but here is another espeak example:
http://www.rolfware.de/delphi/espeak_example.html
« Last Edit: July 20, 2012, 10:12:00 am by avra »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

codeman

  • Jr. Member
  • **
  • Posts: 78
Re: Speech from textbox
« Reply #2 on: August 09, 2012, 12:57:33 am »
Thanks a lot .. i will take a look on those :)
Lazarus v2.02 Win10

Boleeman

  • Hero Member
  • *****
  • Posts: 897
Re: Speech from textbox
« Reply #3 on: March 22, 2025, 11:32:51 pm »
Came across an interesting typescript speech synthesizer source (which would probably drive someone crazy if used too often) at
https://github.com/chdh/pink-trombone-mod

A demonstration webpage showing it working is here:  https://chdh.github.io/pink-trombone-mod

jamie

  • Hero Member
  • *****
  • Posts: 6880
Re: Speech from textbox
« Reply #4 on: March 22, 2025, 11:47:40 pm »
I know I posted this before:

The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018