Javax.sound not avaiable in android - java

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.

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.

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.

Related

How to use javaanpr in Android app?

I would like to use this library for Car plate recognition in my Android app.
I red about JNI, but i'm still not able to get some good explained tutorial, how can i use use this library in my Android app.
http://javaanpr.sourceforge.net/
Thanks for any advice.
In it's current state, you will not be able to use JavaANPR on Android. The problem is, that JavaANPR's core functions use the java.awt package quite heavily (for example Photo.java) and Android doesn't support AWT mostly (AWT contains native code, and Android has it's own android.graphics package). There have been some attempts to port AWT to Android, but AFAIK they all failed/died eventually.
Disclaimer: A while ago, I forked JavaANPR in order to make it more library-like. It shouldn't be too hard to port the AWT code in JavaANPR to android.graphics though and you are more than welcome to submit a pull request!

Does android support video cropping?

i need to implement crop operation over a Video,is there any builtin class or third party library available or is there any alternate approach. I already had a walkthrough from android developer to Mr.Google !
As far as I know android has no built in API's for those video manipulations. I recommend FFMPEG. Go through this tutorial once. I have used xuggler with java swing. It served well and I think it might help you.

How to read a Barcode.. any particular API ? i need in the J2ME

Please suggest a API that can let me do the barcode read in mobile for J2ME..
There's a related post on doing this on Android: Using ZXing to create an android barcode scanning app
Update: As bhakki pointed out, you are asking about J2ME. The ZXing library appears to have partial support for J2ME: http://code.google.com/p/zxing/, so this other post may be of use still. Of course, this assumes you are using a mobile device with a camera
Update2: Specific J2ME code can be found in their SVN repository: http://code.google.com/p/zxing/source/browse/trunk#trunk%2Fjavame%2Fsrc%2Fcom%2Fgoogle%2Fzxing%2Fclient%2Fj2me%253Fstate%253Dclosed ... and their forums may be of use: https://groups.google.com/group/zxing/search?group=zxing&q=javame&qt_g=Search+this+group

How to get video and audio streams from web cameras with Java?

How can I get video and audio streams from web cameras with Java (in a cross-platform way)?
For example, we have a computer with 3-4 USB web cameras; we want to get their streams and make them visible in the user interface. How can we perform such a thing? I need code for a simple app which would find ALL cameras on the computer and let us select camera to wach. Can any one, please share such one?
With java media framework JMF or FMJ
Here is an example with JVM
I see your comment about the solution needing to be "pure" java, but this is really "nearly" impossible. You will need to use some sort of native library for accessing the devices, with that being stated; I suggest that you look at Xuggler as your solution. Xuggler supports Windows, Mac, and Linux and they also offer example code for handling audio and video. Lastly the library is FREE.
Webcam capture example: http://xuggle.googlecode.com/svn/trunk/java/xuggle-xuggler/src/com/xuggle/xuggler/demos/DisplayWebcamVideo.java
While Xuggle does not have an example of microphone capture, you can find samples on the mailing list or you could use code written by the packet-mulitbroadcaster project found here: https://code.google.com/p/packet-multibroadcaster/
You can try my solution. It uses OpenCV to capture the image and jetty server to transmit it via WebSocket. The example has three classes and it will be easy to understand.
Now I can send only video, but I'm working on audio aswell.
I'd use flex. It can be relatively easily integrated with java backend.
UPD:
Pure Java needed
Then you should consider JavaFX solutions. I'm not a big expert in javafx, I've only written some basic test applications, but I'm sure it's a modern way of solving described problem with pure java.

SoundTouch on Android?

Hey, I am trying to change the pitch of an audio file in an android application.
I have found an open source library online "SoundTouch" (http://www.surina.net/soundtouch), do you think I can use this library in an android app?
I have been Googling "SoundTouch in Java" an have found this data (http://www.aplu.ch/classdoc/jaw/ch/aplu/jaw/SoundTouch.html).
Possible this library I can use or any ideas about any other libraries or process I can use to alter the pitch of an audio file on android? I have also looked into the Java Sound API an android does not support them. :/
Thanks
Adam
Have you thought about just changing the sample rate? If you load the raw audio samples into memory and play them using Android's AudioTrack class, you can specify a wide range of possible sample rates and Android will resample for you. This will change both the pitch and tempo, like playing a record at the wrong speed. If you absolutely need to change the pitch without affecting the tempo, you'll need SoundTouch or something similar.
Anyway, this is definitely possible, but it will take a fair amount of work.
You'll need to use the Android NDK (native development kit) to compile SoundTouch. The Java wrapper you found might be helpful, but ultimately you'll need to get your hands dirty with the NDK.
You'll also need to write your own code to read the audio file from disk, and then buffer it through SoundTouch and out through the AudioTrack class. MediaPlayer won't help you here.
Finally, note that you'll need to abide by the terms of the LGPL when releasing your app.
https://github.com/nonameentername/soundtouch-android
please follow the above link and just build with ndk.
The source of soundtouch is wrong so please download and replace it.
Build on a linux enviornment.
For any queries please get back to me.
If you want to change the pitch of sound you can use openal
http://pielot.org/2011/11/10/openal4android-2/

Categories

Resources