Page 1 of 1

Audio Orientation (simple question)

Posted: Sat Aug 02, 2014 1:26 am
by MaxS
Nothing I can find (including experimentation) has solved this issue for me. What are the arguments used by love.audio.getOrientation and love.audio.setOrientation? What are the units (degrees, radians, etc.) and which directions do axes face?

Re: Audio Orientation (simple question)

Posted: Sun Aug 03, 2014 9:53 am
by SiENcE
hey,

i also needed this informations, the love wiki is lacking a lot of this openal descriptions.

Löve uses OpenAL for positional audio and OpenAL uses the RHS coordinate system.

This is the best picture to show it.
Image

here is a good site.
http://pythonhosted.org/PyAL/audio.html

You need SetOrientation only for the listener (normally you only have one).

This is my setup, but I have something firstperson, (fake3d) Doom-like. I completely ignore the Y direction.

Code: Select all

	-- AUDIO - LISTENER --------------------------------------------
	--            X   0    Z           X   0   Z
	--   /*fwd:*/ 0., 0., -1., /*up:*/ 0., 1., 0.
	if self.activeplayer.faceID == facing_.CFACING_NORTH then
		love.audio.setOrientation( 0, 0, -1, 0, 1, 0 )
	elseif self.activeplayer.faceID == facing_.CFACING_SOUTH then
		love.audio.setOrientation( 0, 0, 1, 0, 1, 0 )
	elseif self.activeplayer.faceID == facing_.CFACING_EAST then
		love.audio.setOrientation( 1, 0, 0, 0, 1, 0 )
	elseif self.activeplayer.faceID == facing_.CFACING_WEST then
		love.audio.setOrientation( -1, 0, 0, 0, 1, 0 )
	end
I hope this helps you. It works in my game. You can produce real positional 3d audio.

cheers

Re: Audio Orientation (simple question)

Posted: Mon Aug 04, 2014 1:55 am
by MaxS
Thanks; this helps so much. But what are the units that the last 3 arguments (the rotation ones/ux, uy, uz) use? What makes a full circle?

Re: Audio Orientation (simple question)

Posted: Mon Aug 04, 2014 8:28 am
by SiENcE

Code: Select all

>>> listener.orientation = (0, 0, -1,   0, 1, 0)
>>>                        ^^^^^^^^    ^^^^^^^
>>>                         direction,   rotation
>>>                       Forward vector, Up vector
Basically: Think of your head pointing to a direction (forward vector), and than move your head up/down (up vector).

What you mean by circle? What do you want to circulate?

Normally you have one listener (the one where you set the orientation) and a emitter (the sound producing event).

You set the listener and than you rotate the emitter around the listener.

So your listener is the one that hears the sound and the emitter is for example a torch.

This is how I move the emitter. To move it in a circle around the listener, you need to change x,y.

Code: Select all

		abc:setPosition( x, 0, y )
		TEsound.play(abc, "sfx", volume or 1.0, pitch, func)
Everything else is done by OpenAL.

Take my modified TESound, because only this supports sound sources. You need sound sources to modify Position.

https://github.com/SiENcE/love2d_gamete ... Esound.lua

cheers

Re: Audio Orientation (simple question)

Posted: Tue Aug 05, 2014 1:52 am
by MaxS
Let's say that I am a listener and have a sound emitter in directly in front of me. Say that I turn to the left, and now the emitter is a little bit to the right. If I keep turning to the left, the emitter will eventually be directly in front of me again. This is what I mean by a full circle. It is represented by 360 degrees or 2 * pi radians.

Re: Audio Orientation (simple question)

Posted: Tue Aug 05, 2014 8:52 am
by SiENcE
It's a vector {0.0-1f, 0.0-1f, 0.0-1f}.

I point you to the openal 1.1 specification.

http://www.openal.org/documentation/ope ... cation.pdf

Re: Audio Orientation (simple question)

Posted: Tue Aug 09, 2016 10:12 pm
by murks
SiENcE wrote:hey,

i also needed this informations, the love wiki is lacking a lot of this openal descriptions.

Löve uses OpenAL for positional audio and OpenAL uses the RHS coordinate system.

This is the best picture to show it.
Image
cheers
This hand is misleading. The thumb (X axis) should point to the right, the middle finger (Z axis) towards the person.