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.

Modifying stereo sound placement

Postby kexisse on Thu Jul 12, 2012 5:31 am

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
kexisse
Citizen
 
Posts: 56
Joined: Wed Jun 13, 2012 2:52 pm

Re: Modifying stereo sound placement

Postby kikito on Thu Jul 12, 2012 7:29 am

I remember someone mentioning that you can only do that with mono sounds.
When I write def I mean function.
User avatar
kikito
Inner party member
 
Posts: 2479
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain

Re: Modifying stereo sound placement

Postby kexisse on Thu Jul 12, 2012 7:33 am

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
kexisse
Citizen
 
Posts: 56
Joined: Wed Jun 13, 2012 2:52 pm

Re: Modifying stereo sound placement

Postby kikito on Thu Jul 12, 2012 8:29 am

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
kikito
Inner party member
 
Posts: 2479
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain

Re: Modifying stereo sound placement

Postby kexisse on Thu Jul 12, 2012 3:54 pm

How did I not see this? o.o
Thank you so much!
User avatar
kexisse
Citizen
 
Posts: 56
Joined: Wed Jun 13, 2012 2:52 pm

Re: Modifying stereo sound placement

Postby Boolsheet on Thu Jul 12, 2012 4:11 pm

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
Boolsheet
Inner party member
 
Posts: 780
Joined: Wed Dec 29, 2010 4:57 am
Location: Switzerland

Re: Modifying stereo sound placement

Postby BlackBulletIV on Fri Jul 13, 2012 1:27 am

Ah, this explains why I couldn't get setPosition to work the way it used to.
User avatar
BlackBulletIV
Inner party member
 
Posts: 1253
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia

Re: Modifying stereo sound placement

Postby kexisse on Sat Jul 14, 2012 4:33 am

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 50 times
User avatar
kexisse
Citizen
 
Posts: 56
Joined: Wed Jun 13, 2012 2:52 pm

Re: Modifying stereo sound placement

Postby Boolsheet on Sat Jul 14, 2012 5:29 am

Possible OS X bug? Oh nooo! :o
Shallow indentations.
User avatar
Boolsheet
Inner party member
 
Posts: 780
Joined: Wed Dec 29, 2010 4:57 am
Location: Switzerland

Re: Modifying stereo sound placement

Postby dreadkillz on Sat Jul 14, 2012 5:39 am

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?
User avatar
dreadkillz
Party member
 
Posts: 223
Joined: Sun Mar 04, 2012 2:04 pm
Location: USA

Next

Return to Support and Development

Who is online

Users browsing this forum: Bing [Bot], tehryanx and 4 guests