Modifying stereo sound placement

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
kexisse
Citizen
Posts: 56
Joined: Wed Jun 13, 2012 2:52 pm

Modifying stereo sound placement

Post by kexisse »

Is it possible to change the way sounds are played in stereo with Löve? Is there an external library I could use?

I want to create the illusion of space with sound:
  • Modify volume of left/right depending on sound placement within the world.
  • Muffle sounds.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Modifying stereo sound placement

Post by kikito »

I remember someone mentioning that you can only do that with mono sounds.
When I write def I mean function.
User avatar
kexisse
Citizen
Posts: 56
Joined: Wed Jun 13, 2012 2:52 pm

Re: Modifying stereo sound placement

Post by kexisse »

You can only modify mono sounds in that way? That might make sense.
But is there a way to do it with the Löve API? Or through some other means?
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Modifying stereo sound placement

Post by kikito »

I think you can use Source:setPosition for the position and Source:setVolume for the muffling.
When I write def I mean function.
User avatar
kexisse
Citizen
Posts: 56
Joined: Wed Jun 13, 2012 2:52 pm

Re: Modifying stereo sound placement

Post by kexisse »

How did I not see this? o.o
Thank you so much!
User avatar
Boolsheet
Inner party member
Posts: 780
Joined: Wed Dec 29, 2010 4:57 am
Location: Switzerland

Re: Modifying stereo sound placement

Post by Boolsheet »

kikito is correct, the positioning of the audio in the 3D space only works with mono Sources.

There's currently an issue with LÖVE 0.8.0 for Windows and Linux. The stereo effect is not be as pronounced as it should be. It's very noticable with headphones. This will be fixed with the next version.

Pitch and volume is all we got. No fancy things like frequency filters.
Shallow indentations.
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Modifying stereo sound placement

Post by BlackBulletIV »

Ah, this explains why I couldn't get setPosition to work the way it used to.
User avatar
kexisse
Citizen
Posts: 56
Joined: Wed Jun 13, 2012 2:52 pm

Re: Modifying stereo sound placement

Post by kexisse »

I wrote a quick prototype to test playing sounds depending on their X/Y.

I noticed that the overall volume is modified depending on the X/Y, but the sound is the same in both the left and right speakers.
So even if you move the sound to the left, the right speaker still "hears" the same amount as the left. So it's not true stereo.
I talked to Boolsheet on IRC and he says this is a limitation of the OpenAL library. So I guess there's nothing I can do. Seems kind of a shame though :( I really want sound to be excellent for my game so I guess I'll swap to another game library for my full game.

To use the prototype: Arrow keys to modify x/y, space to play sample.
Also there's a bug somewhere, the sound stops playing sometimes.
Attachments
stereo_sound.love
Arrow keys to modify x/y, space to play sample.
(6.45 KiB) Downloaded 172 times
User avatar
Boolsheet
Inner party member
Posts: 780
Joined: Wed Dec 29, 2010 4:57 am
Location: Switzerland

Re: Modifying stereo sound placement

Post by Boolsheet »

Possible OS X bug? Oh nooo! :o
Shallow indentations.
User avatar
dreadkillz
Party member
Posts: 223
Joined: Sun Mar 04, 2012 2:04 pm
Location: USA

Re: Modifying stereo sound placement

Post by dreadkillz »

Your demo works for me. I move the source left and it plays on the left right speaker only and vice versa for the right side. Sound volume is also attenuated based on distance. Bug on your end maybe?
Post Reply

Who is online

Users browsing this forum: No registered users and 46 guests