5

I have an application that records a speech sample from the user's microphone and uploads it to a server which then does some stuff with it. It seems I must record with the following parameters to avoid an 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 have it recorded at 16khz, not 44.1, (sampleRate and framerate both, I assume) and it must be in mono (1 channel). The PCM signed is also mandatory, so thats good. (The server is VERY picky and I cannot make any changes to it.) How can I convert this using Java?

I am submitting the audio file via HttpClient as a Filebody to a servlet, saving it on the server, and then processing it.

4

1 回答 1

3

Here are a few good links to get started on your own:

Alternatively (for quick use) this FREE library here is what you'd want:

于 2012-07-10T21:18:52.707 回答