Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (580)
games submitted by our members
Games in WIP (499)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 ... 3 4 [5] 6 7 8
  ignore  |  Print  
  3D Sound Engine  (Read 75212 times)
0 Members and 1 Guest are viewing this topic.
Offline CWolf

Junior Newbie





« Reply #120 - Posted 2011-01-08 16:37:03 »

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.  
Offline paulscode

Senior Member


Medals: 11


Staff Sergeant


« Reply #121 - Posted 2011-01-09 14:36:50 »

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
Offline maskull

Junior Newbie





« Reply #122 - Posted 2011-01-31 03:17:43 »

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).
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline gouessej

« In padded room »



TUER


« Reply #123 - Posted 2011-01-31 10:34:54 »

You can create an URL from a file path as far as I know.

Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 12


Game Engineer


« Reply #124 - Posted 2011-01-31 21:03:42 »

You can create an URL from a file path as far as I know.
Yes you can.

http://download.oracle.com/javase/6/docs/api/java/net/URL.html

You can use file:// to get a file from the disk, just like from a browser. You can even use http://localhost:8080/myfile if you want, although I don't know if the latter always works.

See my work:
OTC Software
Offline maskull

Junior Newbie





« Reply #125 - Posted 2011-02-01 05:12:49 »

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:

1  
2  
URL url = new URL("file:/" + path_to_file);
mySoundSystem.backgroundMusic("music", url, "filename.wav", true); // or whatever
Offline nsigma
« Reply #126 - Posted 2011-02-01 13:56:02 »

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.

Got bitten by this one myself a while back.

Best wishes,  Neil

Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Offline CWolf

Junior Newbie





« Reply #127 - Posted 2011-02-20 01:26:20 »

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.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
Starting up SoundSystem...
Initializing LWJGL OpenAL
    (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
OpenAL initialized.

Exception in thread "Thread-3" java.lang.NullPointerException
   at paulscode.sound.codecs.CodecJOrbis.initialize(CodecJOrbis.java:259)
   at paulscode.sound.libraries.SourceLWJGLOpenAL.play(SourceLWJGLOpenAL.java:616)
   at paulscode.sound.Library.play(Library.java:706)
   at paulscode.sound.Library.play(Library.java:675)
   at paulscode.sound.SoundSystem.CommandPlay(SoundSystem.java:2076)
   at paulscode.sound.SoundSystem.CommandQueue(SoundSystem.java:2599)
   at paulscode.sound.CommandThread.run(CommandThread.java:121)
Offline paulscode

Senior Member


Medals: 11


Staff Sergeant


« Reply #128 - Posted 2011-02-23 02:11:51 »

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
Offline CWolf

Junior Newbie





« Reply #129 - Posted 2011-02-23 15:52:07 »

Thank you!  I appreciate the help  Smiley.  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.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline philfrei
« Reply #130 - Posted 2011-02-24 21:25:27 »

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:

mySoundSystem.backgroundOverlap("Ambient 1", "ambientPad.ogg", startOverlapTime [, fadeTime])

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.

"Greetings my friends! We are all interested in the future, for that is where you and I are going to spend the rest of our lives!" -- The Amazing Criswell
Offline paulscode

Senior Member


Medals: 11


Staff Sergeant


« Reply #131 - Posted 2011-02-25 11:41:47 »

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
Offline CWolf

Junior Newbie





« Reply #132 - Posted 2011-02-26 00:38:44 »

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.
Offline paulscode

Senior Member


Medals: 11


Staff Sergeant


« Reply #133 - Posted 2011-02-26 03:31:19 »

Oh good, glad to see it is fixed.  I do need to handle this better though, so the error message indicates the cause of the problem is that the file was not found.

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

« In padded room »



TUER


« Reply #134 - Posted 2011-06-19 16:12:37 »

Hi!

I have no sound on OpenJDK, I get this when I launch my game:
Quote
[INFO] All sound files have been loaded successfully
=== checking the Java Sound System: ===
need: interface SourceDataLine supporting format PCM_UNSIGNED 32000.0 Hz, 8 bit, mono, 1 bytes/frame,
need: interface Clip supporting format PCM_SIGNED 32000.0 Hz, 16 bit, mono, 2 bytes/frame, little-endian
no matching Java Sound AudioMixer found.
searching by properties...
default [default], version 1.0.23: 1 lines supported
default [default], version 1.0.23: 1 clips supported
V8237 [plughw:0,0], version 1.0.23: 4 lines supported
V8237 [plughw:0,0], version 1.0.23: 4 clips supported
...match
Java 2 sound startup failed.

Do you have any idea? How can I fix this bug?

Offline paulscode

Senior Member


Medals: 11


Staff Sergeant


« Reply #135 - Posted 2011-06-21 02:34:01 »

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
Offline gouessej

« In padded room »



TUER


« Reply #136 - Posted 2011-06-21 11:28:36 »

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.

Offline gouessej

« In padded room »



TUER


« Reply #137 - Posted 2011-06-22 00:29:26 »

Sorry, that was my fault. The bug is not reproducible with a more recent version of your library.

Offline paulscode

Senior Member


Medals: 11


Staff Sergeant


« Reply #138 - Posted 2011-06-22 03:10:25 »

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
Offline gouessej

« In padded room »



TUER


« Reply #139 - Posted 2011-06-22 11:05:31 »

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 Smiley 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.

Offline gouessej

« In padded room »



TUER


« Reply #140 - Posted 2011-08-19 23:08:17 »

Hi!

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.

Offline paulscode

Senior Member


Medals: 11


Staff Sergeant


« Reply #141 - Posted 2011-08-29 21:00:56 »

LibraryJOAL, Version update

JOAL library plug-in

- Fixed JOAL package name from the old net.java.games.joal to the new com.jogamp.openal.

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

Senior Member


Medals: 11


Staff Sergeant


« Reply #142 - Posted 2011-08-29 21:13:11 »

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
Offline gouessej

« In padded room »



TUER


« Reply #143 - Posted 2011-08-30 11:31:47 »

LibraryJOAL, Version update

JOAL library plug-in

- Fixed JOAL package name from the old net.java.games.joal to the new com.jogamp.openal.
Thank you very much.

Offline teletubo
« League of Dukes »

JGO Ninja


Medals: 48
Projects: 6
Exp: 8 years



« Reply #144 - Posted 2011-08-31 15:39:27 »

Talking about 3d sound, have you ever tought of trying to implement the cetera algorithm into your 3d sound system ? That would increase dramatically its awesomeness .

Offline paulscode

Senior Member


Medals: 11


Staff Sergeant


« Reply #145 - Posted 2011-08-31 15:49:25 »

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
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 605
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #146 - Posted 2011-08-31 16:08:52 »

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
Offline paulscode

Senior Member


Medals: 11


Staff Sergeant


« Reply #147 - Posted 2011-08-31 16:21:08 »

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
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 605
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #148 - Posted 2011-08-31 16:41:42 »

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.


Were you working with the actual catera algorithm, Riven, or "reinventing" it so to speak?
I just did the math, implemented it and put on my headphones. I wasn't aware of any existing algorithms.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline teletubo
« League of Dukes »

JGO Ninja


Medals: 48
Projects: 6
Exp: 8 years



« Reply #149 - Posted 2011-08-31 16:52:14 »

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 .

Pages: 1 ... 3 4 [5] 6 7 8
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (45 views)
2014-04-15 18:08:23

BurntPizza (41 views)
2014-04-15 03:46:01

UprightPath (57 views)
2014-04-14 17:39:50

UprightPath (39 views)
2014-04-14 17:35:47

Porlus (55 views)
2014-04-14 15:48:38

tom_mai78101 (78 views)
2014-04-10 04:04:31

BurntPizza (137 views)
2014-04-08 23:06:04

tom_mai78101 (237 views)
2014-04-05 13:34:39

trollwarrior1 (198 views)
2014-04-04 12:06:45

CJLetsGame (206 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
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
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!