I am trying to convert audio file to text using node js, I have got a reference link https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/master/speech, by using this link I am able to convert the sample files which include in it(viz., audio.raw, gs://gcs-test-data/vr.flac) from audio to text
But when I use the audio file from this link I unable to convert the audio to text, it shows an empty response. The response is { results: [] }
Also I am aware of using these commands
node recognize.js sync ./resources/audio.raw -e LINEAR16 -r 16000
node recognize.js async-gcs gs://gcs-test-data/vr.flac -e FLAC -r 16000
node recognize.js stream ./resources/audio.raw -e LINEAR16 -r 16000
but, I don't know how to use the audio file from link to convert audio to text
When using the Google Speech API it is important to make sure your audio format is correct. The API cannot be used with formats like mp3.
In order to use the api you can use a tool like sox or ffmpeg to convert to flac:
* Sox : sox input_file.mp3 output.flac
* ffmpeg : ffmpeg -i input_file.mp3 ./output.flac
When a wrong format is used, the Google Speech API is coming back with an empty answer.
{ results: [] }