start)); $end = date("d/m/y H:i",strtotime($this->end)); $textToSpeechClient = new TextToSpeechClient([ 'credentials' => json_decode(file_get_contents('/home/alexis/tts/tts3cx-364517-c2071a1937ae.json'), true) ]); $input = new SynthesisInput(); $input->setText(strtolower($this->text)); $voice = new VoiceSelectionParams(); $voice->setLanguageCode('fr-FR'); $voice->setName('fr-FR-Neural2-B'); $audioConfig = new AudioConfig(); $audioConfig->setAudioEncoding(AudioEncoding::LINEAR16); $resp = $textToSpeechClient->synthesizeSpeech($input, $voice, $audioConfig); $filename = preg_replace('/\s+/', '', $this->name).$id; Storage::disk('public')->put($filename.'.mp3',$resp->getAudioContent()); shell_exec("ffmpeg -i storage/".$filename.".mp3 -ar 8000 -ac 1 -y storage/".$filename.".wav && rm storage/".$filename.".mp3"); // $process = new Process(['ffmpeg','-i','storage/app/'.$filename.'.mp3', '-ar', '8000','-ac','1','-y', 'storage/app/'.$filename.'.wav']); // $process->run(); if(null != session('audio')){ session()->pull('audio'); } session([ 'audio' => $filename.'.wav', 'name' => $this->name, 'mail' => $this->mail, 'dates' => "Du ".$start.' jusqu\'au '.$end, 'text' => $this->text ]); $this->dispatch('msg-gen'); } }