KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to save in a file the audio data listened by speech recognition service of android. Actually I implement RecognitionListener as explained here: Speech to Text on Android save the data into a buffer as illustrated here: Capturing audio sent to Google's speech recognition server and write the buffer to a Wav file, as in here. Android Record raw bytes into WAVE file for Http Streaming My problem is how to get appropriate audio settings to save in the wav file's headers. In fact when I play the wav file only hear strange noise, with this parameters, short nChannels=2;// audio channels int sRate=44100; // Sample rate short bSamples = 16;// byteSample or nothing with this: short nChannels=1;// audio channels int sRate=8000; // Sample rate short bSamples = 16;// byteSample What is confusing is that looking at parameters of the speech recognition task from logcat I find first Set PLAYBACK sample rate to 44100 HZ : 12-20 14:41:34.007: DEBUG/AudioHardwareALSA(2364): Set PLAYBACK PCM format to S16_LE (Signed 16 bit Little Endian) 12-20 14:41:34.007: DEBUG/AudioHardwareALSA(2364): Using 2 channels for PLAYBACK. 12-20 14:41:34.007: DEBUG/AudioHardwareALSA(2364): Set PLAYBACK sample rate to 44100 HZ 12-20 14:41:34.007: DEBUG/AudioHardwareALSA(2364): Buffer size: 2048 12-20 14:41:34.007: DEBUG/AudioHardwareALSA(2364): Latency: 46439 and then aInfo.SampleRate = 8000 when it plays the file to send to google server: 12-20 14:41:36.1
Tags (comma-separated)
Save Edits
Cancel