I have a voice recorder in Javascript, and the recorded output is accessed through its url in php and passed into a python file to be used by the speech_recognition library for a text conversion like so:
$aud = $_FILES['audio_data']['tmp_name'];
$output = shell_exec('python ImageToText.py '. $aud.' 2>&1');
But I get this error:
ValueError: Audio file could not be read as PCM WAV, AIFF/AIFF-C, or Native FLAC; check if file is corrupted or in another format
Some research revealed that it's because the recording is in webm format, and further research revealed that I can use sox to convert audio from one form to another. I wanted to know if there was a way to do this in php to pass a WAV file to the python file or if there was any other way to do this. Thank you.