Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Panning audio  (Read 23624 times)

0 Members and 3 Guests are viewing this topic.

Lagiv

  • Newbie
  • *
  • Posts: 3
    • View Profile
Panning audio
« on: January 28, 2009, 08:30:59 pm »
Is there a way to pan audio other than spatialization?

When using spatialization, the audio doesn't pan smoothly. For example, I have a sound whose position I'm moving from the left of the listener to the right of the listener.

The sound pans like this: first the sound starts getting louder in the left channel, then when it goes over the listeners position it suddenly jumps to the right channel and starts fading.

When panning from left to right, it should first play only on the left channel and then the sound on the right channel should start getting louder, and when the sound is in the middle both channels are at the same volume.

Here is a picture illustrating what I mean:



I'm using Windows XP and SFML 1.4.

nitram_cero

  • Full Member
  • ***
  • Posts: 166
    • View Profile
Panning audio
« Reply #1 on: May 07, 2009, 07:40:25 pm »
You need to move the listener away from the plane where the sounds are at.

IE: if you're using X/Y audio coordinates, you should move the position of the listener on the Z axis and set the target in the opposite direction (to face the X/Y plane).
If you're using X/Z coordinates THIS WONT WORK: You can't SetTarget with a vector that is linearly dependent with (0, 1, 0)... because of SFML implementation for the OpenAL orientation function)

I found this to work as you expect. I'm writing a tutorial on that (with nice graphics). I'll repost when I finish it.

Take into account that this affects min distance and attenuation of sounds, so this should be reevaulated.

A new min distance could be something like
newMinDist=√(oldMinDist² + listenerDepth²)

This actually intersects the "new min distance sphere" with the X/Y plane, producing a "min distance circle", which is the same as the circle from the sphere using old min distance when the listener has Z=0



I hope it helps.
-Martín

EDIT: http://blog.tbam.com.ar/2009/05/sound-spatiaiization-for-2d-games-in.html

link to the guide