Measure how much activity is occurring within certain frequency values in Python
<p>I'm trying to find a way to obtain frequency values (in Hz) of an audio file, and measure how often these frequency values occur in proportion to the rest of the frequency values in that file. </p>

<p>For example, in an audio file, I'd like to see what proportion of the audio activity occurs within the 300 - 500 Hz range.</p>

<p>This would be simple if I could somehow get a list or an array filled with all frequency values of a given audio file, but I don't know how to do that.</p>

<p>Thank you.</p>

<p>You may be looking for a <a href="https://en.wikipedia.org/wiki/Fourier_transform" rel="nofollow">Fourier Transform</a> or <a href="https://en.wikipedia.org/wiki/Fast_Fourier_transform" rel="nofollow">Fast Fourier Transform</a>.</p>

<p>From Wikipedia:</p>

<p><a href="http://i.stack.imgur.com/QWXIG.png" rel="nofollow"><img src="http://i.stack.imgur.com/QWXIG.png" alt="Fourier Transform"></a></p>

<p>On the left would be your normal signal, and on the right is your frequency-domain signal. Of course, you can just cut out the 300-500 Hz range, take the integral over that area, then divide by the total area to get the proportion...</p>

<p>Not really my specialty, but consider a <a href="http://docs.scipy.org/doc/scipy/reference/generated/scipy.fftpack.fft.html#scipy.fftpack.fft" rel="nofollow">scipy solution</a>?</p>

python audio frequency