1. Are you ready for the Galaxy S20? Here is everything we know so far!

3D audio on Android

Discussion in 'Android Development' started by Wiisley, Aug 6, 2010.

  1. Wiisley

    Wiisley Lurker
    Thread Starter

    Hi all,

    I'm a master student at the university of Utrecht working on his master thesis project. The project is on 3D audio on mobile phones, developing on Android in my case.

    I'm still looking for a way to simulate the 3D audio with headphones. I think a simple version using just the time delay between to ears and perhaps volume difference should give something to work with.
    However, my initial idea of just playing a sound twice, with the given delay obviously doesn't work since there will be (random) lag between the 2 commands.
    My supervisor mentioned it might be possible to adjust the audiodata when playing it and add some silence in front of the left or right channel.
    It seems the write method from the audioTrack class could be used for that:
    You have a byte array of audiodata which is what you want. Hover, it looks like this data is sent to both ears.

    Is there a way to edit the data to both ears seperately? Or is there another way i can create 3D audio? Iphone support openAL which has 3D audio functions in it if i'm correct, but sound on Android doesn't seem that advance.

    I would be gratefull if someone could help me. the actual implementation isn't the biggest part. The research to see what i can do with it is the biggest part...

    thanx in advance!

    1. Download the Forums for Android™ app!


  2. id0001

    id0001 Well-Known Member

    I don't know much about 3D audio but you could use the setStereoVolume() method from the AudioTrack class to create the illusion of sound coming from different directions.
  3. Wiisley

    Wiisley Lurker
    Thread Starter

    hi id0001,

    I have seen that method and that would work partially, but that won't be enough. you need a delay between left and right ear as well, and there is no standard function for that.

    thanx for the suggestion.

    I think i have to mix PCM data to one stream, but have no idea how that works. anyone has some info on that?
  4. id0001

    id0001 Well-Known Member

    Perhaps you could look at the android sourcecode for the AudioTrack class and build a new one from that code.

Share This Page