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

Offline Disastorm

  • long
  • ***
  • Posts: 161
    • View Profile
Re: 3D Sound System
« Reply #375 on: March 31, 2011, 07:30:22 pm »
the file/path is correct, to make sure I even created a file object:

Code: [Select]
     soundSystem = new SoundSystemJPCT();

            File file = new File("scraping-ice-1.wav");
        soundSystem.quickPlay(file.getAbsolutePath(), false);

heres error:

Code: [Select]
Error in class 'LibraryLWJGLOpenAL'
    Unable to open file 'C:\Users\Disastorm\Documents\NetBeansProjects\ProjectDerby\scraping-ice-1.wav' in method 'loadSound'
Error in class 'LibraryLWJGLOpenAL'
    Sound buffer was not created for C:\Users\Disastorm\Documents\NetBeansProjects\ProjectDerby\scraping-ice-1.wav
Error in class 'LibraryLWJGLOpenAL'
    Source 'Source_-842624421_159493175' not found in method 'play'


if I use this xml to load it:

Code: [Select]

<!-- Add a couple of library plug-ins: -->
< addLibrary
className = paulscode.sound.libraries.LibraryLWJGLOpenAL />

< addLibrary
className = paulscode.sound.libraries.LibraryJavaSound />


<!-- Add some codec plug-ins: -->


< setCodec
extension = wav
className = paulscode.sound.codecs.CodecWav />

<!-- Instantiate the SoundSystem: -->
< create />


<!-- Load a clip into memory: -->
    < loadSound
        filename = scraping-ice-1.wav />

using

Code: [Select]
  try {

            soundSystem = new SoundSystemJPCT();
            File file = new File("Example.xml");
            SoundSystemLoader.loadXML(file.toURL(), soundSystem);
        } catch (MalformedURLException ex) {
            Logger.getLogger(SoundSystem.class.getName()).log(Level.SEVERE, null, ex);
        }
            File file = new File("scraping-ice-1.wav");
        soundSystem.quickPlay(file.getAbsolutePath(), false);

I get

Code: [Select]
Exception in thread "main" java.lang.NullPointerException
Error in class 'LibraryLWJGLOpenAL'
    Unable to open file 'scraping-ice-1.wav' in method 'loadSound'
        at paulscode.sound.SoundSystemJPCT.quickPlay(SoundSystemJPCT.java:1591)
        at paulscode.sound.SoundSystemJPCT.quickPlay(SoundSystemJPCT.java:1542)
        at paulscode.sound.SoundSystemJPCT.quickPlay(SoundSystemJPCT.java:1520)
        at paulscode.sound.SoundSystemJPCT.quickPlay(SoundSystemJPCT.java:1377)
        at game.sound.SoundSystem.main(SoundSystem.java:54)

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #376 on: April 02, 2011, 01:15:58 am »
the file/path is correct
...
Code: [Select]
Error in class 'LibraryLWJGLOpenAL'
    Unable to open file 'C:\Users\Disastorm\Documents\NetBeansProjects\ProjectDerby\scraping-ice-1.wav'
...

well...

If you are sure the path and file names are correct, the next thing to check is if you compiled the file into the JAR

Offline Disastorm

  • long
  • ***
  • Posts: 161
    • View Profile
Re: 3D Sound System
« Reply #377 on: April 05, 2011, 02:03:46 am »
even if i give the absolute path i need to put it in the jar?  I can't just run the project in netbeans?

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #378 on: April 05, 2011, 12:26:23 pm »
??  Absolute path implies that it is not in the jar, doesn't it?  If there is some reason you can't/won't compile your resource files in the jar, then why not use one of the methods that take an InputStream argument to load your files?  Also, there's no problem running from within Netbeans.

Offline Disastorm

  • long
  • ***
  • Posts: 161
    • View Profile
Re: 3D Sound System
« Reply #379 on: June 09, 2011, 08:27:08 pm »
Hey I have this mp3 file that i converted to ogg and when i play it (im using backgroundmusic, havnt tried quickplay) right before it starts theres like a split second of a loud screeching sound.  Do you know how I can fix this?  I also tried converting it to wav instead but it still has that sound.

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #380 on: June 10, 2011, 09:00:39 pm »
Wow, I've definitely seen that before, but it's been a while (I'm still shuddering from the flashback I just got after reading your post :D ).  I don't recall off hand what the solution was for this.  Which library plug-in has the problem(or do they both?).  I can run some tests if you upload the file for me to grab.

Offline Disastorm

  • long
  • ***
  • Posts: 161
    • View Profile
Re: 3D Sound System
« Reply #381 on: June 12, 2011, 06:28:24 am »
its the one called Aftermath on this site: http://incompetech.com/m/c/royalty-free/index.html?genre=horror

the download is an mp3 but i converted it to ogg and wav and the screech occurs for both of them.

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #382 on: June 12, 2011, 03:30:05 pm »
I can't reproduce the problem here.  What program are you using to convert the file?  Have you tried another program (such as Audacity)?  Please upload the actual ogg file you are having the problem with so I can see if there is something unique about that particular file's data that could be causing the weird behavior.

Which library plug-in has the problem(or do they both?)
You can get this from the Console output.  I assume you are using SoundSystemJPCT, but that doesn't tell me which library plug-in you are experiencing the problem for, because SoundSystemJPCT will either load the LWJGLOpenAL or JavaSound plug-in, depending on your OS and what components / drivers are installed.  Also, you might try using the CodecJOrbis plug-in to see if it also has the screeching behavior, since JOrbis has been around for a while and is well supported and more compatible than the JOgg codec plug-in which ships with SoundSystemJPCT.

--EDIT--
I decided to read back through this thread to figure out when it was that I experienced this screeching behavior before (3 years and 26 pages worth of history here).  I finally found it, but unfortunately, that earlier problem does not apply to your case, because it was related specifically to playing MIDI through a javascript interface I was working on at the time:
...
4) I was having problems with loud scratching sounds in some browsers the first time a sound is played.  To compensate, I had to make the javascript automatically play a silent MIDI file when it starts up.  This is completely transparent, but you are required to place the file "silence.mid" wherever the javascript is located.
...
« Last Edit: June 12, 2011, 09:42:02 pm by paulscode »

Offline Disastorm

  • long
  • ***
  • Posts: 161
    • View Profile
Re: 3D Sound System
« Reply #383 on: June 13, 2011, 05:15:14 am »
Audacity is already what I used.  here is the file: http://www.sendspace.com/file/6y42tr

This is the library: LWJGL OpenAL

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #384 on: June 13, 2011, 02:38:30 pm »
Thanks.  There is definitely something wrong with that file - the screech happens in every player that I played it in (including Audacity), so I don't think its a problem with the SoundSystem (although I haven't given CodecJOrbis a try yet, but I doubt it will fare any better than CodecJOgg).  What version of Audacity did you use to convert this file, and what OS are you running?  Also, does every file you convert have the screech problem, or just this one?

Give the file below a try and let me know if the screech is gone:
http://www.paulscode.com/downloads/Aftermath.ogg
(I exported it via Audacity 1.3.12-beta compiled on 64-bit Ubuntu Maverick)

Offline Disastorm

  • long
  • ***
  • Posts: 161
    • View Profile
Re: 3D Sound System
« Reply #385 on: June 13, 2011, 11:04:38 pm »
I'm not home right now so when I get home I'll try it.  However, I do know when i tried playing this file in vlc it played without the screech.  In any case, it may be because of an old Audacity version, I will try updating that.  I am on Windows 7 64bit

*edit that fixed it, turns out i was using the non-beta version which doesnt officially support windows 7.  I installed the beta version and it works.  Thanks.
« Last Edit: June 14, 2011, 08:59:41 am by Disastorm »

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #386 on: June 14, 2011, 11:57:35 am »
You're right, it does play correctly in VLC.  It is definitely a file/ codec compatibility issue then (although I don't feel too bad about my library not handling this file since 90% of other players don't seem to either).  I haven't had a chance to try CodecJorbis yet, so you might try it since it is typically compatible with a lot more files than CodecJOgg is.

-edit- glad to see you got it working.  There was another issue with the last frame of audio data in ogg files created in older versions of Audacity, and I was able to adapt CodecJOrbis to handle it, so I'll probably tinker around with that file some more to see if I can figure out what the issue is with the data right there at the beginning (probably just the first frame).  It would be nice to brag that my library can handle files that most other programs cannot :)
« Last Edit: June 14, 2011, 12:33:04 pm by paulscode »

Offline Disastorm

  • long
  • ***
  • Posts: 161
    • View Profile
Re: 3D Sound System
« Reply #387 on: June 17, 2011, 11:10:47 am »
hey is there anything special u do to convert it with Audacity.  My converted file now has a screech at the end (or at least it plays around when the sound is going to loop again) instead of the beginning lol, however the one you uploaded does not have a screech anywhere.  However when i look at my ogg file in Audacity it does not have the screech anywhere.
heres my ogg: http://www.sendspace.com/file/crnxzp
« Last Edit: June 17, 2011, 11:18:15 am by Disastorm »

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #388 on: June 17, 2011, 12:23:49 pm »
I didn't do anything special; just used whatever were the default settings.  I'll take a look at your file later to see if I can find anything useful about the audio data.  Do you get the same behavior if you use the CodecJOrbis plug-in?  Also, do you get the same behavior for every file you convert or just this one?

Offline Disastorm

  • long
  • ***
  • Posts: 161
    • View Profile
Re: 3D Sound System
« Reply #389 on: June 17, 2011, 07:32:20 pm »
I didn't do anything special; just used whatever were the default settings.  I'll take a look at your file later to see if I can find anything useful about the audio data.  Do you get the same behavior if you use the CodecJOrbis plug-in?  Also, do you get the same behavior for every file you convert or just this one?

Well I just converted some random mp3 I found on my pc to ogg and it didnt have a screech anywhere, so it might just be that file.