Android Example JavaFlacEncoder

stevel05

Expert
Licensed User
This has been requested a couple of times on the forum and to get the ball rolling, here is an example of accessing the javaFlacEncoder with Javaobject.

Files and documentation are available here: http://javaflacencoder.sourceforge.net/

As it stands, it will encode a stereo 44100hz 16bit wav file to flac and play it using the Android Media player.

It is built as a class, but needs a lot more work to be able to encode any format wav file.

You need to download the files from the above link and add the javaFlacEncoder-0.3.1.jar to your additional libs folder.

The encoder will also work on B4j, but the Java Media player does not play flac files so you would have to find another way of playing them.

It is not particularly quick to do the encoding and there is a short test file included (hence the size of the zip file).

Depends on: JavaObject, RandomAccessFile

Have fun.
 

Attachments

Last edited:

stevel05

Expert
Licensed User
JavaFlacEncoder2 attached to the first post will encode 8,16,24 and possibly 32 bit files, although I haven't found a player that will play 32bit files so can't test it.

Files encoded > 16 bit and 44100 hz may or may not work on all devices, the input files will be very large and it will take a significant amount of time. You may need to consider moving the process to it's own thread if you want to use it on anything but a small file.
 
Top