Are there plans to support 3d sound effects any time soon?

I was just looking at this document:
http://developer.coronalabs.com/partner/audionotes#Use_mono_sounds_when_possible

which says “While we currently don’t officially support 3D effects in this release, this is something we plan for future releases.”

Does anybody know if this will be happening in the foreseeable future? [import]uid: 84115 topic_id: 29907 reply_id: 329907[/import]

Not exactly sure what you mean - but I’ve managed to get some pretty cool spatial sounds using the undocumented OpenAL libraries that Corona has been keeping under wraps for quite some time.
[import]uid: 33275 topic_id: 29907 reply_id: 119889[/import]

Yes, I’ve been toying around with the X Y Z panning, and it sounds pretty cool in the headphones. [import]uid: 6084 topic_id: 29907 reply_id: 119903[/import]

The thing that really got me stumped to begin with is ensuring you are calculating the correct position form where the sound should originate - once you’ve got over that hurdle it’s pretty easy stuff. [import]uid: 33275 topic_id: 29907 reply_id: 119904[/import]

We probably won’t be adding to the audio API in the near future. (We have some backend stuff we need to do first before adding new stuff like improve Android performance and supported codecs via OpenSL ES (but this requires 2.3+) and improve Windows supported codecs via Windows Media Foundation (but this requires Vista+)).

The “secret” audio APIs are your best bet. People seem to be having good results with them and they aren’t crashing apps which is a good thing.
[import]uid: 7563 topic_id: 29907 reply_id: 119926[/import]

In that case could someone please try and help me with something?

My understanding is that if I were to set the position of the listener:

al.Listener(al.POSITION, 0.0, 0.0, 0.0)

and then set a sound to the left of that (i.e a minus X value)

al.Source(myLeftSource, al.POSITION, -10.0, 0.0, 0.0)

then I should hear that sound on the left speaker / earphone?

However, if I use stereo sound files the sound is always either split 50/50 left/right, or 100% left/right. If I move the X position by any amount at all (I’ve used values from -0.0000001 to 10000000), the sound is always entirely on the left side (i.e no sound at all from the right speaker). The same applies to the right speaker for positive values. Have I missed something?

Also, if I use .ogg files (which I believe are mono) the sound is always entirely on the left regardless of the x position of the sound (positive, negative or centered.

Any help would be greatly appreciated. [import]uid: 84115 topic_id: 29907 reply_id: 120051[/import]

OpenAL has 6 different distance attenuation models. Each controls how fast the sound drops as it gets farther away. You probably need to set it to LINEAR_DISTANCE or LINEAR_DISTANCE_CLAMPED for what you are expecting.

al.DistanceModel(al.LINEAR\_DISTANCE\_CLAMPED)  
--al.DistanceModel(al.LINEAR\_DISTANCE)  

Also, you should be setting the al.MAX_DISTANCE, al.REFERENCE_DISTANCE, al.ROLLOFF_FACTOR. These let you control the range/scale of the universe and impact on how the sound decays (formulas are in the spec). In LINEAR modes, the MAX_DISTANCE is the distance where the sound falls to the lowest level, the REFERENCE_DISTANCE is where the volume starts to decay.

 al.Source(source, al.ROLLOFF\_FACTOR, 1.0)  
 al.Source(source, al.REFERENCE\_DISTANCE, 1.0) -- start decaying after it reaches a distance of 1  
 al.Source(source, al.MAX\_DISTANCE, 100.0) -- when 100 away, sound is at its quietess  
  
 al.Source(source, al.POSITION, -10.0, 0.0, 0.0) -- change this between 0 and -100 to hear the difference  

My book is probably the most comprehensive resource written on the subject. I encourage you to check it out or at least watch the video:
http://www.youtube.com/watch?v=6QQAzhwalPI
http://playcontrol.net/iphonegamebook

[import]uid: 7563 topic_id: 29907 reply_id: 120131[/import]

Ogg vs. anything else shouldn’t make a difference (as long as both sounds are mono). But Android/Windows vs. Mac vs. iOS might make a difference if there are bugs or subtle differences in the ways the OpenAL implementations interpret the spec. You may need to tweak if you find differences or file a bug for totally broken behavior. (I’ve personally seen both over the years.)

[import]uid: 7563 topic_id: 29907 reply_id: 120132[/import]

Not exactly sure what you mean - but I’ve managed to get some pretty cool spatial sounds using the undocumented OpenAL libraries that Corona has been keeping under wraps for quite some time.
[import]uid: 33275 topic_id: 29907 reply_id: 119889[/import]

Yes, I’ve been toying around with the X Y Z panning, and it sounds pretty cool in the headphones. [import]uid: 6084 topic_id: 29907 reply_id: 119903[/import]

The thing that really got me stumped to begin with is ensuring you are calculating the correct position form where the sound should originate - once you’ve got over that hurdle it’s pretty easy stuff. [import]uid: 33275 topic_id: 29907 reply_id: 119904[/import]

We probably won’t be adding to the audio API in the near future. (We have some backend stuff we need to do first before adding new stuff like improve Android performance and supported codecs via OpenSL ES (but this requires 2.3+) and improve Windows supported codecs via Windows Media Foundation (but this requires Vista+)).

The “secret” audio APIs are your best bet. People seem to be having good results with them and they aren’t crashing apps which is a good thing.
[import]uid: 7563 topic_id: 29907 reply_id: 119926[/import]

In that case could someone please try and help me with something?

My understanding is that if I were to set the position of the listener:

al.Listener(al.POSITION, 0.0, 0.0, 0.0)

and then set a sound to the left of that (i.e a minus X value)

al.Source(myLeftSource, al.POSITION, -10.0, 0.0, 0.0)

then I should hear that sound on the left speaker / earphone?

However, if I use stereo sound files the sound is always either split 50/50 left/right, or 100% left/right. If I move the X position by any amount at all (I’ve used values from -0.0000001 to 10000000), the sound is always entirely on the left side (i.e no sound at all from the right speaker). The same applies to the right speaker for positive values. Have I missed something?

Also, if I use .ogg files (which I believe are mono) the sound is always entirely on the left regardless of the x position of the sound (positive, negative or centered.

Any help would be greatly appreciated. [import]uid: 84115 topic_id: 29907 reply_id: 120051[/import]

OpenAL has 6 different distance attenuation models. Each controls how fast the sound drops as it gets farther away. You probably need to set it to LINEAR_DISTANCE or LINEAR_DISTANCE_CLAMPED for what you are expecting.

al.DistanceModel(al.LINEAR\_DISTANCE\_CLAMPED)  
--al.DistanceModel(al.LINEAR\_DISTANCE)  

Also, you should be setting the al.MAX_DISTANCE, al.REFERENCE_DISTANCE, al.ROLLOFF_FACTOR. These let you control the range/scale of the universe and impact on how the sound decays (formulas are in the spec). In LINEAR modes, the MAX_DISTANCE is the distance where the sound falls to the lowest level, the REFERENCE_DISTANCE is where the volume starts to decay.

 al.Source(source, al.ROLLOFF\_FACTOR, 1.0)  
 al.Source(source, al.REFERENCE\_DISTANCE, 1.0) -- start decaying after it reaches a distance of 1  
 al.Source(source, al.MAX\_DISTANCE, 100.0) -- when 100 away, sound is at its quietess  
  
 al.Source(source, al.POSITION, -10.0, 0.0, 0.0) -- change this between 0 and -100 to hear the difference  

My book is probably the most comprehensive resource written on the subject. I encourage you to check it out or at least watch the video:
http://www.youtube.com/watch?v=6QQAzhwalPI
http://playcontrol.net/iphonegamebook

[import]uid: 7563 topic_id: 29907 reply_id: 120131[/import]

Ogg vs. anything else shouldn’t make a difference (as long as both sounds are mono). But Android/Windows vs. Mac vs. iOS might make a difference if there are bugs or subtle differences in the ways the OpenAL implementations interpret the spec. You may need to tweak if you find differences or file a bug for totally broken behavior. (I’ve personally seen both over the years.)

[import]uid: 7563 topic_id: 29907 reply_id: 120132[/import]

Weird. I tried both mp3 and m4a mono files and the distance adjustment works just fine. But the stereo panning is not working. It’s either completely left, 50/50 or completely right.

AlanPlantPot: Did you get it to work somehow?

Does somebody have a working example where panning actually works as expected?

Hi! I played around with this a while ago and the spatial audio worked fine for me. You probably just have to scale everything down by a factor of 1000 or even 1000000. There’s a pretty good chance that you are telling the OpenAL engine that moving your object one pixel is equal to 1 meter of movement from the microphone.

Weird. I tried both mp3 and m4a mono files and the distance adjustment works just fine. But the stereo panning is not working. It’s either completely left, 50/50 or completely right.

AlanPlantPot: Did you get it to work somehow?

Does somebody have a working example where panning actually works as expected?

Hi! I played around with this a while ago and the spatial audio worked fine for me. You probably just have to scale everything down by a factor of 1000 or even 1000000. There’s a pretty good chance that you are telling the OpenAL engine that moving your object one pixel is equal to 1 meter of movement from the microphone.