• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Dynamic Audio Models - Mixing ambiance with not

kupo15

Member
I got dynamic audio to work using the audio_play_sound_at (emitters caused some issues but this seems to do the same thing w/o emitters). I some some questions:

What is the most common model? I'm currently using audio_falloff_exponent_distance falloff factor of 2. Generally, when is exponential vs linear used?

How do I mix ambiance of different types since I can only use of model? For example, a huge waterfall needs to always have its sound heard even when far away which fits the exponential model. However, a small torch needs to go silent when far away because its not as loud so the exponential model doesn't work. Should I be using a linear model and tweak the falloff variables to create the correct sound? Like the waterfall would have bigger distance numbers?
 
M

Misty

Guest
I go for linear. Shouldn't be an issue if you just put it to a small value.
 

kupo15

Member
Thanks!
I ended up keeping the exponential model and comparing the distance away from the listener and stopping/starting the sound
 
M

Misty

Guest
Thanks!
I ended up keeping the exponential model and comparing the distance away from the listener and stopping/starting the sound
From what I can tell, the exponential model is not good for anything but closeup sounds. For instance, sounds like an explosion, or a motor sound, will not be heard in the distance right.The linear is the closest function that sounds like real life for all sounds. For instance, a drop of water will sound like real life, with the linear model, if you simply change the range of the sound.

The mode is audio_falloff_linear_distance that you put in the falloff model.

Then you change the distance in here:
audio_play_sound_at(index, x, y, z, falloff_ref, falloff_max, falloff_factor, loop, priority);

For explosions you want a large distance, for a small marble you just want a small distance.


I did extensive testing choosing different models, linear_distance is the most like real life, the others dont really give a good gradient effect and just feel like an on/off switch.
 

kupo15

Member
From what I can tell, the exponential model is not good for anything but closeup sounds. For instance, sounds like an explosion, or a motor sound, will not be heard in the distance right.The linear is the closest function that sounds like real life for all sounds. For instance, a drop of water will sound like real life, with the linear model, if you simply change the range of the sound.

The mode is audio_falloff_linear_distance that you put in the falloff model.

Then you change the distance in here:
audio_play_sound_at(index, x, y, z, falloff_ref, falloff_max, falloff_factor, loop, priority);

For explosions you want a large distance, for a small marble you just want a small distance.


I did extensive testing choosing different models, linear_distance is the most like real life, the others dont really give a good gradient effect and just feel like an on/off switch.
Hmm, that makes sense I guess. Because if I use the exponential model every emitter would have to have an if statement comparing the dropoff to become silent otherwise the sound would keep playing whereas the linear naturally does this. This is for looping sfx of course.

I actually had the opposite effect where the linear felt like a light switch but perhaps my variables weren't good. What falloff factor did you use? I'm still a bit confused when you would use exponential since no sounds are heard if you are far enough away. Perhaps for example if you are in an enclosed warehouse with generator hums you would hear that hum all the time but when you get closer it gets exponentially louder? So that model makes it easier to achieve that effect?

What do you think of this test? This is using my exponential model with an if statement to turn it off when its too far away. I'll have to experiment with a linear model too
https://www.dropbox.com/s/tsmlj2xpnb9k1fy/dynamic audio test.flv?dl=0
 
M

Misty

Guest
Yeah I tried to build you an example but its doing that stupid bug again. I made a topic about this and I thought it was fixed in GM Studio 2. The bug is that it only effects the sound pan but not the distance. I'm going to look at my old topic to see if I'm forgetting something.

The example you showed has some very nice sounds but you never walk away from it enough for me to tell. The sound is always playing as far as I can tell.

Here is the thread, containing the build I just made for you: https://forum.yoyogames.com/index.p...king-please-switch-to-fmod.60952/#post-384672



Nocturne helped me fix my example, here is the new example with working sounds:
http://www.filedropper.com/soundtest2

You can play with it. I hear what you mean about the on/off switch with the linear model, it suddenly seems to just cut off to zero. I played around with linear_clamped, exponent_clamped, and the inverse, and it didnt seem to really do much.

The exponential sound seems to just have infinite attenuation and you can always hear it for some reason.

I also could not get doppler to work on it either, emitter_velocity seems to do nothing. My advice is just use FMOD audio instead, if its a PC only game. The dll probably doesnt work on other platforms though. Unfortunately GM's new audio engine is missing an audio_pan feature so you cant create your own sound system. (Actually you can, if you tediously save each L R channel as a new sound and play 2 sounds at once.)
 
Last edited:

kupo15

Member
Yeah I see what you mean. At first your project sounded good to me gradually going away, but when I played around with the variables I noticed that cutoff again. The issue appears to be when the object moves too fast outside the cutoff it skips the ending fade out part and just cuts out. I'm not sure what to do other than my current method of using the exponential model with a manual stop sound if statement. The exponential model achieves the fade out much better. Luckily there aren't many sounds that require this manual override though it would be nice to have an additional argument that does this. Maybe I'll create a script for it to make it easier scr_play_audio_on_ext() or something

Any tips or ideas @Nocturne
 
Last edited:
Top