Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Type Library - MS Speech API 5.0

  1. #1
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    Type Library - MS Speech API 5.0

    I imported a type lib (Speech API 5.0 from MS) into Delphi. It created an unit for it I can use, but it doesn't create the components. In Delphi 7 I have nice components I can drop onto my form.

    Are they located somewhere else? Need I need to make the manually?
    NecroSOFT - End of line -

  2. #2

    Re: Type Library - MS Speech API 5.0

    Quote Originally Posted by NecroDOME
    I imported a type lib (Speech API 5.0 from MS) into Delphi. It created an unit for it I can use, but it doesn't create the components. In Delphi 7 I have nice components I can drop onto my form.

    Are they located somewhere else? Need I need to make the manually?
    i read somewhere than D6 has broken typelib importer, use unit from D7 or D5.
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

  3. #3
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    Type Library - MS Speech API 5.0

    I got Delphi 2005... sorry for not mentioning...
    NecroSOFT - End of line -

  4. #4

    Type Library - MS Speech API 5.0

    strange, maybe they broke something again :/
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

  5. #5
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    Type Library - MS Speech API 5.0

    Well... I could downgrade to Delphi 7, but i'll try to call it manually.
    NecroSOFT - End of line -

  6. #6

    Type Library - MS Speech API 5.0

    By the way, has anybody gotten the sapi 5.1 to work and save the playback stream to a wave file? in theory this should work:

    Code:
    var
      SpVoice: Variant;
      SPFS: Variant;
    begin
    
    SPFS:= CreateOleObject('SAPI.SpFileStream');
    SPFS.format.type:= 6;
    SPFS.open('c:\test.wav', SSFMCreateForWrite {6});
    
    SpVoice:= CreateOleObject('SAPI.SpVoice');
    SpVoice.AudioOutputStream:= SPFS;
    
    SpVoice.Speak('ROFL!', SVSFDefault);
    SPFS.close;
    But i get a member not found error for SpVoice.AudioOutputStream... any ideas? i am trying to implement SAPI for use with openal, and i need to store wave streams to file or memory to get them into openal, but nothing of this work..
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

  7. #7
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    Type Library - MS Speech API 5.0

    I once made a chat program with the speech API in delphi 7. Bit stupid the talk to your computer while it responds with some stupid answers
    NecroSOFT - End of line -

  8. #8

    Type Library - MS Speech API 5.0

    create spvoice component on your form and click true for autoconnect propertie
    ...
    public
    procedure SavewaveFile(filename: string;itext:string);
    ....

    [pascal]procedure TForm4.SavewaveFile(filename: string;itext:string);
    var
    TSW: TSpFileStream;
    begin
    TSW:=TSpFileStream.Create(self);
    TSW.Open(filename, SSFMcreateForWrite, false);
    SpVoice.AudioOutputStream:=TSW.DefaultInterface;
    Spvoice.Speak(itext, SVSFDefault);
    TSW.Close;
    end;[/pascal]

  9. #9

    Type Library - MS Speech API 5.0

    Quote Originally Posted by chrila
    create spvoice component on your form and click true for autoconnect propertie
    ...
    public
    procedure SavewaveFile(filename: string;itext:string);
    ....

    procedure TForm4.SavewaveFile(filename: string;itext:string);
    var
    TSW: TSpFileStream;
    begin
    TSW:=TSpFileStream.Create(self);
    TSW.Open(filename, SSFMcreateForWrite, false);
    SpVoice.AudioOutputStream:=TSW.DefaultInterface;
    Spvoice.Speak(itext, SVSFDefault);
    TSW.Close;
    end;
    can i have the header that you use? D4 does not create objects using this and TSpFileStream is undeclared, i have however tried the "DefaultInterface" method you shown with ole, and still get the same error. muyt be my outdated delphi version..
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

  10. #10

    Type Library - MS Speech API 5.0

    Have you imported activex component from sapi ?
    or imported type libraries? try twice
    that's created component spvoice, etc...

    here's my header :


    unit Unit4;

    //Uses SAPI 5.1 early bound Automation

    interface

    uses
    ActiveX,
    {$ifdef CONDITIONALEXPRESSIONS}
    Variants,
    {$endif}
    Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
    Dialogs, ImgList, ActnList, StdCtrls, ComCtrls, ToolWin, OleServer,
    SpeechLib_TLB, Buttons, jpeg, ExtCtrls, ComObj;

    type
    TForm4 = class(TForm)
    GroupBox1: TGroupBox;
    Label2: TLabel;
    Label7: TLabel;
    cbVoices: TComboBox;
    reText: TRichEdit;
    BitBtn1: TBitBtn;
    SpVoice: TSpVoice;
    Image2: TImage;
    savewav: TBitBtn;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure cbVoicesChange(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure savewavClick(Sender: TObject);
    private
    public
    filetospeak:string;
    procedure SavewaveFile(filename: string;itext:string);
    end;

    var
    form4: TForm4;

    implementation

    uses Unit2;

    {$R *.dfm}

    procedure TForm4.FormCreate(Sender: TObject);
    var
    I: Integer;
    SOToken: ISpeechObjectToken;
    SOTokens: ISpeechObjectTokens;
    begin
    //Ensure all events fire
    SpVoice.EventInterests := SVEAllEvents;
    SOTokens := SpVoice.GetVoices('', '');
    for I := 0 to SOTokens.Count - 1 do
    begin
    if (pos('Ellen',SOTokens.Item(i).id)>0) or
    (pos('Virg',SOTokens.Item(i).id)>0) then
    begin
    //For each voice, store the descriptor in the TStrings list
    SOToken := SOTokens.Item(I);
    cbVoices.Items.AddObject(SOToken.GetDescription(0) , TObject(SOToken));
    //Increment the descriptor reference count to ensure it doesn't get destroyed
    SOToken._AddRef;
    end
    end;
    if cbVoices.Items.Count > 0 then
    begin
    cbVoices.ItemIndex := 0; //Select 1st voice
    cbVoices.OnChange(cbVoices); //& ensure OnChange triggers
    end;
    end;

    procedure TForm4.FormDestroy(Sender: TObject);
    var
    I: Integer;
    begin
    //Release all the voice descriptors
    for I := 0 to cbVoices.Items.Count - 1 do
    ISpeechObjectToken(Pointer(cbVoices.Items.Objects[I]))._Release;
    end;

    procedure TForm4.cbVoicesChange(Sender: TObject);
    var
    SOToken: ISpeechObjectToken;
    begin

    SOToken := ISpeechObjectToken(Pointer(
    cbVoices.Items.Objects[cbVoices.ItemIndex]));
    SpVoice.Voice := SOToken;


    end;

    procedure TForm4.BitBtn1Click(Sender: TObject);
    begin
    SpVoice.Rate := 0;
    SpVoice.Volume := form2.volume;
    SpVoice.Speak(reText.Text, SVSFlagsAsync)
    end;

    procedure TForm4.savewavClick(Sender: TObject);
    var i:integer;
    f:string;
    begin
    SpVoice.Rate := 0;
    SpVoice.Volume := form2.volume;
    randomize();
    i:=random(1000);
    while i=0 do
    i:=random(1000);
    f:='d:\'+inttostr(i)+'tempwavfile.wav';
    while fileexists(f) do
    begin
    i:=random(1000);
    while i=0 do i:=random(1000);
    f:='d:\'+inttostr(i)+'tempwavfile.wav';
    end;
    savewavefile(f,reText.text);
    filetospeak:=f;


    end;


    procedure TForm4.SavewaveFile(filename: string;itext:string);
    var
    TSW: TSpFileStream;
    begin
    TSW:=TSpFileStream.Create(self);
    TSW.Open(filename, SSFMcreateForWrite, false);
    SpVoice.AudioOutputStream:=TSW.DefaultInterface;
    Spvoice.Speak(itext, SVSFDefault);
    TSW.Close;
    end;



    end.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •