Media player libraries in Java [closed] - java

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I am evaluating libraries for playing audio/video in Java. It does not need to be 100% Java; Java bindings to native libraries are perfectly OK. An external application that can be controlled from Java is also fine, as long as it can render video on a Java component.
The target platform is Linux. Windows support is a plus, but not required.
I have played with VLC using the VLCj bindings, and it works pretty well in general, but keeps crashing occasionally when put under stress. I have also used mplayer in slave mode, which looks good. But I'd like to evaluate other options as well.
These are the requirements:
Live playback of H.264, MPEG4 through RTP using RTSP. Extra points for MJPEG over HTTP.
Able to render video on a Java (Swing or AWT) Component
Open source, and actively maintained
Stable, rock-solid
Suggestions? Advice?

Ok, I've spent the last month playing with several options and these are the results:
VLC. This was my first thought, as everybody keeps saying that it "plays everything". I have used both the VLCj Java bindings, and the built-in remote interface (-I rc). I found this to work pretty well in general, but had some issues. I kept seeing ocassional crashes under heavy load (not VLCj's fault as it also happens when using the binary directly). Also I've found memory consumption to be relatively high when compared to other options.
MPlayer. This actually performs better than VLC in my experience, no crashes, and memory consumption is lower. No Java bindings, although the slave mode works very well.
GStreamer. Very powerful, very flexible, while still easy to get started with. Tried both the Java bindings and running the gst-launch binary from Java. Both approaches work remarkably well.
Xuggler looked good, however it seems to have issues with RTP (as stated in the FAQ). Since both GStreamer and MPlayer worked so well, I did not get past the initial research.
I found GStreamer to be the best solution given the requirements, with MPlayer being the second option.

have you looked at gstreamer?

I've also spent a while researching my options, and I've actually come to the conclusion that VLCJ is the best option - however here's the clincher, you need to run it out of process (especially with multiple players) for it to give you 100% reliable operation. That's the approach I'm taking and I've yet to see it crash. With it rock solid in this way it also has other advantages:
It can play pretty much anything. Yes it's a bit of a cliche, but this includes DVDs, Youtube videos, pretty much any video file...
Should support Linux / Mac / Windows, though I've yet to verify Mac working.
Actively maintained, and if you ask a good (as in well thought out) question on the discussion group the owner often replies in minute in my experience!
Open source, and the Google group activity at the time of writing is high.
Uses all the graphics acceleration VLC does
Able to play to any heavyweight Canvas component (and if you use the direct player, you get the BufferedImage to display anywhere you like, even in JOGL 3D land if you're that crazy!
I haven't found it that heavy on the resources front either, though I haven't done any thorough testing (but 3 players work fine in tandem as well as my relatively power-hungry application on my 4 year old basic laptop!)
Disadvantages? There's no official framework for out of process players, so you have to build one yourself (see here for how I did it). And you do sometimes have to do some fiddling to get it working. But as far as I can see, it's working well for me so far!

Related

Microcontroller and Robot Construction [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I am looking for an answer to a question relating to programming and robots..
I have been learning java over the past 2 years, and just recently started working with and Arduino microcontroller for a robot that is near completion(2 servos, 1 ultrasonic sensor, 2 parallax servo-controllers, 12v battery, all in a toy car that i ripped apart).
I was hoping to build a much more complex machine that would do all of the following:
Control 4 servos that would move treads
Powers a few cameras, possibly relaying several feeds to a monitor or pc wirelessly to help with user-controlled movement
Control a pan-tilt servo system for a top mounted camera or paintball/airsoft gun or some such similar device
Maybe a gps system, so that having it can return to the user when low battery, or when the user is done controlling it( NOTE: Not a necessary component, but would be very nice)
My Question is this: What microcontroller or controller do you know of that could be used to control all of that effectively, and not be maxed out(Also hoping that the suggested could control multiple systems at once)? What programming language would effectively be able to control all of the above robot effectively(or is great for this type of system in general)? Does the programming language that must be used change depending on the microcontroller?
There may be more to that, but currently, the base at minimum must be built before I can go anywhere else. My budget is not large, and would prefer to keep this cheaper than $1000-$1500 excluding the mounted tool on top.
I'd say you should take a look at the Raspberry PI for the time being. It cannot do it all alone, you will have to combine it with a real micro controller as io expansion.
The raspi is cheap, and got a strong community, easy to get help when you are stuck.
For micro controller I would chose an ATmega328 from Atmel (~$4 on ebay). with that one you can stay Arduino compatible, which again has a super strong community.
I know the newer BeagleBoneBlack will be able to handle both tasks in one unit, but the product seems to be a little less mature right now, and the community is nowhere close to raspi or arduino!
Over at LetsMakeRobots we are building robots too, some even as advanced as your project, you might find some inspiration. And there are definitely some motor driver geeks there!
You're looking for an Arduino with an Adafruit motor shield to start with. I won't post a link to either due to the commercial nature but that will put you in the right direction. I'm not sure Stackoverflow is the right place to ask this question though. You may have much better luck elsewhere.

How to program a simple music sequencer for Android (Java) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
What I want to do:
I would like to program a very simple music sequencer for Android. But I've never worked with audio on Android or in Java, respectively.
What the application should do:
play back samples (WAVE/OGG files)
play several audio channels simultaneously (e.g. the trumpet and the flute should play simultaneously, maximum of 10 instruments)
change the pitch of the samples (e.g. the trumpet WAVE file must be played in normal pitch (c4) and lower/higher pitch (e2/g6) and so on)
This is what the application should be able to do in general.
What components do I need? A normal media player (AudioManager?) won't work, right?
There are already some applications which do what I am thinking about:
FingerBeat for iOS
FL Studio Mobile for iOS
Uloops Studio for Android
Thanks in advance for your help!
There is very simple open source beat sequencer for Android called SoundFuse. They have description and screenshots on the page.
Here is the github repository.
You have not one simple requirement, but three very different requirements.
Playing WAV should be supported out of the box by the JRE with the help of the classes in javax.sound.sampled, it jsut requires some code to wire it up (not too sure about android).
Playing OGG is not supported out of the box. There is an open source implementation for OGG called jOrbis, see their web site. Again this can require some wiring code to hook into your application.
For a Sequencer, you could just use MIDI. Again it should be supported by the JRE, and if it is not on your platform, you can use Gervill - a pure Java MIDI sequencer (Project web site).
There is also a ModPlayer that can play good old Soundtracker and some others. This can also be abused as a Sequencer of some sort if you know the Soundtracker or Screamtracker module format (ancient format, but descriptions are still available on the net). Player with source can be found here. The Tracker formats are not all that ancient by the way, some of todays game engines still make use of them.
If you really want, you can cook up your own Sequencer, all the basic stuff if there in javax.sound.sampled. It just requires some basic knowledge about digital sound and a big lot of wiring code.
There is no single solution for all your needs, you will have to stitch you own together from the building blocks freely available.
I won't be able to provide a complete answer, but I will point you in the right direction.
Android does support .wav and .ogg decoding. According to: http://developer.android.com/guide/appendix/media-formats.html
I don't have any experience in audio, but your best bet seems to be the SoundPool class, it allows you to adjust pitch and volume and it seems to be able to play multiple sounds simultaneously: "Note that calling play() may cause another sound to stop playing if the maximum number of active streams is exceeded."
http://developer.android.com/reference/android/media/SoundPool.html
There also is a MediaPlayer class, but this is for more simple use. I don't think it allows pitch control.
I made something similar for my application (playing trombones sample). After a lot of experiencing, I found the best solution was to use AudioTrack.
Have a look at my source code:
http://code.google.com/p/trombonino/source/browse/trunk/src/com/trombonino
Especially
http://code.google.com/p/trombonino/source/browse/trunk/src/com/trombonino/Trombone.java
http://code.google.com/p/trombonino/source/browse/trunk/src/com/trombonino/WavFile.java
You will have problems with your timing on the Android system. To avoid your sequencer thread being interrupted by garbage collection you probably need to write the sequencer in native using the ndk.
Playing back the sounds is probably best to do using the ndk as well.
Take a look at https://code.google.com/p/high-performance-audio/
In the above Soundfuse example the sequencer uses SystemClock.sleep() that is never a good idea. Check Why using System.Threading.Thread.Sleep() is a bad practice?.
Realized this question is really old but will answer it anyway since no answer mentions the NDK.

What is a good Open Source game engine for a beginner? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I want to develop a game and I am at a beginner level.
When I searched for game engines on Google a long list was returned (e.g. Delta 3D, Panda 3D)
Then I looked at wikipedia and it also showed a very large list.
I am not sure which engine to choose.
Please suggest a good game engine and some good tutorial or a good ebook.
I am experienced in C++, QT4, Java and Python(at very initial level).
If the game engine supports Linux platform then I will be very happy.
You should check out OGRE3D. It's totally cross-platform and it's a commercial quality game engine- for example, the indie game Torchlight uses OGRE3D and it was a huge success.
Asuming you are looking at 3D, I'd personally recommend jMonkeyEngine.
It's well designed, open source, has great performance, very easy to use (for a 3D engine...) and under active development.
Whatever you choose then good luck - just be aware that you have a long journey ahead if you want to actually successfully develop a 3D game :-)
Java:
jMonkeyEngine
Python:
pygame (though not really a game engine)
For Linux you can look at the Cube which you can download from here.
Since you are a beginner, I suggest you look at linear algebra. A very good source for this is the Khan Academy. That you will be in a much better position to evaluate the needs you have for a game-engine.
Most all of the code for Quake engine, but not the content, has been made public. So you can play around with that engine to see if it's up to you specifications (the Quake 1, Quake 2, and Quake 3 engines have all been released). Quake 1, 2, and 3 all support the Linux platform.
Also, while the Source Engine isn't open source, a great deal of the source code is available through the Source SDK. It's very easy to modify and you should definitely consider working with it. However, Source is Windows and Mac only.
This resource deals with the Quake 3 engine and is a bit outdated, but I'm sure it'll suit you just fine.
You may wish to qualify your question with what sort of game you're trying to build. Not all game engines are created equal for this :)
So, just for brevity's sake, if you are after building a 2D game, the Gluon game creation and distribution framework ( http://gluon.gamingfreedom.org/ ) may well be the sort of thing you're looking for. Also because it's built using Qt, with which you mention you are already familiar.
If you're looking for 2D, then the GLib engine (theglibengine.wordpress.com) is probably a good start. I must warn you though, it's new and still a bit buggy. It's written Java. For 3D, I'd recommend JMonkeyEngine (for NetBeans) or Ardor3D (for Eclipse).
PLIB is a useful engine for Linux users. It uses a program called OpenGL to operate, so you may need that first, and it's a tiny bit complicated to install, but there are tutorials on that and on C+++ script writing. Perfect 3D engine for Linux.

Real-time Java graph / chart library? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
There was an earlier thread on Java graph or chart library, where JFreeChart was found to be quite good, but, as stated in its FAQ, it's not meant for real-time rendering.
Can anyone recommend a comparable library that supports real-time rendering? Just some basic xy-rendering - for instance, getting a voltage signal from data acquisition system and plotting it as it comes (time on x-axis, voltage on y-axis).
What the FAQ actually says is that JFreeChart doesn't support hard real-time charting, meaning that the chart isn't updated when new data arrives or at deterministic interval after it. However I have found that JFreeChart can be used for the kind of applications you are describing. You can achieve 1 update per second, which is fine. I don't think a human eye can follow something quicker than this.
If you want something more than this, I doubt you will find anything in Java (or even in another language). Operating Systems that we use aren't designed to be real time. You can't have a guaranty that they will respond in a minimum interval after an event. A tight integration with the hardware driver will be needed to show more than 1-10 frames per second.
However, if you design your application correctly, the OS will do respond quickly and your application can easily display a "real-time" graph (meaning a graph that updates once a second). Just don't use your application to shut down a valve in an emergency situation!
http://www.live-graph.org/
Just stumbled upon a description on how to use the visualvm charting library. Looks very nice!
have a look at processing -- it's an open-source, java-based environment designed for all sorts of animated visualizations.
Well, if it has to be Java, then you might want to look into these.
Java Real-Time Systems (includes demo both real-time and non-real-timem, and JavaFX version of the charting application)
Real-time Java application development using multicore systems
Expedited Real-Time Task Graphs (This technology runs on Linux, but development can be done on any platform that supports Java 5.0 and Eclipse.)
JavaFX - A Pie Chart Demo
You probably have already found a good solution, but if not, I have recently done some work on a framework for producing 2D charts allowing for live updates at a rate of over 50 changes per second.
The original intention was to mimic the appearance of a chart recorder in a scrolling region of a web page, but I believe the approach has wider application.
A demo can be found at Chart Recorder Demo if anyone is interested.
The appearance is defined by a template (www.journeylog.co.uk/chart/templates/chartRecorder.xml). One feature is the ability to specify drawing either on the server or in the browser using ExplorerCanvas.
If anyone is interested I could start an open source project for it.
Fast enough for real time is swtchart, at least in my experience. Even with lots of data. Don't be scared away by the version number, yes it is a rather new API, but I use it successfully without problems.
As the name implies, it is based on SWT, which uses native OS drawing. Also it does some clever optimizations for drawing fast, like not drawing all points in the dataset (see Large Series Example Snippet).
this seems like a good candidate.
http://jchart2d.sourceforge.net/
demo:
http://jchart2d.sourceforge.net/applet.shtml
JCCkit is vary good library who are targetting less memory especially in embedded environment : https://sourceforge.net/projects/jcckit .
Takes less than <100 kb .
You could dig around the source for NetBeans. The profiler does real time graphing of various things such as memory usage.
SWT XYGraph can plot data with your own data provider, so you can create a real time data provider providing live data. With SWTChart and JFreeChart, you have to prepare the whole array for it.
This question has been answered well in:
Java Real time graph plotting
As VisualVM includes a Charting API, and this API is included in the JDK, you have a good/fast charting API available.

Software Synth Library for Java [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I've been thinking a lot lately about a music-oriented project I'd like to work on. Kind of like a game... kind of like a studio workstation (FL Studio, Reason).
I guess the best way to describe it would be: like "Guitar Hero", but with no canned tracks. All original music--composed by you, on the fly--but the software would use its knowledge of music theory (as well as some supervised learning algorithms) to make sure that your input gets turned into something that sounds great.
It sounds a little silly, explaining it like that, but there ya go. It's something I think would make an interesting side project.
Anyhow, I'm looking for a Java library for generating the actual audio. Browsing around on sourceforge, there are countless software synths, and I have no idea which to choose.
My top priority is that it should sound incredible... Really rich, layered, textured synths, with gobs of configurable parameters. Emulation of acoustic instruments is not important to me.
My second priority is that it ought to be straightforward to use strictly as a library, with no GUI involved at all. (If there's a synth with really breathtaking output, but it's tightly-coupled with a GUI, then I might consider ripping the audio portion out of the application, but I'd rather start with a nicely contained library).
I know I could send MIDI to a standalone synth, but I think it'd be cool to read the actual synth code and learn a little DSP while I'm at it.
Any suggestions?
Oh yeah, I'm on Windows, so posix-only stuff is a no go.
Thanks!
Have you checked out JFugue? It's an "open-source Java API for programming music without the complexities of MIDI".
Additional information: Found a couple of other resources referenced in the JFugue documentation (pdf):
Audio Synthesis Engine Project: open source version of Java’s MIDI synthesizer
Gervill: open source software synthesizer created as a proposal for the Audio Synthesis Engine Project
Yeah, I noticed JFugue a few years ago. It's on my list of interesting computer/music bookmarks:
http://delicious.com/BenjiSmith/computermusic
http://delicious.com/BenjiSmith/programming.java.libraries.music
But JFugue is all about the structure of the music itself... the melodies, harmonies, rhythms, etc....
What I'm looking for right now is just the synthesizer. Something like this...
Synth s = new Synth();
Instrument i = s.getInstrument("Robot Bass");
i.makeAwesome(true);
And then I'll send my events into the MIDI stream (or into whatever control API the synth library provides).
If Clojure is an acceptable option (runs on the JVM, easy to integrate with Java), then it's definitely worth checking out Overtone.
It uses SuperCollider as the synthesis engine, but wraps it all in a nice DSL and interactive programming environment.
minim isn't exactly a java synth, but it is a processing lib and I imagine that it should be pretty easy to use with vanilla java too.

Categories

Resources