Audio file duration without AudioSystem class in Java (GAE)? - java

There is already a more general answer (Java) at https://stackoverflow.com/questions/3009908/how-do-i-get-a-sound-files-total-time-in-java but unfortunately
java.lang.NoClassDefFoundError: javax.sound.sampled.AudioSystem is a restricted class. Please see the Google App Engine developer's guide for more details.
AudioSystem is not on the Google App Engine JRE Class White List and therefore can't be used. Any other approach?
I have (already uploaded) audio files sitting on Google Cloud Storage (GCS) and I can load them into ByteArrayInputStream but somehow I need to convert them into AudioInputStream to get the audio file duration (and save the duration in the database).

A support ticket for Audio Manipulation API along the lines of the Images service is currently in WontFix status: https://code.google.com/p/googleappengine/issues/detail?id=1947, so it is unlikely that there will be support for this in near future. Issue was reopened again: https://code.google.com/p/googleappengine/issues/detail?id=6442
The solution at this point would be to work with external Audio APIs that are available as a Service. Maybe a list from ProgrammableWeb on Audio APIs could help.

Related

Using CCTV SDK for Windows on Android?

A DVR I bought includes its SDK which gives me all the programming codes for the DVR.
The example I found in the SDK was made for Windows only, is there a way I can implement these methods on Android using NDK?
The SDK uses .cpp files and some .h files. It also links to an external .dll file which I have no way of reading the codes to implement to Android
EDIT
I'm trying to implement these methods for a live view application. I managed to get the stream using rtsp with low latency using a different source, but I need to get the playback function which is available in the SDK
EDIT 2
What I mean by "playback" is to play the recorded videos saved on the hard disk of the DVR.
I asked some of my connections and they confused "playback" with "livestream" so this might also confuse some who reads this question

Android - Play (mp3) from memory while streaming

Sorry about the weird title, I couldn't think of anything better.
In my Android App I want to stream an .mp3 file from an http server, which requires basic authentication. The task is to download the data and save it to the sdcard while playing. (Basicly streaming an mp3 from an http server but also saving the file)
I managed to download the mp3 from the server to the sdcard and to play the downloaded file with the Android MediaPlayer class. But playing only works right when the file is downloaded completely. I want my App to play WHILE downloading.
Can someone point out a good solution to this problem? I thought about using some third-party audio library to stream mp3 audio from memory but I couldn't find anything useful for my problem. Are there any good free librarys for Android that suit my needs?

How to read and play realtime sound stream in java?

I'm using Java to read and play some real time audio streams such as the voice from radio station.
I have the real time web address like this one and it can be played in a web browser.
How can I play it using Java language?
Thanks.
MP3SPI is a Java Service Provider Interface that adds MP3 (MPEG 1/2/2.5 Layer 1/2/3) audio format support for Java Platform. It supports streaming, ID3v2 frames, Equalizer etc. It is based on JLayer and Tritonus Java libraries.
You can use this library MP3 SPI for Java Sound , and its documentation here.
Library reference

Most suitable file format for playing audio files in smart phones

I have a web app(jsp/servlets) which allows users to download audio files and play in mobile phones.For targeting a large audience, I wish to develop a j2me app for normal smart phones. My audio files are voice recordings and may run for around 50 minutes. Therefore a very light weight audio files should be available for users to download and play in my mobile app.J2ME app may reach audio files through http(as most phones support http than rtsp).My questions are
1.What is the most suitable audio file format which will run in more smart mobile phones(Nokia,SonyErricsson,Motoroal etc) and most light weight for downloading? (As I know mp3 is good,but are more phones support for mp3?)
2. How I can encode big audio files in servlets(Open source Codecs and those encoded audio files must be play in j2me app:- Manager.createPlayer(url) easily, any sample code or sources please)
My aim is to allow users to download around 5mb files which may run around 50 minutes.I don't whether it is possible or not. if any one knows,please let me know answers for my problems.
The Manager class allows you to test if mp3 is supported in the device. Most recent JavaME devices do, but you should check anyway as the only audio format guaranteed to be supported is wav.
As for the best, in your case the best is the fastest to transfer, I guess. You should create the file with the minimum acceptable quality possible (e.g.: mono instead of stereo, low bitrate instead of high, etc). Since you are working with voice instead of music, you don't really need 44.1 kHz stereo CD quality.
EDIT:
However, I don't think you can stream audio in JavaME over HTTP. The Player.prefetch method will try to download the entire file before playing, and 50 MB is just too much for memory constrained devices like JavaME ones. You have to use RSTP if your device supports it; or use the DataSource version of the createPlayer method, and implement a DataSource to return a regular InputStream from an HTTP connection to your file.

Converting audio files(.3gp) to video with Album cover and uploading to YouTube

I have an audio file in .3gp format on my Android device which I wish
to upload to YouTube. I know that YouTube is a video upload site and
that I need to convert this sound file to video.
I just want an image to display all the time the audio is playing.
Google tells me there are number of tools that can help me. But I want
to do this via java code from my Android device.
Please help.
Thanks.
There are tools such as FFMPEG available for free that allow you to, essentially, mix and convert heterogenous streams. That is you can add a bitmap to a video, create video from slide shows and then add sound etc. (See a related question I asked here).
These programs can be executed from within java applications by making Runtime.exec(..) calls.
Sun has an example for stitching multiple JPEGs together into a movie, you can find it here. You should be able to take this example, (its fairly robust), and add what you need to it.
I recommend looking into the Java Media Framework (FAQ)
You can find a vast collection of sample applets/code at the Sun Solutions page. You can find the API on this page. I do hope this is compatible on the Android platform, as I haven't had any personal experience developing for it. But it might be a good place to start.

Categories