views:

16

answers:

0

One of the libraries in my audio project continually outputs a byte[] array stream of PCM audio (along with a length and offset integer). I'm learning to use the Tritonus implementation of the Java Sound API to encode this PCM stream into mp3.

The Java Sound API provides an converted/encoded byte[] array via an AudioInputStream (created by 1) an encoder (courtesy of Tritonus) 2)the PCM InputStream).

But i'd rather just a use simple function this like this:

convertPCMToMp3(byte[] samples, int offset, int length)
{
 // convert the samples to mp3
 // return byte[] encodedsamples int offset int length
}

Does such exist in the Java Sound API?

If not, I'll probably just use one of these ByteBuffer-InputStream implementations...

http://www.google.com/search?&q=inputstream+bytebuffer