Recent

Author Topic: NSSpeechSynthesizer  (Read 8149 times)

kogs

  • New Member
  • *
  • Posts: 42
NSSpeechSynthesizer
« on: November 15, 2012, 02:57:53 pm »
Aphasia - http://en.wikipedia.org/wiki/Aphasia

NSSpeechSynthesizer - ?

"
uses
  Classes, SysUtils, ------(?)
"

"
procedure TBDoc.ButtonClick(ASender: TObject);
var
  ss : NSSpeechSynthesizer;
begin
showmessage('wewagawegea');
  ss := NSSpeechSynthesizer.Create; - ?
  ss.InitWithVoice('Hello world! How are you?'); - ?
end; 
"     

kogs 
(Aphasia - http://en.wikipedia.org/wiki/Aphasia)
Mac OS X 10.9.1


kogs

  • New Member
  • *
  • Posts: 42
Re: NSSpeechSynthesizer
« Reply #2 on: November 16, 2012, 01:19:24 pm »
C++ - no
pascal - yes

Patent - http://www.cipa.org.uk/

2005 - Aphasia

Mac OS X

kogs
(Aphasia - http://en.wikipedia.org/wiki/Aphasia)
Mac OS X 10.9.1

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: NSSpeechSynthesizer
« Reply #3 on: November 16, 2012, 01:22:22 pm »
must post shorter
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

jwdietrich

  • Hero Member
  • *****
  • Posts: 1232
    • formatio reticularis
Re: NSSpeechSynthesizer
« Reply #4 on: November 16, 2012, 09:50:00 pm »
It is not easy to understand your posting. "Filler words" in terrestrial languages are of similar importance like "begin", "end" or ";" in Pascal.

I assume that you want to use the text to speech capabilities of Mac OS X from Lazarus / Free Pascal.

The probably simplest way to do this is by writing:

Code: [Select]
var
  s: longint;
begin
  s := Shell('osascript -e ''say "Hello world! How are you?"''');
end;

The small demo application in the attachment implements this method in a flexible way.
« Last Edit: November 16, 2012, 10:26:52 pm by jwdietrich »
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.2.6 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

kogs

  • New Member
  • *
  • Posts: 42
Re: NSSpeechSynthesizer
« Reply #5 on: November 17, 2012, 08:22:31 am »
OK, OK, OK, etc.
(Aphasia - http://en.wikipedia.org/wiki/Aphasia)
Mac OS X 10.9.1

jwdietrich

  • Hero Member
  • *****
  • Posts: 1232
    • formatio reticularis
Re: NSSpeechSynthesizer
« Reply #6 on: November 17, 2012, 08:33:44 pm »
I just learned from BigChimp that shell is deprecated and to be replaced by fpSystem (see thread http://www.lazarus.freepascal.org/index.php/topic,8962.msg107253/).

Although Shell is still supported in Lazarus 1.0.2 it might be advisable to replace the code by

Code: [Select]
var
  s: longint;
begin
  s := fpSystem('osascript -e ''say "Hello world! How are you?"''');
end;

A new version of the demo application is attached.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.2.6 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

kogs

  • New Member
  • *
  • Posts: 42
Re: NSSpeechSynthesizer
« Reply #7 on: November 18, 2012, 02:58:27 pm »
ok
(Aphasia - http://en.wikipedia.org/wiki/Aphasia)
Mac OS X 10.9.1

 

TinyPortal © 2005-2018