(Lite Version)Auto Volume Control by Ambient Noise

by Lee Jackson

Version 3 (August 6, 2016)

Download (16 downloads)

This flow is the lite version (yet improved) of my previous "cumbersome" version created after I got more familiar of Automate. Now the total number of blocks is less than 30 so that you can play it around with Automate free version.

The flow aims to automatically control the ring and notification sound level by sampling the ambient noise level (take 5 noise sample values within 5 seconds). The averaged noise value will then be fed into a tangent based function to compute the desired phone's ringtone/notification level. The flow will sample the noise level periodically by a predefined interval (default is 20 minutes but you may change it to a larger value for battery efficiency). Apart from this, it will also re-sample the ambient noise once the location is changed by assuming that the ambient noise level is different at two different locations.

There are couple of variables that you need to tune in order to change the behavior of the flow for customization based on your personal preferences and the microphone characteristics of your phone.

(i) sngSensitivity (recommended values 0.5 - 2.0)
This variable is to alter the degree of change of desired phone volume per unit change of ambient noise level

(ii) intGain (recommended values 20 - 80)
This is the overall amplification of the output volume value determined by the tangent function

For those who are interested to know the details of the function, you may find it below:

Desired volume = tan(AmbientNoise/(upperNoiseBound - lowerNoiseBound) x (pi/2) x Sensitivity) x Gain

I came up with the idea to create this flow which was entirely due to the fact that I often forgot to lower my phone volume after I returned home late in the night and the notification sound of the incoming messages frequently awake my parents.

Tags: usage of fork block/multi-fibers, formula using set variable block, sound block, volume block, location block