Mixing audio with java - java

I have been looking for good examples of sound mixing using Java in vain. I am developing an Android app and would like to implement such feature. I am mainly looking for a way of mixing (or merging) multiple wav or mp3 sounds into a single sound file and save it as a specific format (mp3 or wav). I have found a couple of sources, unfortunately they don't offer enough comprehensive documentations. I just don't want to copy and past codes without understanding the core concepts. I have tried to implement the Jmusic library, but I keep getting errors and my app always crashes when reading the files. Any help would be greatly appreciated. Thanks

Related

Why I can't use JMF on Android?

I don't really have or want to use the Java Media Framework (JMF) on Android but I am looking for detailed information about why it's not possible to use it. (I know that it's considered as outdated anyway and I am aware that there may be better ways to achieve certain things in Android using this for example: http://developer.android.com/guide/topics/media/index.html)
Nevertheless I need more information regarding JMF on Android but all I could find is, that "JMF isn't working on Android" - but I wonder why.
So I have two questions:
Do you know any kind of "official" statement, for example from Google or Oracle, saying that JMF isn't supported on Android? I wasn't able to find something like that.
Why is JMF supposed to be not working on Android? I am interested in the technical details and would be grateful for all kind of references.
Thank you!
EDIT:
To be a bit more specific and clarify my approach: I built a tiny test-app and tried to play an audiofile the same way as I have done in a standard java desktop application (which was working as expected). I included the JMF.jar (for now without any modification) compiled, deployed and started the app - no problems so far. The (first) exception (javax.media.NoPlayerException) is thrown when calling Manager.createPlayer().
That was actually the point where I stopped and wondered if it's worth digging deeper, although the result is kind of predictable. I decided to ask about the technical background first, instead of figuring it out the hard way in hours of testing and debugging (the reason is not a lack of interest but unfortunately a matter of time at the moment).
I am looking for detailed information about why it's not possible to use it
Because it was not included in the Android SDK. Lots of things from Java SE were not included in Android.
Do you know any kind of "official" statement, for example from Google or Oracle, saying that JMF isn't supported on Android?
I am not aware of such a statement. They also have not released a statement indicating why Android does not integrate with the Hubble Space Telescope, why it does not include shoe-shining APIs, etc. There are an infinite number of things that are not in Android; it would be impossible to list them all.
More generally, Google faces pressure to keep a lid on firmware size, as the bigger the firmware, the more expensive things get (required storage, OTA update costs, etc.). Hence, they only include a subset of the Java SE SDK as one way of helping reduce firmware bloat.
Why is JMF supposed to be not working on Android?
Because it was not included in the Android SDK. I have no idea if it is possible, let alone practical, to create a fork of JMF that offers a JMF-like API but uses Android media capabilities under the covers.

Working With/Processing Audio in Java

Anyone know of any good tutorials or reference guides for working with Audio in Java? I'm not looking for anything too specific at this point; just would like to get my feet wet working with audio. Thanks in advance!
First of all: Multimedia/audio support in Java is not great.
But—if you're set on Java, I suggest taking a look at the Java Sound Trail. It explains most of the basic APIs. Then check out Java Sound Resources to get a better idea of how things work. Even though it's not brand-new anymore, it is very useful and explains a lot about the low level details.
Beyond the raw sound API, Sun came up with JMF, the Java Media Framework. It has been unsupported for years, so I would stay clear of it. You might want to use it for inspiration, but I can't recommend using it for more.
You will also discover that the built-in Java support for audio formats like mp3 or ogg is rather limited. To be able to play such files, you will need third party libraries, like jogg, jflac, mp3spi, or SampledSP. While the first three are pure Java solutions, the last one is basically a thin Java wrapper for a number of native libraries. Especially for FFmpeg there are a many different libraries like that, as FFmpeg supports most available audio formats.
The only way to play an mp3 file from Java without any additional libraries, is to cheat and use the JavaFX class MediaPlayer. You can find more info about how to do that on Stackoverflow.
Good luck!

App Engine Java - Extract thumbnail from mp4 video

I have some video stored on Google Cloud Storage in mp4, i need the extract a thumbnail from them.
I looked to a number of solutions, and looks like they don't work with App Engine.
for example: http://www.xuggle.com/xuggler/
Do you have library that i could use to do this on Google App Engine in Java?
I finally went with Google Compute Engine and ffmpeg, implementation is in progress...
This question looks related to Is there a Java API for mp4 files?
Xuggler says their project is a mix of java and native code. Native code will not run on java app engine.
Search for java mp4 video decoder and look for a decoders that only use java code. Perhaps this one will work: http://jcodec.org/guide/movstitch.html.
OK, after some searching, I've found following: Video website on google application engine
Sounds like similar problem to yours. The only difference is that the other thread checks for python solution. However answers seem to be quite programming language independent, so I think it will be worth a read.
For the documentation/inspirational purposes, it might be worth to describe your solution in this thread once you go for it.

Implementing powerpoint transitions/animations using Java

I'm working on a project in Java where I need to display a powerpoint presentation complete with transitions and animations. The Apache POI library provides a nice method of viewing previews of different slides statically, but it seems that any animations or transitions need to be implemented separately which, looking at the library seems to be a fair bit of work.
I've no problem with hard work - but I'm somewhat surprised if this hasn't been done already (frantic Googling however hasn't brought up any results.) Does anyone know of a Java library for powerpoint that handles animations relatively easily?
Unless someone comes up with that PowerPoint Java library for you, you might want to check out PowerPoint Object Linking and Embedding (OLE).
You can use COM4J to have almost all the classes/interface of the namespace microsoft.office.interop.powerpoint , Its almost like your using it from C#. On the code samples from the download you have the package you need with all the interface/classes implemented for you.
Hope it helps you out :P

A simple free MIDI implementation in Java besides javax.sound.midi: Are there any?

The problem is: Android doesn't implement javax.sound.midi.
I need a simple free library that allows me to create simple 1-track midi files.
I searched the net for it, but can't really find anything, since everything uses javax.sound.midi .
The license needs to be one where I don't need to opensource my linked app.
Any ideas?
I also looked into the fileformat itself. However, I am totally not familiar with working with bytes, hexidecimal stuff etc.
So, other option is: are there any simple midi implementations that I can use as reference?
Well, for all you midi needing android devs: check out this Dutch university assignment
that contains a very very basic midi file writer. Together with this reference doc you can easily expand it into playing chords, selecting instrument etc.
It worked for me!
I do have opened a feature request for direct streaming access to the synthesizer. If you are interested in streaming midi, please rate, star, comment there.
http://kevinboone.net/javamidi.html
I've recently uploaded a MIDI library written in Java to Google Code:
http://code.google.com/p/android-midi-lib/
For those who come across this more recently Android does, as of API version 23, implement android.sound.midi which is not an implementation of javax.sound.midi but does have a very similar API.

Categories