Stereo sound effects - sample player "rightVol" not behaving as expected

What is the purpose of rightVal for the sample player here?

-- I would expect this sound to be panned LEFT
myLeftSound:playAt(0, 1.0, 0.2)

-- I would expect this sound to be panned RIGHT
myRightSound:playAt(0, 0.2, 1.0)

However it seems that the vol parameter determines the total volume of the sample. So myRightSound does not play at full volume through the right speaker, but rather the sound itself has a low volume.

Is there any way to play a sound in the left channel and a different sound in the right channel?

In my game, things spawn on the right and collide on the left and I'd like to pan the various sounds based on this

I can't answer your question, but...

I think you're looking for channel:setPan(), you'll need to create a channel first and add the sound to it. You can create multiple channels and pan them individually.

In YOYOZO I pan two sets of sounds: one related to the ball, one related to the player, and there are global sounds that are not panned at all.


I'm glad you have it working, but I thought it was odd that you couldn't use playAt to do this (adding to a channel feels like considerable extra work). So I decided to give it a try just for fun.

For me, the rightVal parameter seems to work exactly as you expected it would in 2.1.0 using the simulator.

If I use playAt() on a sample player like this:

plr:playAt(0, 0.5)


plr:playAt(0, 0.5, 0.5)

then the sound is centered. When using

plr:playAt(0, 0.1, 0.5)

then it's panned way right. When using

plr:playAt(0, 0.5, 0.1)

then it's panned left. When using two different players like this:

plr1:playAt(0, 0, 0.5)
plr2:playAt(0, 0.5, 0)

I was able to play two different sounds in the left/right channels.

1 Like

You are absolutely right - I just tested this with headphones. I believe my right laptop speaker is actually busted :joy: