I want to ask for resources on how to load ogg/mp3 files and play them using the OpenAL facilities in LWJGL. The problem is
I want/need a pure java solution
Would nice if necessary libs are in a maven repo
Wav would be nice, too
Googling for this lead to three pages of Minecraft error questions. So, can anyone hint me here?
There's JOrbis (http://www.jcraft.com/jorbis/) which is pure Java and used by the jmonkeyengine.org project to handle ogg playback.
There is a pure java solution to play mp3 files or convert them to wav. However it might be simpler to use ogg.
Why not use openal with slick and lwjgl? It provides support for aif mp3 wav ogg. There are tutorials on the lwjgl wiki.
Related
I am trying to load sound in LWJGL 3 according to this tutorial ( http://wiki.lwjgl.org/index.php?title=OpenAL_Tutorial_1_-_Single_Static_Source ), but I found a problem that the class WaveData, which was most probably in the older version of LWJGL 2.X, is not there. There for I cant even compile the code. Is there any other way how to load sounds in lwjgl using openAL...
in LWJGL 2 I used to use paulscode sound system ( http://www.paulscode.com/forum/index.php?topic=4.0 ) but I am not sure if it works now in the newer version of LWJGL 3. Thank you for your answer :)
and if there would be any tutorial around sound in lwjgl3, could you please include the link in your answer, I tried googling theese tutorials for ages but I failed.
In a forum post it is stated:
LWJGL3 doesn't include the WaveData from LWJGL2 but it still works the same in LWJGL3, just grab it from the LWJGL2 source code and include it in your project.
So it should be safe to just copy the old WaveData class and use it with LWJGL3, because the loading algorithm and OpenAL internals have not been changed.
Recently, LWJGL included bindings for the STB library. This provides a set of utility functions for different things, like image loading, font loading and perlin noise calculation. It also has an Ogg Vorbis Decoder. Be warned however, that, like OpenGL and GLFW, STB provides only static functions instead of an object-oriented interface. It is also not very optimized.
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!
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
I am looking for OpenCV java bindings, all the references point to the processing library. I know processing is java but isn't there a standalone java lib? or should just use processing libs?
I have just found this, a java wrapper of OpenCV :
https://github.com/bytedeco/javacv
Not tested, but I would love to have your point of view about this.
JavaCV is Java wrapper of OpenCV : https://github.com/bytedeco/javacv
Here is good tutorial on eclipse project configuration for JavaCV
And few applications using JavaCV is also posted there.
OpenCV now has an official Desktop Java port. It is still a work-in-progress and you have to compile opencv, but you should definitely take a look as it will be much friendly than JavaCV.
Take a look at these links for information:
http://answers.opencv.org/question/2137/wrapping-opencv-with-desktop-java-building-for-64/
And this:
http://code.opencv.org/projects/opencv/repository/revisions/fe0d07ae53ba9e6dcd1e470165ed0a85cbfce006
UPDATE (Fev 2013):
Java bindings have been released.
javacv looks pretty good, works with my webcam and images in a custom format. I'm just still looking for a possibility to performant create an IplImage from an array of floats.
I found this forum post where people are attempting pretty much the same thing:
http://nuigroup.com/forums/viewthread/3531/#44302
Is there an easy way to use DirectX in Java? In particular, DirectX's video APIs.
I know that C# might be a more natural choice, but I have my devious reasons for wanting to do something so perverse.
I don't know about easy, but you could always use JNI to load the DirectX libs and invoke the methods.
Using something like Swig you could auto-generate a lot of the code.
Not sure how workable something like that would be though.
There seems to be a standard API about dealing with 3D inside Java.
It probably uses some kind of accelerating technology, may be even DirectX.
But I'm not sure about direct video support in this framework.
I create a library using BridJ (https://bridj.googlecode.com) that wrap DirectX classes, so you can use almost the same code than C++ examples.
You can find the library in https://bitbucket.org/fourthskyinteractive/directx-for-java.
Please, let me know about projects you develop.
There is a set of Direct3D bindings for Java available at http://java-direct3d.sourceforge.net/ but it seems that developement stopped in 2006 with DirectX 9.
Otherwise, there are OpenGL binding for java called JOGL.
The package that you want to investigate is the Java Media Framework (JMF). The core of it is pure Java, and per-platform "performance packs" provide acceleration via native libraries. It currently supports A/V capture and playback in a wide variety of data types as well as streaming via RTP and RTSP.
Sun's JMF home page
JMF SW/HW requirements
Minecraft is coded in Java with LWJGL, but Messiah Andrew's Renderer Wrapper converts the OpenGL to DirectX by using a modified version of the LWJGL libraries. Using these libraries, you should be able to code in LWJGL and have the game be running DirectX.
It seems that most are forgetting that JavaFX and Java3D support both DirectX and OpenGL using the best context for the machine you are on... well actually if you are on windows it attempts to load DirectX if it is newer than your OpenGL version.
I am not telling anyone to use either Java3D or JavaFX, but if you look at the source you can see how it is done.
GrepCode "good for looking for how things are implemented"
Open JavaFX "Open JavaFX project home" source
I should note that you want to look at the com.sun.prism package.
Java3D "Java3D project home" sources
I have been LEARNING development, LOL, for 20 years. Professionally for about 8 possible has never been the question, but how long, and/or is it worth it... Those are the questions.
Good luck my friend!
If you need any help I would be interested in creating a DirectX wrapper for java so
GIVE ME A SHOUT!