I have an application that records a speech sample from a custom microphone and uploads it to a server, which then does some things with it. It seems I should write with the following parameters to avoid IllegalArgumentException:
Encoding encoding = AudioFormat.Encoding.PCM_SIGNED;
float sampleRate = 44100.0F;
int sampleSizeInBits = 16;
int channels = 2;
int frameSize = 4;
float frameRate = 44100.0F;
boolean bigEndian = false;
But I need to record it at 16 kHz, and not at 44.1 (sampleRate and frame rate, as I assume), and it should be in mono (1 channel). PCM signed is also required, so it’s good. (The server is VERY legible and I cannot make any changes to it.) How can I convert this using Java?
I transfer the audio file through HttpClient as a Filebody for the servlet, storing it on the server and then processing it.