I am trying to create a voice assistant for android. Below are the steps I followed:
- I tried recording using the mediarecorder (jnius autoclass).
- The voice was recorded in awb format using following:
self.mRecorder.setOutputFormat(self.OutputFormat.AMR_WB)
self.mRecorder.setOutputFile('/sdcard/test_recording.awb')
- converting it to wav using ffmpef
- further converting it to flac using sox subprocess.
- Submitting to google web speech api.
However it returns an empty response and no error.
{"result":[]}
I had to resort to various conversions as mediarecorder doesn't provide an option to record either a flac or a wav file. Also, normal SpeechRecognition module for python doesn't have a flac convertor for android and hence can't be used
How to debug to figure out what might be wrong that google returns this unexpected response and why not an error.
I downloaded my intermediate wav file and tried to use "play audio.wav"
and it gave the following output:
File Size: 157k Bit Rate: 256k Encoding: Signed PCM
Channels: 1 @ 16-bit Samplerate: 16000Hz Replaygain: off
Duration: 00:00:04.90
In:100% 00:00:04.90 [00:00:00.00] Out:78.4k [ | ] Hd:4.7
Clip:0 Done.
This audio was further converted to FLAC using SOX(over termux).
Any help is appreciated.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…