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

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #390 on: June 18, 2011, 02:38:17 am »
Weird, I can't find anything wrong with that second file you posted.  I have no idea why it has a screech at the end when played with CodecJOgg.  If you start having the same problem with other files, all I can suggest is to switch to CodecJOrbis or try another converter.

Offline Disastorm

  • long
  • ***
  • Posts: 161
    • View Profile
Re: 3D Sound System
« Reply #391 on: June 18, 2011, 03:00:06 am »
did it have the screech for you as well when playing it with Sound System ?  I reconverted it again this time but i cut a little bit off the end and this time theres no screech.

btw off topic is there any way to download a javadoc from a webpage?  I've used some libraries (I believe this one also does not include a javadoc directory in the zip?) that don't have a downloadable javadoc so its annoying sometimes when programming with them.  Do I need to create a project with the source and then generate a javadoc manually?
« Last Edit: June 21, 2011, 12:33:33 am by Disastorm »

Offline Disastorm

  • long
  • ***
  • Posts: 161
    • View Profile
Re: 3D Sound System
« Reply #392 on: July 14, 2011, 09:03:27 pm »
hey i was just wondering does this work on android?

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #393 on: July 15, 2011, 12:43:41 am »
Not yet, but I have an Android version in the works.  It's not a simple port, because there isn't a good mixer built into the Java portion of Android, so I'm writing one in native code via the NDK.  The API interface will still be through Java, and will be virtually identical to the original SoundSystem.  I don't have a good estimation for a completion date, though - it is at least a month out (I had put it on hold for a while while working on other projects, but I recently came back to working on it again).
« Last Edit: July 15, 2011, 12:45:50 am by paulscode »

Offline Disastorm

  • long
  • ***
  • Posts: 161
    • View Profile
Re: 3D Sound System
« Reply #394 on: July 15, 2011, 12:55:29 am »
Ah ok.  What do most people currently use to produce sound in android apps, do you know?  It looks like the android libraries have their own sound player called SoundPool or something ??
« Last Edit: July 15, 2011, 12:57:28 am by Disastorm »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12298
    • View Profile
    • http://www.jpct.net
Re: 3D Sound System
« Reply #395 on: July 15, 2011, 06:57:33 am »
I'm using SoundPool, wrapped in a very small layer, my SoundManager-class. You can find it in the Alien Runner sources if needed, but it's really nothing fancy.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12298
    • View Profile
    • http://www.jpct.net
Re: 3D Sound System
« Reply #396 on: July 15, 2011, 10:43:27 am »
Just make sure to use ogg instead of mp3, because Android has some problems with loading mp3 files and just hangs (at least on 1.6, haven't tried newer versions in that respect).

Offline Disastorm

  • long
  • ***
  • Posts: 161
    • View Profile
Re: 3D Sound System
« Reply #397 on: July 16, 2011, 12:24:57 pm »
alright thanks for the info.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: 3D Sound System
« Reply #398 on: July 26, 2011, 08:07:36 pm »
I'm also hoping for an Android version. Question: does your sound system handle pitch-shifting? If not, that would be a very useful addition.

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #399 on: July 28, 2011, 11:30:11 pm »
does your sound system handle pitch-shifting? If not, that would be a very useful addition.
Yes it does.  Also has interface for doppler effect.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: 3D Sound System
« Reply #400 on: August 06, 2011, 08:08:43 am »
Very cool, thanks. When do you suppose you'll have the Android version available?

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #401 on: August 06, 2011, 07:20:16 pm »
I'm back to working on this project again.  I should have a beta version out sometime next week.  The main thing is finding every optimization possible in the Java portions, like reusing Objects everywhere possible (my main library was a tad wasteful in this regard).

I'm playing around with an ObjectManager class which allows you to check out/in Objects based on their type from a hashmap of Object pools.  Still working out the kinks on this idea, though.

Other optimizations are moving most of the low-level process from Java into the native code, so there is less traffic passing between Java and native.  I've done a lot of this already, but there are still other improvements I can make on this as well.
« Last Edit: August 06, 2011, 07:27:34 pm by paulscode »

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: 3D Sound System
« Reply #402 on: August 10, 2011, 09:05:54 pm »
As it happens I'm working on an Android project for which I need to do pitch-shifting, so I can't wait to try your Android version soon! Thanks again for your great work, Paul, you're a real credit to these boards.

Anyway, I tried writing a quick PC version, but your WAV plugin wouldn't open the WAV file I generated with Windows's Sound Recorder. What programs could I use to generate a Sound System-readable file?

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: 3D Sound System
« Reply #403 on: August 10, 2011, 10:39:16 pm »
I haven't had a problem with CodecWAV before (although most people including myself are using the .ogg format).  What kind of behavior do you get (screeching, no audio, etc)?  Could you post a link to a broken .wav file so I can run some tests to see if there is anything obvious I can fix?

For editors, I mainly use Audacity (although admittedly don't think I've ever used it to create .wav files, so it may have the same issue).  The code for CodecWAV is quite simple, so I guess I just figured it was good to go after testing it on a few .wav files I had sitting around on my computer (assumptions do tend to get me into trouble ;D)

The initial release of SoundSystemAE will only have one codec (CodecTremolo, for .ogg files).  The reason for this is that I've redesigned the Codec and Library infrastructure in order to optimize performance on Android.  One of these optimizations was to give both the Library and Codec plug-ins a native component.  The two are linked by passing some integers through SoundSystemAE at startup.  These integers represent native function pointers.  Library and Codec reconstruct these pointers to communicate directly with each other at the native level, rather than sending buffers through the JNI to Java and then back through JNI to native (if you do any profiling on the ALAN demo I posted yesterday, you'll see how badly that affects performance).

That being said, the ICodec interface still has the "read()" and "readAll()" methods which are used by SoundSystemAE whenever a Codec doesn't have a native component.  So the PC version Codecs should be fairly easy to port over to the Android version (if you do that, though, you'd probably want to set the buffer sizes fairly high to reduce the amount of traffic moving from Java to native).

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: 3D Sound System
« Reply #404 on: August 11, 2011, 06:54:41 pm »
Thanks for the quick response. If you're running Windows, you can just use its built-in sound recorder. My file is just me saying "test" or something, but if you want it I'll send it to you.