It is based on this GetSpectrumData test code:
https://docs.unity3d.com/ScriptReference/AudioSource.GetSpectrumData.html
I used the index of 5 but you can tweak that.
It even works with audioSource.PlayOneShot
float[] spectrum = new float[64];
audioSource.GetSpectrumData(spectrum, 0, FFTWindow.Rectangular);
float scale = Mathf.Log(spectrum[5]) + 10f;
Then to get it between 0 and 1 I did this:
if (scale > maxSpectrumValue)
{
maxSpectrumValue = scale;
}
float normalizedScale = scale / maxSpectrumValue;
if (normalizedScale < 0)
{
normalizedScale = 0;
}