Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - paulscode

Pages: 1 2 [3] 4 5 ... 58
31
Projects / Re: 3D Sound System
« on: August 15, 2011, 09:55:36 pm »
I thought I would give a quick progress update on SoundSystemAE.  I'm currently working out some stability issues with the part of the library that reads from the app's compressed assets.  This is kind of essential because without it, apps would require access to the sdcard and have the audio files placed there.  That is a limitation I would like to avoid if at all possible, since not all Android devices even have an sdcard, and nobody likes adding extra permissions to their app if they don't have to.

32
Projects / Re: 3D Sound System
« on: August 11, 2011, 08:22:34 pm »
I don't have a computer with Windows on it here, just a netbook with Ubuntu (I'm currently on TDY and won't be back home until mid September).  Could you send me the test file?

33
Projects / Re: OpenAL for Android
« on: August 11, 2011, 02:30:00 am »
A couple folks have asked me why they can't change the volume on the ALAN Demo app.  That's because I threw everything into the activity's onCreate method, and the thread blocks there in the stream loop until playback finishes.  This was just for demonstration purposes - you wouldn't normally write an app that way.  You'll also notice that the make-shift ogg decoder I threw together is really inefficient (takes encoded buffers from Java, decode them in native, sends then back to Java, then Java sends them back to native to be played).  I wouldn't recommend copying any part of that demo in a real-world app - it is entirely a proof of concept.

34
Projects / Re: 3D Sound System
« 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).

35
Projects / Re: OpenAL for Android
« on: August 10, 2011, 01:29:29 pm »
Yes, sadly it's been down since yesterday night.  I'm hoping 1&1 just needs to reboot a server when they come in to work this morning.

36
Projects / OpenAL for Android
« on: August 10, 2011, 02:06:31 am »
I am still working out the kinks with the Android version of my 3D Sound System.  In the mean time, I thought some folks might find this part of the library useful by itself.  This is my port of native OpenAL to Android with a simple Java interface.  It will basically allow you to add OpenAL to your projects without having to play around with c/c++ and JNI.  If optimization is a big concern for your project but you still need 3D sound, removing the overhead of SoundSystem and accessing OpenAL directly could be a good option.  This library should work on all Android versions back to 1.5 (although I've only actually tested it on my own phone).

The Java interface for this port is probably closer to JOAL rather than LWJGL's interface.  There are a few differences from JOAL, however (mainly in the methods that take array/ buffer parameters, the way the context is created and destroyed, and the lack of a direct interface to ALC with device and context objects Java-side).  That being said, code written for JOAL or LWJGL is pretty simple to make work with my interface (it's all OpenAL when you get right down to the nuts and bolts, after all).

Everything is accessed statically through the class paulscode.android.sound.ALAN.  Before creating any sources and what-not, first connect with the Android audio device and create an AL context by calling:
Code: [Select]
ALAN.create();
From there, you can access whatever AL functions you need through ALAN.  For example:
Code: [Select]
        int[] ALBufferIDs = new int[BUFFER_COUNT];
        int[] source = new int[1];
        int[] state = new int[1];
        ALAN.alGenSources( 1, source );
        ALAN.alGenBuffers( BUFFER_COUNT, ALBufferIDs );
        ALAN.alBufferData( ALBufferIDs[i], format, buffer, buffer.length, rate );
        ALAN.alSourceQueueBuffers( source[0], c, ALBufferIDs );
        ALAN.alSourceQueueBuffers( source[0], c, ALBufferIDs );
        ALAN.alSourcePlay( source[0] );
        ALAN.alGetSourcei( source[0], ALAN.AL_SOURCE_STATE, state );
        if( state[0] != ALAN.AL_PLAYING )
            whatever();

And when you're finished, destroy the AL context and disconnect from the Android audio device by calling:
Code: [Select]
ALAN.destroy();
In case you haven't caught on, ALAN isn't a personal name like some AI alias - it's just an abbreviated form of  "OpenAL for Android" (fewer keystrokes than OpenALAndroid).  On a humorous note, I was actually forced to rename a hundred or so references to my project's original title "Android OpenAL", which I was horrified to realize became "ANAL" when abbreviated.  THAT was a real pain in the butt ;D

Anyway, here is a very basic app to demonstrate streaming an .ogg file:
ALAN Demo    (source code)

I normally drop in the source code to my projects, but you should be able to just unzip the above APK file, grab the contents of the "lib" folder, and paste them into your own project's "lib" folder.  If you prefer to compile the source code yourself, you can unzip the source code archive above and either run the following commands from the terminal/command prompt:
Code: [Select]
ndk-build
ant debug
ant install
Or you can "create a new project from source" in Eclipse (requires the Android SDK and NDK to be installed, as well as the ADT plug-in and Sequoyah Android Native Code plugin from the update site plug-ins).  Once you've created the Eclipse project, just right-click on it in the left panel and navigate to "Android Tools->Add Native Support".

The above demo utilizes the Tremolo library for decoding the .ogg file.  It is a popular library for use on Android because it is extra light-weight and optimized for the ARM architecture, but there are plenty of other decoder libraries out there you could use if you have problems with that one.  In theory, you could even use any of a number of pure-Java audio decoders as well, including the ones included with my SoundSystem library.  I do not recommend copying the code from this demo - it very inefficient and meant only as a proof of concept.

One final note: OpenAL Android is licensed by the LGPL (since that is what OpenAL and Tremolo are licensed under).  While I normally shy away from this license, it actually meshes really well with Android apps, because the end user can use any of a number of free backup programs (such as ASTRO) to create a backup APK of your app.  From there, he can plug in a different version of the library into the APK, and simply reinstall it.  All you have to do is mention somewhere in your documentation where they can acquire the sourcecode for OpenAL Android (feel free to mention my website if you don't want to host the files yourself). Please let me know if you encounter any bugs (logcat output is always helpful).

37
Projects / Re: 3D Sound System
« 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.

38
Projects / Re: 3D Sound System
« 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.

39
Projects / Re: 3D Sound System
« 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).

40
Projects / Re: 3D Sound System
« 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.

41
Projects / Re: 3D Sound System
« 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?

42
Projects / Re: 3D Sound System
« 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 :)

43
Projects / Re: 3D Sound System
« 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)

44
Projects / Re: 3D Sound System
« 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.
...

45
Projects / Re: 3D Sound System
« 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.

Pages: 1 2 [3] 4 5 ... 58