Audio Orientation (simple question)

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.
Post Reply
MaxS
Prole
Posts: 3
Joined: Tue Jul 22, 2014 9:46 pm

Audio Orientation (simple question)

Post 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?
User avatar
SiENcE
Party member
Posts: 806
Joined: Thu Jul 24, 2008 2:25 pm
Location: Berlin/Germany
Contact:

Re: Audio Orientation (simple question)

Post 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
MaxS
Prole
Posts: 3
Joined: Tue Jul 22, 2014 9:46 pm

Re: Audio Orientation (simple question)

Post 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?
User avatar
SiENcE
Party member
Posts: 806
Joined: Thu Jul 24, 2008 2:25 pm
Location: Berlin/Germany
Contact:

Re: Audio Orientation (simple question)

Post 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
MaxS
Prole
Posts: 3
Joined: Tue Jul 22, 2014 9:46 pm

Re: Audio Orientation (simple question)

Post 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.
User avatar
SiENcE
Party member
Posts: 806
Joined: Thu Jul 24, 2008 2:25 pm
Location: Berlin/Germany
Contact:

Re: Audio Orientation (simple question)

Post 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
User avatar
murks
Party member
Posts: 185
Joined: Tue Jun 03, 2014 4:18 pm

Re: Audio Orientation (simple question)

Post 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.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 14 guests