Javax.sound not avaiable in android

3.3k views Asked by At

I am trying to use javax.sound package in android. But android stopped this javax support. I have tried to port my javax.sound dependent code to android also but its not working. The key point is I need the sound raw data from AudioInputStream like the javax.sound package do.

I m lost somewhere I don't know. If anybody knows about the alternative of javax.sound package please reply.

2

There are 2 answers

1
Prateek On

Well, In my knowledge of java I thing javax is a package that supports swings that is a toolkit used for UI and Multimedia operations.

But this is not supported in android-sdk as you have a number of options to achieve the same and have a good responsive and needed callbacks via sdk provided methods.

So I will recommend you to go for MediaPlayer API provided by android that would suffice in your case.

0
Malcolm On

If you need to read the data from the devices, there is a class called android.media.AudioRecord which will help you read raw data. If you need to decode some files, and you are using Android 4.1+, then you can also use the class android.media.MediaCodec, which provides the necessary low-level interface to audio codecs.