Jouke Visser > Win32-SAPI5 > Win32::SAPI5

Download:
Win32-SAPI5-0.05.tar.gz

Dependencies

Annotate this POD

Related Modules

Win32::OLE
Win32::MSAgent
more...
By perlmonks.org

CPAN RT

New  1
Open  1
View/Report Bugs
Module Version: 0.05   Source  

NAME ^

Win32::SAPI5 - Perl interface to the Microsoft Speech API 5.1

SYNOPSIS ^

    use Win32::SAPI5;
    
    my $object = Win32::SAPI5::SpVoice->new();
    my $object = Win32::SAPI5::SpNotifyTranslator->new();
    my $object = Win32::SAPI5::SpObjectTokenCategory->new();
    my $object = Win32::SAPI5::SpObjectToken->new();
    my $object = Win32::SAPI5::SpResourceManager->new();
    my $object = Win32::SAPI5::SpStreamFormatConverter->new();
    my $object = Win32::SAPI5::SpMMAudioEnum->new();
    my $object = Win32::SAPI5::SpMMAudioIn->new();
    my $object = Win32::SAPI5::SpMMAudioOut->new();
    my $object = Win32::SAPI5::SpRecPlayAudio->new();
    my $object = Win32::SAPI5::SpStream->new();
    my $object = Win32::SAPI5::SpSharedRecoContext->new();
    my $object = Win32::SAPI5::SpInprocRecognizer->new();
    my $object = Win32::SAPI5::SpSharedRecognizer->new();
    my $object = Win32::SAPI5::SpLexicon->new();
    my $object = Win32::SAPI5::SpUnCompressedLexicon->new();
    my $object = Win32::SAPI5::SpCompressedLexicon->new();
    my $object = Win32::SAPI5::SpPhoneConverter->new();
    my $object = Win32::SAPI5::SpNullPhoneConverter->new();
    my $object = Win32::SAPI5::SpTextSelectionInformation->new();
    my $object = Win32::SAPI5::SpPhraseInfoBuilder->new();
    my $object = Win32::SAPI5::SpAudioFormat->new();
    my $object = Win32::SAPI5::SpWaveFormatEx->new();
    my $object = Win32::SAPI5::SpInProcRecoContext->new();
    my $object = Win32::SAPI5::SpCustomStream->new();
    my $object = Win32::SAPI5::SpFileStream->new();
    my $object = Win32::SAPI5::SpMemoryStream->new();

DESCRIPTION ^

This module is a simple interface to the Microsoft Speech API 5.1 There are interfaces to all classes that this API consists of. The constructors return Win32::OLE objects, on which you can call all methods and get/set all properties.

This documentation won't offer the complete documentation for it, just download the Microsoft Speech API 5.1 SDK and read the part of the documentation that covers 'Automation' (since we're using the Automation Object interface.

PREREQUISITES ^

The Microsoft Speech API 5.1. It can be downloaded for free from http://www.microsoft.com/speech (go to the 'old versions' and find the 5.1 version)

USAGE ^

See the Microsoft Speech API 5.1 documentation that comes with the SDK, except for the following utility methods available for Win32::SAPI5::SpVoice:

Win32::SAPI5::*

new

This is the constructor for each and every Win32::SAPI5 subclass. It does not take any parameters

GetObject

All classes support the GetObject method, which will return the actual Win32::OLE object. This can be useful when you need to pass the object itself as a parameter to a method of another object.

for example:

  # setup Microsoft Speech API
  my $stream = Win32::SAPI5::SpFileStream->new();
  $stream->Open($wav, 3, 0); # 3 = SSFMCreateForWrite

  my $voice = Win32::SAPI5::SpVoice->new();
  $voice->SetProperty(AudioOutputStream => $stream->GetObject);

Win32::SAPI5::SpVoice

To be somewhat compatible with Win32::SAPI4::VoiceText, I've added the utilitymethods that exist there to Win32::SAPI5::SpVoice, to be able to apply the same code to this API.

GetInstalledLanguages

This method returns a list of all installed languages with their countryname. It may look like ('Dutch (Netherlands)', 'Dutch (Belgium)', 'English (United States)', 'Portuguese (Brazil)'). Some speechengines might not return a languageID. In this case 'unknown' is returned.

GetInstalledVoices

This method takes a language as returned by GetInstalledLanguages and returns a list of all installed voices with their language. It may look like ('Adult female (Dutch)', 'Microsoft Sam (US English)')

Language2LanguageID

This method takes a language as returned by GetInstalledLanguages and returns the corresponding LanguageID that SpVoice knows. This also converts the 'unknown' that might be returned by GetInstalledLanguages back to a 0.

Voice2ModeID

This method takes a voice as returned by GetInstalledVoices and returns the corresponding ModeID that SpVoice knows.

SUPPORT ^

The Microsoft SAPI 5.1 SDK is supported on news://microsoft.public.speech_tech.sdk You can email the author for support on this module.

AUTHOR ^

        Jouke Visser
        jouke@cpan.org
        http://jouke.pvoice.org

COPYRIGHT ^

Copyright (c) 2004 Jouke Visser. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

SEE ALSO ^

perl(1), Microsoft Speech API 5.1 documentation.

syntax highlighting: