• last update at 18.10.2006, any questions mailto:wtwsoft@yandex.ru, ICQ: 225-410-492

  • Russian language version of this page

    SAPI DLL Open Source for easy Speech API access[GNU GPL]
    (copyleft) Denis Kirin http://sourceforge.net/projects/sapidll please use the link to speedily download

    I need help for edit my English (and any languages) pages

    SAPI_DLL released for easy MS Speech API (version 4 and 5) access.


    Download SAPI_DLL v1.2 + Source Code + Call Samples
    Download SAPIDLL v2.0 (beta) + Source Code
    Download SAPIDLL v2.1 (beta) + Source Code
    C# call demo

    27.10.2006 v2.1 beta release - SAPI 4 and SAPI 5 + SAPI Events
    For easy and fast include Speech to your Win32 application you can use SAPIDLL API.
    I give you all source code and my personal support, if you have problem with library, just ask my on email or ICQ.

    How to using SAPIDLL.
    All new version safe old version API, then new version of the library is compatible with old. The SAPI 5 including in version 2.x is transparent to call for your Application, the means you call SAPI 5 engines like SAPI 4 without any different.

    Content:
    1.Vision.
    2.License and warranty.
    3.Some library files descriptions.
    4.The SAPIDLL API SDK.
    4.1.API added in version 1.2 (for non Delphi compiler call futures)
    4.2.API added in version 2.1 (add SAPI 4,5 events callback futures)

    1. Vision.
    The goal of this project is make MS Speech API access easy for developers, because problem is - using COM, Engine manipulation, SAPI 4 and SAPI 5 interface difference. Call COM from Assembler or FreeBASIC it is cool, but usually developers need add speech to application like UI futures, and it is big price work with COM for only one speech including. Then simply use SAPIDLL, and if the library not have futures to you, just call me and if it possible I add the needed futures. I think all win with it.

    2. License and warranty.
    SAPIDLL is GNU GPL copyleft software. The library not release any file system or Internet access futures, then the secure to use it. But it work with COM Interfaces and Speech Engines, I can guaranty what the engines and Interfaces do in you system. Please use original version and sources from this site.

    3. Some library files descriptions (version 2.1).
    SAPIDLL.DLL - the library, and they don't need any files for work.
    Folder Source - the library sources codes for compile with Delphi 7. Do not forget using dcc32.exe (Delphi Console Compiler for Win32 platform)
    Source\SAPIINTERFACE.PAS - the interface unit for call the library from other Delphi application.
    Folder Delphi 7 - how to use library with Delphi 7 source.
    Folder Assembler - how to call with Assembler (TASM), the source is for version 1.2, rename the other library version from SAPIDLL.DLL to SAPI_DLL.DLL

    Use link on top on this page to see call samples to other compilers, the is not include to source packet because it is to do this packet too bigger.

    4. The SAPIDLL API SDK.
    All API is STDCALL
    function CreateSpeech:HResult;
    Check SAPI 4 and 5 interfaces on your system, you need to call it first. Remember in clean Windows 98 the Speech interfaces not exists, in Windows NT 5.x the SAPI 5 interface is present and default. Please do not forget the SAPI interface and Speech engines is different things, you can have Interfaces on you system, but not have any engines, than you can't call the Speech. If Speech API initialization is OK - function return 0.

    procedure PSpeak(var PText : longword);
    Speak the ASSCIZ string in PText address.

    procedure Speak( Text : string);stdcall;
    Speak Text string on the select engine (Inject text to speech engine). For Delphi call, for other compiler better use PSpeak.

    procedure SelectEngine(EngineName: String);stdcall;
    Select the Speech engine by name. See EngineList to know how get list of names of all exists speech engines.

    function GetEngineInfo(EngineName: String; var Info: TSpeechEngineInfo):byte;stdcall;
    Return Engine information record, see Info record for more details in Source\SAPIINTERFACE.PAS.

    Info record values:
    Name: String; The speech engine name
    Language: String; Language (btw - "Nature" real use how English, not how nature)
    Manufacturer: String; Manufacturer ID
    Speaker: String; Speaker name (not Engine name, one Engine can have many Speaker)
    MaxPitch: Word; I think Pitch, Speed and Volume understanding without comments :)
    MinPitch: Word;
    MaxSpeed: Longword;
    MinSpeed: Longword;
    MaxVolume: Longword;
    MinVolume: Longword;

    function GetEngines:TStrings;
    Return list of exists Speech Engine Names. The Delphi TStringList class, that is problem call it from other compiler, sorry. The engines selected by Name from this list, or by order number in it list.

    function GetPitch: Word;
    Get current engine pitch value, the engine must be select before call this function.

    function GetSpeed: Dword;
    Get current engine speed value, the engine must be select before call this function.

    function GetVolume: Dword;
    Get current engine volume value, the engine must be select before call this function.

    procedure SetPitch(const Value: Word);
    Select the Pitch, do not forget see the engine info (call GetEngineInfo function) Maximum and Minimum Pitch values before select new value.

    procedure SetSpeed(const Value: Dword);
    procedure SetVolume(const Value: Dword);

    So, this is Speed and Volume call it like Pitch.

    function GetMaxPitch: Word;stdcall;
    function GetMaxSpeed: Dword;stdcall;
    function GetMaxVolume: Dword;stdcall;
    function GetMinPitch: Word;stdcall;
    function GetMinSpeed: Dword;stdcall;
    function GetMinVolume: Dword;stdcall;
    This group is duplicate call GetEngineInfo function.

    Procedure Pause;stdcall;
    Take the pause ON

    Procedure Resume;stdcall;
    Resume paused speech.

    Procedure Stop;stdcall;
    Stop and clear speak volley.

    procedure DestroySpeech;
    Destroy the speech interfaces, free memory. Call befire your application is close.

    4.1 API added in version 1.2
    function GetEnginesCount:word;
    Get exists speech engines count. It is for other compilers, who can't work with Delphi TStringList class.

    procedure PSelectEngine(EngineName: LPCTSTR);stdcall;
    Select engine by name, where name is pointer to ASCIIZ string.

    procedure PSelectEngineNumber(EngineNumber: word);stdcall;
    Select engine by number, see GetEngineCount.

    function PGetEngines( number : word):LPCTSTR;stdcall;
    Get engine name with Number. Use PGetEngines(0..GetEnginesCount-1) to get names all exists engines for non Delphi compilers.

    4.2. API added in version 2.1
    In version 2.1 is addes the Speech API 4, 5 events (call back API). It is help you to do goot speech UI.

    The CALLBACK API prototipes:
    TSpeechEvent = procedure; procedure without parametrs
    TPositionEvent = procedure(Position: dword); one dword parametr
    TEngineEvent = procedure(Number: integer; Name: string); two parametrs, with Delphi string
    TErrorEvent = procedure(Text: string); one parametr with string (it is Delphi string)

    The regist API:
    procedure RegistOnStart(CallbackAddr: TSpeechEvent);
    When engine start speaking.

    procedure RegistOnPause(CallbackAddr: TSpeechEvent);
    When user paused engine.

    procedure RegistOnResume(CallbackAddr: TSpeechEvent);
    When user resume speech after pause.

    procedure RegistOnStop(CallbackAddr: TSpeechEvent);
    When engine Stop, that means the engine fully speak all injected text and ready to read next part of text. This is one way to speak big text (read books how example). Because if you send big part of text to engine they is slowdown system and thinking lot of more time, that is not good.

    procedure RegistOnUserStart(CallbackAddr: TSpeechEvent);
    When user start speaking, the Speak API is call.

    procedure RegistOnUserStop(CallbackAddr: TSpeechEvent);
    When user Stop speech, that means call Stop API, please do not confuse with Stop event when text is done. So, if engine complete speaking text you application is get Stop event, when you application call Stop API then they get UserStop event.

    procedure RegistOnPosition(CallbackAddr: TPositionEvent);
    Get the current speak position in text (chars from begin of last injected Speaking text)

    procedure RegistOnSpeed(CallbackAddr: TPositionEvent);
    When speed is changed

    procedure RegistOnVolume(CallbackAddr: TPositionEvent);
    When Volume is changed

    procedure RegistOnPitch(CallbackAddr: TPositionEvent);
    When Pitch is changed

    procedure RegistOnSelectEngine(CallbackAddr: TEngineEvent);
    When new engine select

    procedure RegistOnStatusChange(CallbackAddr: TSpeechEvent);
    When engine change status, more calls (rely don't use for non debug versions)

    procedure RegistOnError(CallbackAddr: TErrorEvent);stdcall;
    When SAPIDLL error happens.

    Please contact me
    Have a nice Windows.
    Сайт создан в системе uCoz