[openal] Trying to implement a linear 1D (left/right) audio balance

Ethan Lee flibitijibibo at flibitijibibo.com
Sun Apr 20 21:26:32 EDT 2014


Yup, that's basically all it does.

It's hard to say re: the gain result; if you're not already using OpenAL 
Soft you'll want to check with that first. As long as the 
listener/source gains seem right and it all aligns with the distance 
model, you should be able to make adjustments from there to get it to 
where you want.

-Ethan

On 04/20/2014 09:22 PM, Villermen wrote:
> Thanks for the quick replay Ethan!
>
> This does seem like the closest it gets. Do I get it right if I say 
> that it sort of creates a half-circle around the z-axis to make the 
> distance to the listener stay the same?
>
> The actual gain around -1f and 1f  for INTERNAL_pan does seem higher 
> than 1. Is there a way to get this closer? If not I'll happily take 
> this way of handling it as it's too close to really give anything 
> about it.
>
> Gr.Villermen
>
>
> On Mon, Apr 21, 2014 at 2:52 AM, Ethan Lee 
> <flibitijibibo at flibitijibibo.com 
> <mailto:flibitijibibo at flibitijibibo.com>> wrote:
>
>     In FNA we do something like this, but it's probably not ideal (if
>     not just incorrect):
>
>     https://github.com/flibitijibibo/MonoGame/blob/monogame-sdl2/MonoGame.Framework/Audio/SoundEffectInstance.cs#L58
>
>     I know for sure that this doesn't provide hard panning, but you
>     probably didn't _really_ want to do hard pans anyway. We do that
>     work to keep things at the 1.0f distance, but if attenuation isn't
>     required for your project, you can turn that off and possibly save
>     some time/effort:
>
>     https://github.com/flibitijibibo/MonoGame/blob/monogame-sdl2/MonoGame.Framework/Audio/OpenALDevice.cs#L102
>
>     -Ethan
>
>
>     On 04/20/2014 08:44 PM, Villermen wrote:
>>     Hey there,
>>
>>     After not being able to figure this one out myself I've posted my
>>     question on the OpenTK forums and StackOverflow, where I was
>>     suggested by the OpenTK dev to ask you about it =)
>>
>>     Basically I'd like to have a balance value of -1f (left channel
>>     only) to 1f (right channel only) be converted into a position for
>>     an OpenAL source where it will act as such:
>>     When having 0f (default value) as balance value both sides
>>     (left/right ear) should be at 100% gain.
>>     When 1f 100% for the right ear and 0% for the left ear and the
>>     opposite for -1f.
>>     They should attenuate in a linear way.
>>
>>     For what I've tried so far please read my post on StackOverflow
>>     <http://stackoverflow.com/questions/23154049/linear-1d-audio-balance-with-openal>.
>>     I'm working with the OpenTK library but I am pretty sure I can
>>     convert any OpenAL related answer to it, just as long as I can
>>     understand it in general.
>>
>>     I would really like to know if and how this is possible, and any
>>     thoughts on this are welcome!
>>
>>     Gr.Villermen
>>
>>
>>     _______________________________________________
>>     openal mailing list
>>     openal at openal.org  <mailto:openal at openal.org>
>>     http://openal.org/mailman/listinfo/openal
>
>
>     _______________________________________________
>     openal mailing list
>     openal at openal.org <mailto:openal at openal.org>
>     http://openal.org/mailman/listinfo/openal
>
>
>
>
> -- 
>
> villermen.com <http://www.villermen.com/>
>
>
> _______________________________________________
> openal mailing list
> openal at openal.org
> http://openal.org/mailman/listinfo/openal

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openal.org/pipermail/openal/attachments/20140420/e7f8201a/attachment-0001.html>


More information about the openal mailing list