• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Developing 3D Audio Library For Android

paulscode

Member
Mar 18, 2010
86
14
Hello, all. I am new to Android development, and I am planning to write a 3D audio library for use in 3D projects/games when stereo is available (headsets, external speakers). I have a lot of experience with Java (I've written a 3D audio library that is being widely used by Java developers), but I currently have zero experience developing for Android (I actually just finished installing the SDK).

I am looking for source code, tips, links to related topics, etc related to the following:

1) URL-like reading of bytes from files.
2) Playback of raw PCM audio data.
3) Setting audio format (sample rate, frame size, frame rate, etc)
4) Playing sound from multiple "channels" simultaneously (audio mixing)
5) Controlling playback pan and gain of these "channels"

I know these topics are rather broad in scope, but my main purpose for this post is to get the conversation started and get some ideas. As I start playing around with example code and getting my feet wet, I'll be able to ask more specific questions.
 
I found a class that seems to have all the capabilities I need to create a 3D sound library for Android. It is called AudioTrack. The "write" method can be used to play PCM audio data, and the "setStereoVolume" method can be used to take care of gain and pan. It'll just take a little trigonometry - I've already done something similar with with JavaSound, so that part shouldn't bee too difficult. I will need to run some tests to see how well Android is able to mix multiple playing AudioTrack instances. If it can handle a reasonable number, then I should be good to go.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones