|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-01-25 11:51 UTC] phanto@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 15:00:01 2025 UTC |
I am not sure if this is a PHP bug or my inexperience with MS SAPI 5.1, but I saw a similiar problem (ID 15205) that was not resolved. I am using PHP 4.3/Apache 2.0.43/W2K and I can not set the Voice property with an object variable. THE CODE: // This instantiates the object $VoiceObj = new COM("SAPI.SpVoice") or die("Unable to instantiate SAPI"); // Gets the available voices and prints them $VoicesToken=$VoiceObj->GetVoices(); $NumberofVoices=$VoicesToken->Count; For ($i=0;$i<$NumberofVoices;$i++) { $VoiceToken=$VoicesToken->Item($i); $VoiceName[$i]=$VoiceToken->GetDescription(); print "$VoiceName[$i]................Item Number: $i </br>"; } // Gets and prints the id of the specified voice $SelectedVoiceToken=$VoicesToken->Item(1); $SelectedVoiceTokenid=$SelectedVoiceToken->id; print "$SelectedVoiceTokenid</br>"; // Tries to SET the voice (but fails) $VoiceObj->Voice=$SelectedVoiceToken; $VoiceName=$VoiceObj->Voice->GetDescription(); print "$VoiceName</br>"; // This changes the rate of the selected voice $VoiceObj->Rate = "0"; $VoiceObj->Speak("Hello, welcome to my website"); unset($VoiceObj); THE RESULTS: Microsoft Mary................Item Number: 0 ATT DTNV 1.3 Crystal16................Item Number: 1 ATT DTNV 1.3 Mike................Item Number: 2 LH Michael................Item Number: 3 LH Michelle................Item Number: 4 ATT DTNV 1.3 Crystal................Item Number: 5 Microsoft Mike................Item Number: 6 Microsoft Sam................Item Number: 7 Sample TTS Voice................Item Number: 8 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\ATT-DT-13-Crystal16 Warning: main(): PropPut() failed: Member not found. in C:\talk.php on line59 Microsoft Mary Joe Londa