View on GitHub

Spatial-audio-Music-manager-Research

Spatial Audio Music Manager Research

This project was developed by Aitor Luque Bodet , a second year student of the Bachelor’s degrees in Video Game Design and Development at CITM/TTC as of 14/04/2020.

This content was generated for the Project II subject under the supervision of lecturer Ramón Santamaria.

The main focus of this research was:

First approach

What is spatial audio?

Spatial Audio is any audio which gives you a sense of space beyond conventional stereo, allowing the user to pinpoint where sound is coming from, whether this is above, below, or a full 360 degrees around you. For example stereo allows you to hear things in front left and right, but you can’t get a sense of surround, height or sounds from below you. With the introduction of the 3rd dimension, you have a sense of the exact location of sound sources from all around. This definition also appeals to 3D audio.

Image

When it comes to game development it’s still being developed, but there are some approaches that simulates those conditions, and others softwares that already recreate real spatial audio. Even in virtual reality, while you are interacting with 3D images, the sound should also give you the sense of space to compliment the immersive experience. As the human field of vision is at best around 110 degreess so, as in real life, in the 3D virtual world we rely on audio to tell us where we should be looking and what we should be interacting with. Here you can find a list with some games using real 3D spatial audio.

Each game developer has to make the decision whether to invest in spatial audio or stick to stereo or a simulated approach, but in some games it’s highly recommended to implement it as it improves the immersion and player experience. In the first minute of this video you can really tell the difference between one and another, please take a quick look at it.

What are we refering with music manager?

The music manager is a module or code structure selfmade that allow the developer to handle different audio inputs from several sources, load and erasing those fx’s or audio at will. In this research we will be using j1Audio.h and j1Audio.cpp. In orther to follow the explanation it’s recommended to take a look to the SDL_Mixer documentation.

My approach and implementation

Real spatial audio it’s very hard to achieve with the resources available for this project, so here it is an approximate simulation of how spatial audio would work in a 2D environment. First of all we will take a look to those essential functions we must know about:

image Module Audio header file

Core SDL_Mixer

Functions

Exercises - TODO’s

Now that we have reviewed the functions and concepts we will use, we can start with the exercise. We will try to relate 2 entities(emitter and receiver) with an a fx. This fx will be assigned to the emitter, and the receiver(Player) will hear it different from a different direction and distance. We will also handle the music manager, and how to chain a playlist.

TODO 1

Allocate those channels that we will use to play the chunks later, we must have control of this chunks. image

TODO 2

Set a channel in a position given a channel, an angle and a distance, There is a SDL_Mixer function already explained image

TODO 3

Calculate the distance between the player and the enemy passed by reference using pythagoras image

TODO 4

Once the key is pressed play the fx using PlaySpatialFx() image

TODO 5

Load the audio path given into a Mix_Music variable image

TODO 6

Iterate all the music audios stored in the list (already created in the header file)

TODO 7

Given the fade_time implement a fade in and fade out using Mix_Fade(Out/In)Music, take into account that for the next audio to start playing the last fading must be completed. image

Documentation

Research Document

Gamasutra

SDL_Mixer Doc

GDC Conference

Abey Road Studios