Core Ideas
This is the most important page for Tiny Ambience, because all its tools are for realizing these implementation idea and getting great result. We should learn why we need seemingly convoluted implementation in games. Can't we just record something then play?
Ambience of the real world
Real ambience you hear in everyday's life may not sounds too exciting but they are so interesting!
It is a continuous blend of little sounds from sources around you with massively complex "algorithm" that finally produces such subtle sound. For example the "wind sound" is characterized by the thing amidst that wind. If there are trees, then the sound depends on physics of branches and the shape of leaves. Even with nothing around you, you "hear the wind" because it hits physically with the shape of your ear.
Unlike BGM or SFX, we can say they have no duration, or rather infinite duration. You don't notice when it ends. You can't hear the same spot where it loops. It sounds subtly different over time, though, there are certainly a central theme for it.
"Duration" of an audio is a computer concept when audio is sampled into a discrete file. It determines whether the file size is large or not because audio file is a squence of samples.
Game-appropriate ambience
We can't literally use infinite length or extremely long length ambient audio clip in games! On the other extreme, putting in a full-blown generative ambience simulation algorithm on trees on your game and then blow wind to it would be definitely overkill and a waste of computation resource. Let's find a balance.
Just a recording of ambience
Naive solution is then to record real world ambience to use in game, which you must make sure it seamlessly loops because we don't have infinite space to store 1 hour long ambience. So you may go into forest and record the leaves, wind, complete with insects and birds as a single file.
But no matter how good the microphone you use, the fact that it loops already discounts great complexity and charm of real world ambience.
Sooner or later the same bird is going to chirp exactly after the same leaf sound. Going for a hike wouldn't be so relaxing if nature works like that.
In this example, the audio loops every 2 units where the arrows are pointing. From the waveform, you already see patterns of sharp attacks on it. Your players will also going to notice that as well.
Parameter changes
Even if you decided to sit at exactly the same spot in the park all day on a day with nice windy weather, nature still has its moment.
Character of ambience maybe largely determined by things around you such as trees, which doesn't change as long as you stay there. But the catalyst from nature such as wind or rain has a certain interval. Sometimes they gets aggressive, sometimes they are subtle.
To simulate that, we can introduce parameter changes spanning over a recorded ambience loop. Other than volume, we maybe could vary the pitch or play speed which can brighten or darken the sound, or change up stereo balance.
By introducing a parameter change that goes over looping boundary, even in a predictable interval like in this example, it can "blends" multiple loops and make it a little bit better.
Look at where the arrows are pointing now. Technically it takes longer to loop if you also count the parameter changes. (Goes from 2 units of length to 6 units, if you look at the top ruler.)
Layering
Though you may call your forest recording as "forest ambience", it could also be thought as a combination of wind, trees, and bird ambiences.
Everything could influence each other in reality, but each one has its own character too. For example, if you found birds of the same species in the forest as in your backyard, the "bird layer" is going to be not that much different.
When viewed an ambience as layers, it could looks like this :
Note the little black tick on each layer, that is where it loops. That means an actual audio clip for each layer that take the game space is as the following red boxes show :
These 3 red boxes together will take more space than if you combined all the layers to 1 file as long as the Wind's red box. But don't fret, with separated layers this is where we can get creative!
For example, you can design different ambiences on an another stage reusing the same birds but with different other layers, balancing the volume differently so birds are subtler. On desert stage, you can use just the wind.
Or how about automating different parameter changes for each layer?
You can have the wind swinging wildly between quiet and strong, then the birds comes in while the wind is weak. If these curves spans across loops, it doesn't sounds like the birds are made of audio clip that short anymore.
In the long run you will massively save space with layered approach while still having variety of ambiences in the game.
Syncopation
Now we have arrived at the most powerful idea that really make your ambience sounds natural!
A lack thereof
Going back to this layering example. As a whole, where does it loops?
The answer is :
Players don't see the layers. When they listen to the combined ambience, they will perceive an ambience looping as long as the Wind's file duration. Therefore our ambience is still too predictable and so an opposite of "natural".
This phenomenon occurs because the length of Birds is 1 unit, the Trees is 2 units, and the Wind is 4 units. The Least Common Multiple of all layers is just 4, that is where player will finally notice the loop. After each 4 units, they are going to hear the same bird at the same tree and at the same wind.
In other words, these 2 spots has exactly the same audio content despite being at different place in the ambience time.
We say an ambience setup like this lacks syncopation. Let's fix this.
Shifting
What if I make the Wind and Birds start at different point in the clip?
Unfortunately, shifting won't create syncopation. The place where audio content are exactly the same still stay intact like before. Shifting just change the audio content at that point.
Still, this is a useful technique to change up the character of your ambience if you are getting "unhappy accidents", such as birds chirping at the same time as other interesting sounds. We have multiple layers, there are many ways to nudge the ambience to your liking!
Loop at different length
Previously we have Trees, Wind, and Birds at length 2, 4, 1 respectively. What if we change just the length of Birds to loop in 0.75 instead? (Of course, we have to ensure it still seamlessly loop.)
Now it is different. Where the Winds and Trees would have looped, the Birds clip (orange) is not at the same spot. The first time it was at the beginning, but the 2nd time it is at 33% of total loop length.
It looks more unpredictable because Least Common Multiple of 2, 4, and 0.75 now increased to 12! (2x6 loops, 4x3 loops, 0.75x16 loops)
Though, you can't just hard calculating LCM as a whole. Human ear is good and can still detect non-syncopation between Trees and Wind (2, and 4) and completely ignore the Birds that we have fixed. It is best to vary the length of many layers to be "detached" from each other as much as possible. Length of prime numbers tends to be more detached from each other by mathematical definition, but first of all, trust your ears.
Fast forwarding to the future
The previous findings tell us to use a looping length that is as unrelated to each other as possible.
Looking at the black ticks now, you see that it is quite complex towards the right side. Important point to note about this looping syncopation "exploit" is that they start off quite orderly, and slowly drifting off to chaos only once some time had passed.
If to the right side is mostly desirable, then every time we play this ambience we should start a whole "ambience time" at larger number, like 8th second in this image instead of 0th second.
Since we have ensured that all layers loops seamlessly, we can actually start playing at any point in the infinite timeline. How about starting at 1,523th second? LCM of 3 small primes like 11, 19, and 47 is as large as 9,823. Who knows what awaits deep in the future?
If the goal is to make it as natural as possible, we might as well random the starting time every time we want to play an ambience to players. Our layers can remain static.
Putting everything together
The last few examples ignored the parameter changes. If you include that, we have got quite a great framework for game ambience! They are made from small piece of layers but builds up something complex.
Tiny Ambience have all the toolings to make all these possible.
- Concepts/Components Introduction : Now it's time to look at the main actors that will realize each part of these ideas.