Sound Demos

Hi,

Can the CVS also be updated so that the sound demos run correctly out of the box?



ie: Pong revisted had hardcoded file paths, and the fmod fialed for some reason.



Made the following changes:

//import com.jmex.sound.fmod.SoundSystem;

import com.jmex.sound.openAL.SoundSystem;



+



ballSound =

SoundSystem.create3DSample(PongRevisited.class.getClassLoader()

.getResource("jmetest/data/sound/turn.wav"));

explodeSound = SoundSystem.create3DSample(PongRevisited.class.getClassLoader()

.getResource("jmetest/data/sound/explosion.wav"));





ty

Well I made those changes, but for some reason, OpenAL does not seem to like those wav files when I run the test. If I throw in an ogg file it is happy… Anyone else have that issue too?

"renanse" wrote:
Well I made those changes, but for some reason, OpenAL does not seem to like those wav files when I run the test. If I throw in an ogg file it is happy... Anyone else have that issue too?
It sounds fine on my system, what doesn't it like about them? Could this have anything with the requested changes I posted? (They still have not been added to the source... could someone please add them?)

Are you on a mac because the endian solution was added for Mac. We can remove it if you are and things are fine… (I’ll test on my mac as well.)



As for the setPosition, done.



Unfortunate on my windows box, PongRevisited is still not loading up because of an OpenAL error when loading the wav files. I had it print out more info and I get:


INFO: Wav estimated time 0.23577097 rate: 44100 channels: 1 depth: 16
org.lwjgl.openal.OpenALException: OpenAL error: Invalid Value (40963)
at org.lwjgl.openal.Util.checkALError(Util.java:53)
at org.lwjgl.openal.AL10.alBufferData(AL10.java:587)
at com.jmex.sound.openAL.objects.util.Buffer.configure(Buffer.java:67)
at com.jmex.sound.openAL.objects.util.SampleLoader.loadWAV(SampleLoader.java:116)
at com.jmex.sound.openAL.objects.util.SampleLoader.loadBuffer(SampleLoader.java:81)
at com.jmex.sound.openAL.objects.Sample3D.<init>(Sample3D.java:48 )
at com.jmex.sound.openAL.objects.Sample3D.<init>(Sample3D.java:58 )
at com.jmex.sound.openAL.SoundSystem.create3DSample(SoundSystem.java:224)
at jmetest.sound.PongRevisited.simpleInitGame(PongRevisited.java:127)


Seems like the info about the sound is correct, so I'm not sure what to think.

don’t know. OpenAL works ok, but now fmod fails to work for me now.



thanks for fixing:-)



sv

"renanse" wrote:
Are you on a mac because the endian solution was added for Mac. We can remove it if you are and things are fine... (I'll test on my mac as well.)
Yes I'm on a mac, the endian solution is required for wavs, but no longer for OGGs (that's why in that thread I asked for it to be commented out in loadOGG, can you comment it out? lines 159-165 in SampleLoader).
As for the setPosition, done.

Thanks!
Unfortunately on my windows box, PongRevisited is still not loading up because of an OpenAL error when loading the wav files. I had it print out more info and I get:

INFO: Wav estimated time 0.23577097 rate: 44100 channels: 1 depth: 16
org.lwjgl.openal.OpenALException: OpenAL error: Invalid Value (40963)
at org.lwjgl.openal.Util.checkALError(Util.java:53)
at org.lwjgl.openal.AL10.alBufferData(AL10.java:587)
at com.jmex.sound.openAL.objects.util.Buffer.configure(Buffer.java:67)
at com.jmex.sound.openAL.objects.util.SampleLoader.loadWAV(SampleLoader.java:116)
at com.jmex.sound.openAL.objects.util.SampleLoader.loadBuffer(SampleLoader.java:81)
at com.jmex.sound.openAL.objects.Sample3D.<init>(Sample3D.java:48 )
at com.jmex.sound.openAL.objects.Sample3D.<init>(Sample3D.java:58 )
at com.jmex.sound.openAL.SoundSystem.create3DSample(SoundSystem.java:224)
at jmetest.sound.PongRevisited.simpleInitGame(PongRevisited.java:127)


Seems like the info about the sound is correct, so I'm not sure what to think.

Ah, I see you just did what I was going to suggest, commenting out that block (lines 111-117 in SampleLoader) and see if it works. However, doing that will screw up the playback of wav files on Mac systems. For some reason it's returning true to this statement: "ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN" on your system. Perhaps add a different if statement to see if the OS is a Mac only.

it’s seems to be specific to explosion.wav had that problem to the other wav file worked finefor me

"mcbeth" wrote:
it's seems to be specific to explosion.wav had that problem to the other wav file worked finefor me
Well wav files can be either 8 bit or 16 bit. If they're 8 bit there's no problem either way, but if they're 16 bit then on systems like OS X the order of the bits needs to be flipped, that's where that if statement comes in. Whatever other wav file you're talking about is most likely an 8 bit wav file, therefore there's nothing to flip, and it works either way.

edit both turn and explosion.wav now flop footsteps work fine, i’m on win2k, these sound files all worked not too long ago

Hmm, I believe I’m simply going off the lib files checked in. Have you pulled down anything newer? I’ll double check this. It’s just odd that two sound files (Footsteps vs. turn) would have the same basic properties and yet one is unplayable.



But then again, I know I had to tweak my sound files several times in FurBallz to get it playing on both Mac and PC… Ah well.

"renanse" wrote:
Hmm, I believe I'm simply going off the lib files checked in. Have you pulled down anything newer? I'll double check this. It's just odd that two sound files (Footsteps vs. turn) would have the same basic properties and yet one is unplayable.

But then again, I know I had to tweak my sound files several times in FurBallz to get it playing on both Mac and PC... Ah well.
I'm using the files that came with lwjgl 0.96. Hopefully you'll figure out what the problem is, but this isn't really that catastrophic of a problem because OGG seems to work fine for you, and OGG is nice because it so many times smaller than wavs, so I think it's better for distributing with games. Is there any reason one would want to use WAVs instead of OGG?

Not that I know of, but we try to leave as many options open to the developers as we can. :slight_smile:

"renanse" wrote:
Not that I know of, but we try to leave as many options open to the developers as we can. :)
Which is always a good policy :)

Hi,

I tried running HelloIntersection tutorial but keep getting false on the fmod sound load so I changed it to openAL.

Any clues as to why fmod does not seem to work?

//import com.jmex.sound.fmod.SoundSystem; import com.jmex.sound.openAL.SoundSystem;

and

      /** Create program sound */       //targetSound = SoundSystem.create3DSample("./jmetest/data/sound/explosion.wav");       //laserSound=SoundSystem.create3DSample("./jmetest/data/sound/laser.ogg");

        try {

            targetSound = SoundSystem.create3DSample(HelloIntersection.class.getClassLoader()
                    .getResource("jmetest/data/sound/explosion.wav"));
            laserSound = SoundSystem.create3DSample(HelloIntersection.class.getClassLoader()
                    .getResource("jmetest/data/sound/laser.ogg"));
        } catch (Exception e) {
            e.printStackTrace();
        }       

[Code below]



Any clues as to why fmod does not seem to work?


//import com.jmex.sound.fmod.SoundSystem;
import com.jmex.sound.openAL.SoundSystem;



and

      /** Create program sound */
      //targetSound = SoundSystem.create3DSample("./jmetest/data/sound/explosion.wav");
      //laserSound=SoundSystem.create3DSample("./jmetest/data/sound/laser.ogg");

        try {

            targetSound = SoundSystem.create3DSample(HelloIntersection.class.getClassLoader()
                    .getResource("jmetest/data/sound/explosion.wav"));
            laserSound = SoundSystem.create3DSample(HelloIntersection.class.getClassLoader()
                    .getResource("jmetest/data/sound/laser.ogg"));
        } catch (Exception e) {
            e.printStackTrace();
        }       

I am getting the same exception on my Windows XP machine:



INFO: Wav estimated time 0.23577097  rate: 44100  channels: 1  depth: 16

org.lwjgl.openal.OpenALException: OpenAL error: Invalid Value (40963)

at org.lwjgl.openal.Util.checkALError(Util.java:53)

at org.lwjgl.openal.AL10.alBufferData(AL10.java:587)

at com.jmex.sound.openAL.objects.util.Buffer.configure(Buffer.java:67)

at com.jmex.sound.openAL.objects.util.SampleLoader.loadWAV(SampleLoader.java:123)

at com.jmex.sound.openAL.objects.util.SampleLoader.loadBuffer(SampleLoader.java:81)

at com.jmex.sound.openAL.objects.Sample3D.<init>(Sample3D.java:45)

at com.jmex.sound.openAL.objects.Sample3D.<init>(Sample3D.java:55)

at com.jmex.sound.openAL.SoundSystem.create3DSample(SoundSystem.java:224)

at jmetest.sound.PongRevisited.simpleInitGame(PongRevisited.java:126)

at com.jme.app.SimpleGame.initGame(SimpleGame.java:342)

at com.jme.app.BaseGame.start(BaseGame.java:63)

at jmetest.sound.PongRevisited.main(PongRevisited.java:388)



If I change the files to OGGs then it works.  May I suggest if this isn't planned to be fixed in the near future that the example sources reference OGG files instead of WAVs?



Thanks,



darkfrog

sry for posting in such an old thread… but the error still exists… and it seams quite easy to fix (at least to get HelloIntersection to work without modifications)


16.10.2005 00:26:26 com.jmex.sound.openAL.objects.util.SampleLoader loadWAV
INFO: Wav estimated time 2.1685488  rate: 22050  channels: 1  depth: 16
org.lwjgl.openal.OpenALException: OpenAL error: Invalid Value (40963)
   at org.lwjgl.openal.Util.checkALError(Util.java:56)
   at org.lwjgl.openal.AL10.alBufferData(AL10.java:1007)
   at com.jmex.sound.openAL.objects.util.Buffer.configure(Buffer.java:67)
   at com.jmex.sound.openAL.objects.util.SampleLoader.loadWAV(SampleLoader.java:124)
   at com.jmex.sound.openAL.objects.util.SampleLoader.loadBuffer(SampleLoader.java:82)
   at com.jmex.sound.openAL.objects.Sample3D.<init>(Sample3D.java:76)
   at com.jmex.sound.openAL.objects.Sample3D.<init>(Sample3D.java:86)
   at com.jmex.sound.openAL.SoundSystem.create3DSample(SoundSystem.java:256)
   at jmetest.TutorialGuide.HelloIntersection.setupSound(HelloIntersection.java:162)
   at jmetest.TutorialGuide.HelloIntersection.simpleInitGame(HelloIntersection.java:111)
   at com.jme.app.SimpleGame.initGame(SimpleGame.java:348)
   at com.jme.app.BaseGame.start(BaseGame.java:65)
   at jmetest.TutorialGuide.HelloIntersection.main(HelloIntersection.java:107)



Changing explosion.wav to .ogg works as someone already mentioned.. maybe this should be changed in CVS ?

cu
  Herbert Poul
  http://goim.sphene.net

Unfortunately ogg works only sometimes  :? Someone really should work on sound support, but all developers focus on other things at this time (besides it seems to be an openAL issue) . . . if you can help out . . .

OK, I now this is an OLD thread, but I saw some lines related to what I'm experiencing right now.



My game used to run OK both in windows and Mac (not testing under linux yet) but recently I added some more sound FX and when I tried to run in windows there was no sound. No error appeared, but the sound didn't show up (sound up?).



I suspect that maybe is the format of some of the new samples. I had to convert them to WAV with a mac software (VLC). I'll do a proper editing on them later with Wavelab or Cubase. Does it make sense?



And what are the correct WAV formats OpenAL loads? (because there are many)