public function read($text)
    {
        $initializeOptions = $this->getOptions()->getInitializeOptions();
        $pollyClient = new PollyClient([
            'version' => $initializeOptions->getVersion(),
            'region' => $initializeOptions->getRegion(),
            'credentials' => [
                'key' => $initializeOptions->getCredentials()->getKey(),
                'secret' => $initializeOptions->getCredentials()->getSecret()
            ]
        ]);

        $synthesizeOptions = [
            'OutputFormat' => $this->getOptions()->getOutputFormat(),
            'Text' => $text,
            'TextType' => $this->getOptions()->getTextType(),
            'VoiceId' => $this->getOptions()->getVoiceId(),
            'VoiceLanguageCode' => $this->getOptions()->getLanguage(),
            'SampleRate' => $this->getOptions()->getSampleRate(),
        ];
        if (!empty($this->getOptions()->getLexiconNames())) {
            $synthesizeOptions['LexiconNames'] = $this->getOptions()->getLexiconNames();
        }

        $awsResult = $pollyClient->synthesizeSpeech($synthesizeOptions);
        $this->setHeaders($awsResult->get('@metadata'));
        $stream = $awsResult->get('AudioStream');
        return $stream->getContents();
    }
public function read($text)
    {
        $initializeOptions = $this->getOptions()->getInitializeOptions();
        $pollyClient = new PollyClient([
            'version' => $initializeOptions->getVersion(),
            'region' => $initializeOptions->getRegion(),
            'credentials' => [
                'key' => $initializeOptions->getCredentials()->getKey(),
                'secret' => $initializeOptions->getCredentials()->getSecret()
            ]
        ]);

        $synthesizeOptions = [
            'OutputFormat' => $this->getOptions()->getOutputFormat(),
            'Text' => $text,
            'TextType' => $this->getOptions()->getTextType(),
            'VoiceId' => $this->getOptions()->getVoiceId(),
            'VoiceLanguageCode' => $this->getOptions()->getLanguage(),
            'SampleRate' => $this->getOptions()->getSampleRate(),
        ];
        if (!empty($this->getOptions()->getLexiconNames())) {
            $synthesizeOptions['LexiconNames'] = $this->getOptions()->getLexiconNames();
        }

        $awsResult = $pollyClient->synthesizeSpeech($synthesizeOptions);
        $this->setHeaders($awsResult->get('@metadata'));
        $stream = $awsResult->get('AudioStream');
        return $stream->getContents();
    }
public function read ( $ text ) { $ initializeOptions = $ this -> getOptions ( ) -> getInitializeOptions ( ) ; $ pollyClient = new PollyClient ( [ 'version' => $ initializeOptions -> getVersion ( ) , 'region' => $ initializeOptions -> getRegion ( ) , 'credentials' => [ 'key' => $ initializeOptions -> getCredentials ( ) -> getKey ( ) , 'secret' => $ initializeOptions -> getCredentials ( ) -> getSecret ( ) ] ] ) ; $ synthesizeOptions = [ 'OutputFormat' => $ this -> getOptions ( ) -> getOutputFormat ( ) , 'Text' => $ text , 'TextType' => $ this -> getOptions ( ) -> getTextType ( ) , 'VoiceId' => $ this -> getOptions ( ) -> getVoiceId ( ) , 'VoiceLanguageCode' => $ this -> getOptions ( ) -> getLanguage ( ) , 'SampleRate' => $ this -> getOptions ( ) -> getSampleRate ( ) , ] ; if ( ! empty ( $ this -> getOptions ( ) -> getLexiconNames ( ) ) ) { $ synthesizeOptions [ 'LexiconNames' ] = $ this -> getOptions ( ) -> getLexiconNames ( ) ; } $ awsResult = $ pollyClient -> synthesizeSpeech ( $ synthesizeOptions ) ; $ this -> setHeaders ( $ awsResult -> get ( '@metadata' ) ) ; $ stream = $ awsResult -> get ( 'AudioStream' ) ; return $ stream -> getContents ( ) ; }
Get audio for text from adapter
@param string $text
@return mixed
Get audio for text from adapter