I am using google speech API to converting the voice to text, but it return as bool(false) I am first converting the .wav file to .flac file then convert it into the text.
Following is my complete code (I am using codeigniter):
$ffmpeg = FFMpeg::create();
$audio = $ffmpeg->open(FCPATH . 'uploads/' . $this->input->post('userfile'));
$format = new Flac();
$format->setAudioChannels(2)
->setAudioKiloBitrate(256);
$file_name = time() . '_flac.flac';
$audio->save($format, FCPATH . 'uploads/flac_files/' . $file_name);
$this->load->file(APPPATH . 'third_party/GoogleSpeechToText.php');
$apiKey = 'xxxxxxxxxxxxxxxxxxxx';
$speech = new GoogleSpeechToText($apiKey);
$file = realpath(FCPATH . 'uploads/flac_files/quick.flac');
$bitRate = 44100; // The bit rate of the file.
$result = $speech->process($file, $bitRate, 'en-US');
var_dump($result);
return;
And here is the output I got using codeigniter framework: