Interesting. I was using SoundSystemJPCT while you use SoundSystem. I took the version of the files you use, switch to using SoundSystem and now it plays my small .ogg files. I wonder if this means there is a bug with SoundSystemJPCT?

All the same thank you very much for your help gouessej! I can use fades with SoundSystem so I think I'll stick to just that. I get the jittery sound bug using Java Sound so I think I'll continue using OpenAL.

Sorry for the late response, I just got back from vacation. CWolf, I expect the problem was because SoundSystemJPCT ships with the CodecJOgg plugin by default rather than CodecJOrbis. The reason for this decision was that although JOgg has several compatibility problems (such as with short .ogg files) it has a much less restrictive license (pretty much do what you want). By comparison, JOrbis is licensed by the LGPL (not as bad as the GPL, but it still requires the developer to provide users with a way to swap out the JOrbic code with other/newer versions). If you can live with those restrictions, you can always tell SoundSystemJPCT to use CodecJorbis instead, using the setCodec method (must be done after SoundSystemJPCT is instantiated, or it will just switch back to CodecJOgg. Alternately, you could just edit the constructor method so it loads JOrbis instead of JOgg) That being said, I personally feel like SoundSystemJPCT is rather bloated, and would recommend using the core library anyway, and just add the features you need for your particular project.

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

Wow, this library is great, just what I've needed. Just one thing: is there any way to load a sound from a normal absolute file path? E.g., "/home/maskull/projects/whatever.wav"? It seems like the only options are to load from a URL (which doesn't seem to accept file:// URLs) or from within the JAR. Unless I'm missing something obvious (as usual).

I tried using a file URL, but apparently it only works if you prefixed the file path with "file:/", NOT if you use "file://". Or maybe it's just something strange about my setup? I'm pretty sure that the localhost/port 8080 URL will only work if you're running a local webserver. Anyway, this works for me:

I tried using a file URL, but apparently it only works if you prefixed the file path with "file:/", NOT if you use "file://". Or maybe it's just something strange about my setup?

That's probably because the file:// version isn't a valid URI. The URI spec is file://host/path If you don't have a host (which most file URIs don't) you can omit host and just start with file:/ or leave it empty and start with file:///

Or simply put for the majority of cases, 1 or 3 slashes is valid, 2 isn't.

Hi Paul, I have a quick question. How well tested is the SoundSystem on Linux (Ubunbu in my case)? I'm trying to test it in Ubuntu and I get a problem with the JOrbis codec initialisation (CodecJOrbis). Would you have any ideas on this issue? Everything works great in Windows.

I use Ubuntu as well, so it has been tested more on Linux than in Windows from my end. This is the first time this problem has been reported. Let me put together some tests for you to run to try and track down the source of the problem.

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

Thank you! I appreciate the help . I'm not able to work on this until the weekend but I'll try swapping out Jorbis for Jogg codecs to see if that makes a difference when I get home from being away with work.

First off, I want to express my deep appreciation to you (Paul) for not only writing this code and making it available, but also for the well-written documentation. I just finished reading "3D Sound with SoundSystem" and am gung-ho to give the library a try with my puzzle game http://www.java-gaming.org/topics/hexara-work-in-progress/23676/view.html which badly needs the ability to use compressed sound resources.

One of the things I intend to do is to loop a continuously-sounding (no silent spots) background of about 30 seconds. However, instead of a direct end-to-end connection for the looping, I intend a slight overlap of approximately a quarter second. The sound was recorded with endpoint fades with this usage in mind. A crossfade overlap minimizes the chance of an audible click or glitch in the sound marking the looping point.

I thought I'd check first to see (1) if you had already implemented something along these lines; and (2) if I succeeded in creating a "simple" version, would it be a useful addition? The function would consume, at the least, for the moment of overlap, two streaming channels. The command might be something along these lines:

Thus, if ambientPad.ogg takes 30 seconds, the startOverlapTime might be set to 29800 msec and the fadeTime might be 200 msec. From 29800 to 30000, the first instance of ambientPad.ogg would be attenuated and reset and a second instance would be faded in. Then, after another 29800 msec, the second instance starts fading out and the first instance restarts with a fade in, the cross fade again taking 200 msec.

The alternative form (omitting the optional fadeTime), would simply start the second instance at the designated time and allow the first instance to end naturally, alternating as before. This form could be used by people who have already built fades into their sounds.

What do you think? I'm quite open to suggestions! I did this in Hexara with .wav "Clip" objects in the javax.sound.sample library. I'm hoping to recreate this with your library, taking advantage of the OGG playback.

"We all secretly believe we are right about everything and, by extension, we are all wrong." W. Storr, The Unpersuadables

philfrei, that is actually a really good idea. The SoundSystem already has a "stream queue" implementation, so it shouldn't be too difficult to extend that capability to allow a fade out/in between the items in the queue. I'll look into this when I have the time. Unfortunately, I may not have any time for programming for a couple of weeks, because I am preparing for a six-month deployment in the beginning of March. I am bringing my netbook with me, which has all the tools I need on it, so I should be able to continue further development in my free time while I'm there.

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

I have fixed my problem. I was using 'sounds/' as my package instead of 'Sounds/'. Since Windows isn't file system case specific it didn't have any problem finding my sounds while since Linux is file system case specific it failed to find my sounds. Easily fixed. Thanks.

It's been a while since I worked on this part. I'll have to look at it a little more closely. My guess from the output though is that the mixer it picked only allows a certain amount of lines to be created and I'm not closing them correctly before creating new ones.

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

It's been a while since I worked on this part. I'll have to look at it a little more closely. My guess from the output though is that the mixer it picked only allows a certain amount of lines to be created and I'm not closing them correctly before creating new ones.

Thanks. Let me know whether switching to JOAL + OpenALSoft would be a more viable option than trying to use JavaSound with OpenJDK.

Oh, cool. Let me know if there are any other problems with OpenJDK. I really should work on finishing my own software mixer. I got a little burned out on the project and never got around to working out all the bugs.

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

Oh, cool. Let me know if there are any other problems with OpenJDK. I really should work on finishing my own software mixer. I got a little burned out on the project and never got around to working out all the bugs.

I now systematically test my game both on OpenJDK and Oracle Java Let me know when your software mixer is ready, I'm impatient to give it a try, especially if it allows to overcome some JavaSound limitations. Thank you very much for your great API.

Oh, cool. Let me know if there are any other problems with OpenJDK. I really should work on finishing my own software mixer. I got a little burned out on the project and never got around to working out all the bugs.

When I use OpenJDK, each sound is played correctly only the first time. Does it use PulseAudio? Do you think using JOAL would allow me to work around this limitation? Best regards.

When I use OpenJDK, each sound is played correctly only the first time. Does it use PulseAudio? Do you think using JOAL would allow me to work around this limitation? Best regards.

In case anyone else has the same problem, this is a problem with the available hardware mixers - basically it only let's you create a certain number of lines/ clips, after which they stop playing, no matter what you do to delete or shut down the earlier lines -- and with no error messages or anything. I've not gotten my own software mixer to work yet -- pure Java just seems to be too slow for this type of operation.

The reason I have to be able to create new lines rather than reusing the old ones, is because there doesn't seem to be a way in the API to change the audio format of an existing line. This isn't a problem on the Java Sound Audio Engine mixer, because I can kill the previous line and create a new one. Unfortunately, the Java Sound Audio Engine is only available on normal Sun Java, not on alternate versions such as OpenJDK. I'm creating a new Library plug-in for non-Sun versions of Java which requires the user to have all their audio files in the same format (so I could reuse the lines). I might eventually work this into the existing LibraryJavaSound plug-in with a configuration option, depending on how extensive the changes turn out to be.

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

LMFAO, awesome. I don't see the algorithm itself published anywhere though (proprietary technology, maybe?)

I guess with the explanation for how it supposedly works (brain picking up on differences in amplitude and phase offset), I could try to "reinvent" the algorithm from scratch (knowing the direction vector a source is coming from and assuming the average speed of sound, attenuation at sea-level, and distance between the ears, it should be a matter of applying some trigonometry and a logarithmic function).

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

I did some tests with it, and the difference between the time the soundwaves reach your ears is about 0.3ms (max!).

It's amazing your brain can pickup these tiny differences.

The result is not really convincing though. You have to simulate sound waves inside your skull for it to be truely believable, as in not being able to distinguish what you hear through the *headphones* and some reallife positional sound source. The illusion immediately breaks when you turn your head, as all the offsets are off.

Hi, appreciate more people! Σ ♥ = ¾Learn how to award medals... and work your way up the social rankings!

To be honest, though, I think for many applications the need to keep your head in a constant orientation wouldn't be a huge problem. For example, when you are intently focused on an action game, you aren't really looking around the room all that often (and when you do, you are probably paying attention to something besides the game anyway, so it wouldn't matter much if the illusion is broken at that point).

Were you working with the actual catera algorithm, Riven, or "reinventing" it so to speak?

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

To be honest, though, I think for many applications the need to keep your head in a constant orientation wouldn't be a huge problem. For example, when you are intently focused on an action game, you aren't really looking around the room all that often (and when you do, you are probably paying attention to something besides the game anyway, so it wouldn't matter much if the illusion is broken at that point).

You're missing the realism you can achieve. When you hear a very realistic sound and can't distinguish it from reality, it's actually likely to look at the 'source' of the audio. You just can't help yourself.

To be honest, though, I think for many applications the need to keep your head in a constant orientation wouldn't be a huge problem. For example, when you are intently focused on an action game, you aren't really looking around the room all that often (and when you do, you are probably paying attention to something besides the game anyway, so it wouldn't matter much if the illusion is broken at that point).

You're missing the realism you can achieve. When you hear a very realistic sound and can't distinguish it from reality, it's actually likely to look at the 'source' of the audio. You just can't help yourself.

Well I think that's the point of doing it . Making it realistic enough . And I think yes, you can help yourself, after getting used to the realism.

Just an example, have you ever tried to make your grandpas play a video game ? In the beginning they'll find themselves "dodging" the bullets/enemies with their body while holding the joystick . After a while they just get used/concentrated enough so they stop dancing with a joystick on their hands .

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