Problem with MS SAPI 5.1 in PHP
| From: | Sabin Finateanu | Date: | Sat, 25 Jun 2005 11:43:27 +0000 |
| Subject: | Problem with MS SAPI 5.1 in PHP | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-26140@lists.php.net to get a copy of this message | ||
Hi! I got the following code:
<?php
function SpeakText($text)
{
$VoiceObj = new COM("SAPI.SpVoice");
// Voice ID: 1, 4
$VoiceObj->Voice = $VoiceObj->GetVoices()->Item(4);
$VoiceObj->Rate = "0";
$VoiceObj->Speak($text);
unset($VoiceObj);
}
?>
And the following error:
Fatal error: Uncaught exception 'com_exception' with message 'Error Member not found. ' in C:\Program Files\Apache Group\Apache2\htdocs\speech.php:7 Stack trace: #0 C:\Program Files\Apache Group\Apache2\htdocs\speech.php(7): SpeakText() #1 C:\Program Files\Apache Group\Apache2\htdocs\index.php(3): SpeakText('Welcome!') #2 {main} thrown in C:\Program Files\Apache Group\Apache2\htdocs\speech.php on line 7
Can anyone please help me? I don't understand why do I have this problem when setting the voice.
Best regards,
Sabin Finateanu.