4

I have a mono sound and I want to make it sound like the sound comes from a specific direction. The end-goal is to create a prototype of a game where people should be able to find the source of the sound in the game just by walking towards the sounds. The game will be in 2D (seen from above).

I have very little experience with sound design, so I'm not sure exactly what to look for. My research has led me to believe that it has some relation to Head-related transfer functions, but other than that, I don't know what to look for.

Is there a technique used to make this? If so, what's it called? Practically all first-person shooter games use this, so there must be some theory available on the subject.

  • The idea of such a game has already been used in Papa Sangre, papasangre.com, a game base on finding one's way only through audition. The game use a generic (ie not with individual HRTF's) binaural renderer. Some audio game engine offer an API to dynamically 'place' sound in a virtual scene. – audionuma Jan 4 '15 at 19:30
1

What you're looking for is called panning. Here's an article about panning: http://www.dawsons.co.uk/blog/what-is-panning

Essentially, panning is the direction a digital sound seems to be coming from. It is literally exactly what you described in your question! Be aware that panning will only manipulate whether a sound seems to come from the right, the left, or from ahead. (Unfortunately, it is impossible to make a sound seem to come from above or below, or to make a sound seem to some from ahead instead of behind or visa-verca. This isn't a limitation of technology, but rather of the human hearing system: we can only discern locations based on sound along the axis our two ears lie on.)

Panning is usually measured in software as a unitless number from -1 to 1, with -1 begin a sound coming directly from the left, 0 being a sound coming directly ahead, and 1 being a sound coming directly from the right. Then, fractional panning values indicate sounds coming from different angles. For example, a sound located halfway between the left and directly ahead of a listener would have a panning value of -0.5.

Look up how panning is handled in the library you are using for sound in your game development. I predict that the object representing an individual sound will have a panning attribute you can set to change which direction the sound seems to be coming from when you play it. Be sure to read the documentation carefully so you know what numbers the panning attribute takes because although the -1 to 1 system for describing panning in software is common, it isn't universal.


Since it's not possible to pan a sound in front of or behind a player, your game has an unfortunate limitation: If the sound is north or south of the player, it will be indistinguishable which direction the player should go. One way to work around this is to allow the player to rotate the camera.

For example, suppose there's a sound coming from due north of the player. It's panning value is 0: directly north or south of the player, but indistinguishable which. Then, the player rotates the camera 90˚ clockwise, so that north is now on the left side of the screen. Now, the sound will be clearly coming from the left and have a panning value of -1.

Rotating the camera in this way is analogous to turning or tilting your head to get a better idea of where a sound is coming from. If a sound is coming from ahead or behind you, it can be difficult to tell exactly where is is for the aforementioned reasons. But if you turn your head, what was previously in front of and behind you is now to your left and right, and it will be easier to tell where it is.

  • Here's the Wikipedia article on panning. As of when I posted my answer, though, the article is poorly written: en.wikipedia.org/wiki/Panning_%28audio%29 – Kevin - Reinstate Monica Jan 4 '15 at 20:30
  • Since I ended up creating my own implementation of panning, I'll mark this as the answer. My implementation is quite crude, but this is only a prototype, so it'll do. Thank you. – kba Jan 6 '15 at 21:49
1

I'm not sure what you mean by "mono sound" but if you're using only one speaker its gonna be hard (if not impossible) to create that effect since you would have to sample it breifly to see if it actually sounds proper.

But to answer your question, it has something to do with panning, look it up, you can 'pan' left or 'pan' right which makes the sound come from the left or right speaker exclusively (you can control the amount of panning).

  • The game will be used with stereo headphones. By googling panning, I don't immediately see anything that seems useful, but I'll look more. I was hoping for something like a set of formulas where you'd put in the distance to the sound source and the angle from the viewer, and then you'd be get the volume and possibly a time lag. – kba Jan 4 '15 at 17:37
  • oh i see what you mean. I honestly don't know the first thing about manipulating sound the way you explained it. – Daniel Jan 6 '15 at 13:12
0

It depends on the game engine you are using. Doing that with native programming requires lots of skills and time.

The following audio tools can integrate with some other game engines and support 3D audio with Head Related Transfer Functions:

-1

There's also a very interesting video of sound in space (modal rooms),the spatializing of the sound in a room better said.

here's the youtube film =>

These covers all things for mixing and spatializing of your sounds. It's old and bit funny but the main idea is that it covers everything in basic principle and visualize it for you.

  • 1
    Can you add some details about what the video says to answer the question in your own words? Currently, if the video were to be removed, this answer would no longer answer the question. It's preferable if the answer provides some detail and uses the external video as reference. – AJ Henderson Jan 8 '15 at 20:03
  • I'm simple trying to give an answer and this in the way that not just panning is an answer to his question, but that 'direction and or place it comes from is based on the spatialization of the sounds that are generated.' so panning alone couldn't do that. I'm unable to give one line off answer because the question is to broad to just give one answer it's based on several factors of sound generating. Thus this very simple video explains everything that should be known to speak of with directions with sounds in space. – Qinten Jan 8 '15 at 21:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.