Microphone to Gameplay mechanics

I’m trying to figure out how to use the microphone and sounds in a co-op game. the catch is that i want the distance that the speech is audible between players to be dependent on volume of the speech through the microphone so yelling will be heard form a farther distance than whispering. also, i want crouch steps, walk steps, and sprint steps to be audible from different distances. CAN YOU HELP ME??

I may not be an expert when it comes to sound programming, but I think this will help. Let’s start with the documentation: Unity - Scripting API: Microphone

This should help with the microphone part in the API. I think that if you want different audio levels of sound, you could somehow set that up by figuring out how sensitive the microphone can be. This shows the microphone capabilities: Unity - Scripting API: Microphone.GetDeviceCaps

Next you would want the distance of game objects and compare that with the levels of the microphone. To get the distance between game objects: Unity - Scripting API: Vector3.Distance

That should help you think for example, 20 unity units (or whatever measuring system you want) this person can hear this, or 80 unity units away this can’t be heard, etc…

As for sound volumes (for steps and other sounds), you can easily set that up to have 3D sound (adjusted to the way you want) inside unity and have an audio listener to hear that from any distance you specify.

Now you can figure out what you want as the gameplay by putting something where you want it to go after getting these pieces of information. I hope this helps you in some way, shape, or form. And I wish you the best of luck.