Panning sound while playing?

Is this a proper way to do panning of sound?

var sound = openfl.Assets.getSound(‘Sounds/test.wav’);
var transform = new, 1); // volume 100%, pan Right 100%
var channel =;
transform = new, -1); // volume 100%, pan Left 100%
channel.transform = transform;

I’m testing on mono wav/ogg/mp3 and the sound always plays as “center”.

(OpenFL 3.4.0; Lime 2.7.0)

Anyone knows what am I doing wrong or maybe is it a bug? This is supposed to be pretty simple, right?

What target are you using?

I think for native targets, which use openAL, it requires mono sound to do panning.

I’m targeting every possible platform, and I’m testing mono sound files of different formats. Sound never plays “panned”, thats why I’m confused.

[bump] Anyone could help with this? :confused:

It looks like this feature is TODO in the new code base.

OpenFL uses a Lime audio API to help manage the sound on all platforms except for HTML5, which uses Sound.js currently. In the future, I think we should see if Lime’s audio API can gain good HTML5 audio support so we can unify everything.

For Sound.js, I think OpenFL has sound pan, but for the Lime audio API (using OpenAL on native targets currently) there is no pan support. We should add true 3D position support (which can simplify down to 2D pan) and then bind into from OpenFL. Not hard to do, more a matter of defining the API and wiring it.

OpenFL samples don’t use sound panning, I’m sorry this was overlooked.

If there is anything I could do to help with this, please let me know.

The first thing to do would be looking at the Lime playing sound sample, and seeing about changes to the AudioSource API to allow for a sound 3D position

If we can get that Lime sample to work properly (and decide on the API to use for it) then it should be easy to add the remaining hook-ups on the OpenFL side to use it :slight_smile:

@madneon i had to solve a similar problem recently … might be relevant to your interests:

This should be implemented now, thanks :slight_smile:

1 Like

Is pan supported in HTML5 target? I didn’t understand if it is.

Looks like it needs to be implemented still