I am trying to do a little thing for practice. So, I'm trying to send POST request to google speech recognizer. I have a .wave file that is encoded to .flac with FLACFileEncoder with following code
FLAC_FileEncoder encoder = new FLAC_FileEncoder();
encoder.encode(new File("test.wav"), new File("test.flac"));
But google won't accept it and i don't know why. BUT if I use some kind of online converters(http://www.freefileconvert.com/ for example), it's OK.
Where I did wrong? Thanks for the help.
Last edit: Goringo 2014-01-11
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello. Does the POST response include any error details that may help? If not, the first thing to check is that the encoder is producing a valid file. Try testing the file with the official flac tools available at https://xiph.org/flac/download.html . If you decode the file back to wav with that, or use the test option, it should say if there's an issue with the file. If there is no issue with the flac file itself, then next check to ensure they're producing the same format(sample rate, sample size, etc). If they differ, use the FLAC_FileEncoder.setStreamConfig() method to set the stream settings to match.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Actually, I told you a bit wrong. The sample rate and sample size will be reset to match the input file; so you only need to set the StreamConfiguration if it is something like an unsupported block size. Otherwise, if it needs to be a particular sample size or rate, you need to convert the wav file prior to giving it to the encoder.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello.
I am trying to do a little thing for practice. So, I'm trying to send POST request to google speech recognizer. I have a .wave file that is encoded to .flac with FLACFileEncoder with following code
But google won't accept it and i don't know why. BUT if I use some kind of online converters(http://www.freefileconvert.com/ for example), it's OK.
Where I did wrong? Thanks for the help.
Last edit: Goringo 2014-01-11
Hello. Does the POST response include any error details that may help? If not, the first thing to check is that the encoder is producing a valid file. Try testing the file with the official flac tools available at https://xiph.org/flac/download.html . If you decode the file back to wav with that, or use the test option, it should say if there's an issue with the file. If there is no issue with the flac file itself, then next check to ensure they're producing the same format(sample rate, sample size, etc). If they differ, use the FLAC_FileEncoder.setStreamConfig() method to set the stream settings to match.
Actually, I told you a bit wrong. The sample rate and sample size will be reset to match the input file; so you only need to set the StreamConfiguration if it is something like an unsupported block size. Otherwise, if it needs to be a particular sample size or rate, you need to convert the wav file prior to giving it to the encoder.