This is a 3D sound system for Java which provides a common interface to various 3rd-party sound and codec libraries. It is free to use in any project, commercial or otherwise, and the sourcecode is included in the following links.

Downloads:

Sound SystemVersion date:October 23, 2010The core SoundSystem library, independent from 3rd-party libraries. It is stripped down to the bare essentials, and designed to be easily customizable with various sound library and codec plug-ins. If memory is a concern (such as in an applet) this may be a good option, because it allows you to choose as many or as few plug-ins as you require for your project. NOTE: The core SoundSystem library without any plug-ins is only capable of playing MIDI files. Additional plug-ins should be added for more capabilities. The source code and license are included in the .zip file.

Sound System jPCTVersion date:October 23, 2010The jPCT-friendly 3D sound library. The SoundSystemJPCT class overrides the core SoundSystem libray, and provides a number of methods to make adding 3D sound to any jPCT project easy. It includes methods for binding Listener to Camera and Sources to Object3Ds, as well as using SimpleVector parameters. SoundSystemJPCT utilizes the LWJGL binding of OpenAL (with JavaSound as a backup option), and the J-Ogg library for .ogg support. NOTE: The core SoundSystem library, source code, and all relevant licenses are included in the .zip file.

JavaSound library plug-inVersion date:October 23, 2010Interface to the Java Sound API. More compatable than OpenAL, but not as high quality and fewer features. This plug-in utilizes JavaSound's panning and volume control methods to simulate an reasonable-quality 3D sound system. Known bug: quickPlaying sounds will begin playing them at full volume for a split second, before switching to the correct volume. This is a bug with the Java Sound API itself, and therefore beyond my control to correct. An easy workaround is to add 0.02 seconds of silence to the beginning of each sound effect (the free Audacity sound editor works well for this).

LWJGL OpenAL library plug-inVersion date:August 24, 2010Interface to the LWJGL binding of OpenAL. The LWJGL library (http://www.lwjgl.org) is required for this plug-in to work. This library sounds much better than Java Sound, but is not as compatable. I recommend using the JavaSound library plug-in as a backup option. NOTE: Please read the included LWJGL license.

JOAL library plug-inVersion date:August 29, 2011Interface to the JOAL binding of OpenAL. The JOAL library (http://jogamp.org) is required for this plug-in to work. As mentioned previously, this library sounds much better than Java Sound, but is not as compatable. I recommend using the JavaSound library plug-in as a backup option. NOTE: Please read the included JOAL license.

JOgg codec plug-inVersion date:August 24, 2010Adds support for .ogg files using the J-Ogg library. This codec is less compatible than the JOrbis codec, but the license is less restrictive. Sometimes running incompatable .ogg files through a converter will make them compatable. NOTE: Please read the included JOgg license.

JOrbis codec plug-inVersion date:November 23, 2010Adds support for .ogg files using the JOrbis library. More compatible than the JOgg codec, but reads data more slowly (it may not be possible to stream more than one file simultaneously when using this codec). This plug-in is licensed by the LGPL. NOTE: Please read the included LGPL document.

IBXM codec plug-inVersion date:August 24, 2010Adds support for Protracker, Fast Tracker 2, and Scream Tracker 3 (.s2m, .mod, and .xm) files using the IBXM library. File sizes for these formats tend to be quite small, so this may be a good option for background music. This plug-in is based on or using the IBXM library, which is bound by the BSD License. NOTE: Please read the included license document.

- Fixed JOAL package name from the old net.java.games.joal to the new com.jogamp.openal- Updated CodecWav link to current version- Improved LibraryJavaSound performance slightly in non-Sun Java versions- Handled rare pan-control exception- Fixed fadeOutIn bug which caused fade-in effect to be silent- Fixed a bug where certain types of .ogg files created in versions of Audacity were cut off just before the end of the sample

We love death. The US loves life. That is the difference between us. -Osama bin Laden, mass murderer

- Finished writing the long-awaited tutorial guide for SoundSystemJPCT.- Corrected a thread synchronization problem that caused occasional NulPointerExceptions when temporary (quickPlay) sources were bound to Object3Ds.- Fixed a bug in the JavaSound library plug-in where ambient sources were 3D panning between left and right speaker rather than being ambient.- Fixed a problem in bindListener where the listener did not initially match the camera until tick() was called for the first time.- Eliminated a long pause that was being added to the end of streaming sources when using the Wav and J-Ogg codec plug-ins.

We love death. The US loves life. That is the difference between us. -Osama bin Laden, mass murderer

At the request of a couple of users, I added the ability to manipulate pitch. This is a useful feature, because making slight random pitch changes when playing sound effects can help reduce the repetitiveness and make a game's sound effects more believable. Also, this could potentially be used to create a "Doppler effect" for moving sources.

possible values for pitch are 0.5f - 2.0f (where 1.0f is normal pitch). Changing the pitch also changes the playback speed. I uploaded the updated SoundSystem core and library pluggins. The links in my initial post are still the same.

Since there are already several people using SoundSystem in their projects, I don't want to break the existing quickPlay method by adding in a parameter for initial pitch if it isn't necessary. The following can be used instead:

1

soundSystem.setPitch( soundSystem.quickPlay( ... ), initialPitch );

This works fine on my computer, but if there winds up being latency problems with this method on slower machines, I will go back and change the quickPlay method.

We love death. The US loves life. That is the difference between us. -Osama bin Laden, mass murderer

At the request of a user, I added a new 'loadSound( String identifier, URL url )' method and uploaded the updated library. This allows you to use a URL instance rather than specifying a String filename parameter. The links on my original post are still the same. Changes were applied to the SoundSystem core and all library plug-ins. The 'String identifier' parameter must end in the file's extension (example "whatever.ogg"), so SoundSystem knows what codec to use when reading from the URL. This identifier can be used for the 'String filename' parameter in the newSource and quickPlay methods.

We love death. The US loves life. That is the difference between us. -Osama bin Laden, mass murderer

Today I finished a major update to the SoundSystem. I wrote a new class to make switching between String filename/identifier and URL on the fly very easy. I worked it into all the streaming methods and the MIDI channel stuff (as well as reworking the loadSound method to use this new setup), so now either URLs or filenames can be used with all types of sources (MIDI, normal, and streaming). Everything seems to be working after running several quick tests. However, since the change was rather extensive (I ended up editing almost every class), I need to spend some time doing more extreme testing to make sure the library is still stable and all features work. I also have a couple more small additions I want to add before the next release.

We love death. The US loves life. That is the difference between us. -Osama bin Laden, mass murderer

-Made it so initializing OpenAL plug-ins will notify when AL_PITCH is not supported-Fixed vorbis-header compatability issue with OGG files generated by Audacity-Improved error-handling in multiple classes-Updated and added multiple classes to allow user to specify either String filenames or URL instances-Added new class to associate filename/identifier with URL-Improved MIDIChannel class - searches for alternate sequencer/synthesizer if defaults don't work-Added a new method for feeding raw audio data directly to a channel through streaming sources-Added a new source-creation method to produce streams that can be fed directly with raw audio data-Added a new SoundSystemUtils library which includes an XML loader-Corrected problem in LibraryJavaSound plug-in where sources would only play once-Corrected channel-source association bug which caused rare odd behaviors

We love death. The US loves life. That is the difference between us. -Osama bin Laden, mass murderer

Ok, I solved the problem. This logic error has actually been in the code for a very long time, but it never manafested itself until now. I had to change the CommanQueue/ManageSources infrastructure to correct it, so any legacy code that extends the SoundSystem class for customized source management models will most likely now be broken. If this causes problems for anyone, please refer to the JavaDoc for the proper new way to do custom source management, or post questions here for help. Sorry any inconvenience this causes.

I fixed one more minor bug - a looping MIDI source without any sequences its play queue wasn't looping. I went ahead and uploaded the fixed JAR and sourcecode (only the SoundSystem core was affected by the change).

Also, I finished my new and improved Helicopter Balls applet (taking the silliness to a whole new level):

Another plugin that would be nice would be one for the IBXM library (for .mod files).

It's a library and player released under LGPL here and apparently under BSD license here.

I thought I would look into that IBXM library, but I'm having a little trouble finding where to download the actual source code. The first site you listed has no downloads at all that I can see, and the second one you listed (which is linked to by the first one, BTW) only has a link to download the compiled JAR but no source code. I am little confused, not only by the fact that the project is listed under two different licenses, but also because both of those licenses are supposedly "Open Source" licenses, which should mean the source code is available to download from somewhere.. If you happen to know where I can get my hands on the source, let me know. In the mean time, I'll keep digging around to see if I can find it. I suppose I could write an IBXM plug-in that requires that external JAR, but I would prefer to drop the source into my JAR to make things a bit easier for the user.

We love death. The US loves life. That is the difference between us. -Osama bin Laden, mass murderer

The jar contains both source and class files. There may need to be some tweaking of the source (I think it tries to grab source data line thingies directly for playback), but if it's available under BSD license I suppose that's no big deal.

I finished writing a codec plug-in based on the IBXM library. I haven't had time to test it very extensively yet, but the IBXM library is quite intuitive so I don't forsee any problems. Let me know if something doesn't work properly.

IBXM codec plug-inVersion date:October 13, 2009Adds support for Protracker, Fast Tracker 2, and Scream Tracker 3 (.s2m, .mod, and .xm) files using the IBXM library. File sizes for these formats tend to be quite small, so this may be a good option for background music. This plug-in is based on or using the IBXM library, which is bound by the BSD License. NOTE: Please read the included license document.

We love death. The US loves life. That is the difference between us. -Osama bin Laden, mass murderer

This message indicates that you are not linking with the LWJGL. You can download it from http://www.lwjgl.org. Also, if this is for an application, make sure to use the proper natives for LWJGL.

In SoundSystemJPCT, the zero-parameter constructor does automatic compatibility checking for LWJGL OpenAL first, and then Javasound, so you must link with LWJGL to use this constructor. If you know you will not be using LWJGL, then use the second constructor in which you specify the library plug-in to use (i.e. LibraryJavaSound.class for "software mode").

--EDIT--Hansdapf, I am looking into you problem, and I'll post a fix after I figure out what is causing it.

We love death. The US loves life. That is the difference between us. -Osama bin Laden, mass murderer

This message indicates that you are not linking with the LWJGL. You can download it from http://www.lwjgl.org. Also, if this is for an application, make sure to use the proper natives for LWJGL.

From the PDF:

Quote

SoundSystemJPCT will automatically try to load LWJGL OpenAL “hardware mode”,and if that fails, it will switch to JavaSound “software mode”.

I thought that meant that if lwjgl was available it will use it otherwise java sound, but what it really means, is that if no hardware accelerated sound is available for OpenAL it will fallback to java sound?

Also, the example applet has crashed (or shut down) my entire collection of browsers twice. Is there a Systems.exit() somewhere in the code? If so, it should probably be skipped for applet versions! Was thinking about using it in applets, so this is quite important to me, whatever the reason was that it was shut down.

I wanted to use this to be able to change the sample rate on sounds. With java Clip I get:clip.isControlSupported(FloatControl.Type.SAMPLE_RATE) == falseI am not sure what makes it impossible to change sample rate, but I guess it is hardware related. Do you know if I would be able to change the sample rate with this tool using OpenAL in lwjgl on the same rig?

What is the smallest footprint one can get away with for an applet? Currently my applet <300k and I wouldn't want to multiply the dl size too many times just to play a soundclip at different frequency.

From the PDF:I thought that meant that if lwjgl was available it will use it otherwise java sound, but what it really means, is that if no hardware accelerated sound is available for OpenAL it will fallback to java sound?

Currently, the compatibility checking for both OpenAL plug-ins check if OpenAL is able to work on the user's machine - it assumes you as the developer have linked your program with the proper external library. I suppose I could change this, if I can determine an elegant way to detect if the developer has linked with the LWJGL library or not. It just seems obvious to me that if you as the developer know that you are not linking with the LWJGL library, then why would you need to run the compatibility check for the LWJGL OpenAL plug-in anyway? It would always be incompatible in that case.

Also, the example applet has crashed (or shut down) my entire collection of browsers twice. Is there a Systems.exit() somewhere in the code? If so, it should probably be skipped for applet versions! Was thinking about using it in applets, so this is quite important to me, whatever the reason was that it was shut down.

There is no Systems.exit() called anywhere in the code. Which library plug-in are you using when the problem occurs? I have heard about this happening when using the OpenAL plug-ins, and I have assumed that it is because you are linking with an external native library which requires you to disconnect when you are finished with it. There is a SoundSystem.cleanup() method that you should always call in your program when you are finished with the SoundSystem, to properly shut down OpenAL . However, if your problem is happening when using the JavaSound plug-in, then that would be a new bug. Just let me know if that's the case, and I'll look into it.

I wanted to use this to be able to change the sample rate on sounds. With java Clip I get:clip.isControlSupported(FloatControl.Type.SAMPLE_RATE) == falseI am not sure what makes it impossible to change sample rate, but I guess it is hardware related. Do you know if I would be able to change the sample rate with this tool using OpenAL in lwjgl on the same rig?

What is the smallest footprint one can get away with for an applet? Currently my applet <300k and I wouldn't want to multiply the dl size too many times just to play a soundclip at different frequency.

A smaller footprint would be to use the core SoundSystem library linked with the specific plug-ins that you need (for example LibrayJavaSound and CodecJOgg), rather than using the full SoundSystemJPCT extension. The truly smallest footprint would be to copy and paste only the parts of code that you need, which you are allowed to do with the very libral license that I put on the library. It just depends on your needs and how much effort you want to put into it. SoundSystemJPCT is easiest option if you are using it in a jPCT project, but it also has the largest footprint.

We love death. The US loves life. That is the difference between us. -Osama bin Laden, mass murderer

This is really strange. It seems from your output, that calling MidiSystem.getSequencer();, an InterruptedException is being thrown. This looks to be a thread synchronization problem related to the Command Thread infrastructure. The only place I can see that I am telling that thread to sleep, though, is from inside its run() method after processeng all the commands. I can't figure out how it us being put to sleep somewhere between when the command began processing and when the call to MidiSystem.getSequencer() was called.

I suppose a second possibility here is that the InterruptedException happened on a different thread, and Java Sound is just forwarding that message back to the user rather than ignoring it.

Let me write some smaller test programs when I have a little time. I'll have you run them and hopefully pinpoint where the problem is comming from.

We love death. The US loves life. That is the difference between us. -Osama bin Laden, mass murderer

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org