Author Topic: 3D Sound System  (Read 185680 times)

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #345 on: August 22, 2010, 05:13:46 am »
Sound System, Major Update, Beta Release

Sound System jPCT
Sound System

JavaSound library pluggin
LWJGL OpenAL library pluggin
JOAL library pluggin

WAV codec pluggin
JOgg codec pluggin
JOrbis codec pluggin
IBXM codec pluggin

JavaDoc

I am calling this a beta release, because this has been one of the biggest overhauls of the library yet, and I fully expect there to be bugs.  I'll post additional updates in the coming days and problems are discovered.  I'm working on updating the tutorials as well.

There have been extensive changes since the last release.  I'll try and explain all of them quickly.

The big/important changes:

1) I fixed the incompatibility introduced back in LWJGL 2.3 when they stopped supporting indirect buffers.
2) I added a Doppler effect algorithm to LibraryJavaSound using sample-rate controls.  Note: normal sample-rate ranges in JavaSound are 4KHz - 48Khz, so this can effect how well certain sound effects do with the Doppler effect.
3) I implemented a standard interface for Doppler effect, which can now be used with all library plug-ins.  There are also new Doppler-effect interface methods in SoundSystemJPCT with SimpleVector parameters in jPCT's coordinate system.
4) I implemented a new stream-listener interface, which enables listening for End of Stream events (most useful for playing a sequence of music clips)
5) I added in an intelligent auto-search for common MIDI synthesizers when the default is missing.  This makes MIDI possible on non-Sun Java versions (such as OpenJDK)
6) I added the ability to create normal sources from raw PCM data.  Most useful for playing procedurally-generated sound effects.
7) I added the ability to check the millisecond position of any playing source
8) I added a Mixer ranking system, and an intelligent Mixer-picking based on the functions compatible with each Mixer.  This allowed an intelligent work-around for the Java Sound "webcam chosen as default Mixer" bug, as well as the fact that non-Sun Java (such as OpenJDK) may not have the "Java Sound Audio Engine" mixer available.

Additional changes:

1) I fixed a reverse-byte-order bug in CodecIBXM which caused some sounds to be loud and scratchy.
2) I fixed a bug where switching libraries caused pre-loaded sounds not to re-load.
3) I fixed various bugs when running 64-bit Java plug-in for Firefox on Linux.  There are still more (see below).
4) I added an error message when attempting to load a missing file from the JAR.  Before it acted as if there were no problem if a file was not present.
5) I added in a workaround for the Java Sound bug where a random InterruptedException is sometimes thrown when trying to access the default MIDI sequencer.
6) I added a varriable to SoundSystemCongfig for specifying which MIDI synthesizer to try first
7) I fixed the message-flooding bug that would happen when Mixer controls are not available.
8) I fixed various potential thread-synchronization bugs.

There are still several know issues with 64-bit Java on Linux which I am currently working on, including:

1) No MIDI
2) Random blocking for a half-second every few seconds
3) No sound from Java Sound when switching from OpenAL to Java Sound on the fly
4) JFrame 'paint' method causes system graphics to go wacky when playing JavaSound, and can even result in a complete OS lock-up requiring reset.

Please let me know if you run into any problems, and I will work on correcting them right away.
« Last Edit: August 22, 2010, 01:17:04 pm by paulscode »

Offline zammbi

  • float
  • ****
  • Posts: 360
    • View Profile
Re: 3D Sound System
« Reply #346 on: August 22, 2010, 08:34:20 am »
Have you updated the links? I replaced the libraries but still getting the openAL error.
The modified date inside the zip all show 2009.

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #347 on: August 22, 2010, 12:51:51 pm »
That is really weird..  I FTP'ed all the files yesterday, but just now downloaded them and got the old version ???  Let me try this again..

OK, this makes no sense.

- I delete the files from the server.
- I try to download them from the browser to make sure they are gone.
- I double-check the zip files again to verify it is the current version.
- I FTP the files to the server.
- I download the files from the server and...  old version!???
« Last Edit: August 22, 2010, 01:00:40 pm by paulscode »

Offline zammbi

  • float
  • ****
  • Posts: 360
    • View Profile
Re: 3D Sound System
« Reply #348 on: August 22, 2010, 01:01:00 pm »
Quote
That is really weird..  I FTP'ed all the files yesterday, but just now downloaded them and got the old version   Let me try this again..
Ah good then its not just me :)

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #349 on: August 22, 2010, 01:20:52 pm »
Ok, I have no idea why the old version is being cached and sent instead of the new version.  It must be a bug with either my FTP program or the server, I'll have to try and track it down.

In the mean time, I changed to links to point to the 21 August version archive directory instead of the "latest version" directory, and that seems to be working.  Give it a shot and let me know if you are still getting the old version.

Offline zammbi

  • float
  • ****
  • Posts: 360
    • View Profile
Re: 3D Sound System
« Reply #350 on: August 22, 2010, 01:29:04 pm »
Yeah hardware mode is working  :D
My XM music is also sounding better. Thanks for your hard work.

Btw it seems IBXM is the old version and its now called Micromod-j:
http://sites.google.com/site/mumart/

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #351 on: August 22, 2010, 01:34:38 pm »
Yeah hardware mode is working  :D
My XM music is also sounding better. Thanks for your hard work.

Btw it seems IBXM is the old version and its now called Micromod-j:
http://sites.google.com/site/mumart/

Good to see the downloads are working.  I'll take a look at Micromod-j, thanks for the link.

Offline zammbi

  • float
  • ****
  • Posts: 360
    • View Profile
Re: 3D Sound System
« Reply #352 on: August 23, 2010, 04:07:42 pm »
I found a great Java voice codec: http://jspeex.sourceforge.net/index.php
I'm going to look into adding some voices to my game.
Wondering if you want to add this codec to your great library?  ;)

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #353 on: August 23, 2010, 08:56:18 pm »
This is for reading files that are compressed way down using the assumption that voice only ranges from 2 to 44 kbps.  Very interesting.  I thought it was a speech synthesis library at first glance..
« Last Edit: August 23, 2010, 09:21:02 pm by paulscode »

Offline zammbi

  • float
  • ****
  • Posts: 360
    • View Profile
Re: 3D Sound System
« Reply #354 on: August 23, 2010, 11:47:37 pm »
Quote
This is for reading files that are compressed way down using the assumption that voice only ranges from 2 to 44 kbps.
Yeah, I'm going to add voice to my game. I wanted to use speech synthesis but the voices are large on good quality. So instead I'll use the speech synthesis and compress the sound. I saw Speex was good for compressing voice and they had a Java version.

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #355 on: August 24, 2010, 12:18:11 pm »
I am in the process of writing a codec plug-in for JSpeex.  It is a fairly low-level library, though, so it may take a while for me to understand it well enough to get it functioning properly in the context of an ICodec implementation.  I'll keep you updated

Offline zammbi

  • float
  • ****
  • Posts: 360
    • View Profile
Re: 3D Sound System
« Reply #356 on: August 24, 2010, 01:25:52 pm »
Quote
I am in the process of writing a codec plug-in for JSpeex.  It is a fairly low-level library, though, so it may take a while for me to understand it well enough to get it functioning properly in the context of an ICodec implementation.  I'll keep you updated
Woot. Have you got a donations area setup? I can throw a little beer money your way for your troubles.

Offline zammbi

  • float
  • ****
  • Posts: 360
    • View Profile
Re: 3D Sound System
« Reply #357 on: August 24, 2010, 02:11:54 pm »
Oh btw software mode does not work for me. Its just fuzzy now for my XM music.

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #358 on: August 24, 2010, 09:04:13 pm »
Oh btw software mode does not work for me. Its just fuzzy now for my XM music.
This is with the LibraryJavaSound plug-in, right?  I noticed that my previous "fix" actually created another problem, due to some faulty logic on my part when I wrote the system for matching libraries with codecs that produce incompatible data.  I've re-worked the way byte-order reversal works, and I am running tests to make sure it works for all combinations of normal/streaming/LWJGLOpenAL/JOAL/JavaSound.  I'll post an update this evening if all goes well.

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #359 on: August 25, 2010, 03:55:24 am »
Sound System, Bug Fixes, New Plug-in

Sound System jPCT
Sound System

JavaSound library pluggin
LWJGL OpenAL library pluggin
JOAL library pluggin

WAV codec pluggin
JOgg codec pluggin
JOrbis codec pluggin
IBXM codec pluggin
JSpeex codec pluggin

JavaDoc

I fixed the new bug I introduced by trying to fix the IBXM reverse-byte-order bug.  While this is a relatively minor fix, I ended up having to make small changes to nearly every package, so be sure to download all the new versions (in other words, mix-and-match at your own peril).

Additionally, I finished the JSpeex codec plug-in.  Speex-encoded files are generally wrapped into a .ogg container file.  (This is what is produced by the binaries you can download from http://www.speex.org/downloads/).  While I was digging around, I noticed that there is an "experimental" capability for JSpeex to wrap the data into .wav files as well.  Since the .wav format is quite simple to read from (much easier to understand than .ogg), I went ahead and made this codec plug-in useable with either format.  By default, it assumes a .ogg container, but I added a method you can call to use speex-encoded .wav files if you prefer instead.  Just a reminder - these aren't normal .ogg or .wav files (just the header information is), so obviously they will not work with the other codec plug-ins.  I would recommend using a different file extension (like .spx) so you don't get them mixed up with any other non-speex files.

One more note: Speex can also save into "raw" format (i.e., no header information).  I didn't make the codec plug-in support this format because it requires the user to define the header information manually, which doesn't mesh well with SoundSystem.  However, if using the raw format is a requirement for you, let me know and I can look into it more closely to see if there is a way to support it in my codec plug-in.

As always, let me know if you run into any problems, and I will work on correcting them as soon as possible.