Indicator representing the frequency content

François Kolaczek's icon

Hello everyone

I would like to retrieve an indicator (float) on the frequency content of my audio.

That is to say that for a silence it would be at 0 and for a white noise, almost at 1. When the music is loaded in frequency, it is close to 1 and when it is more "calm", it is closer to 0.

I watched the tutorials on fft~ but I can't figure out how to get an indicator, a float that I can process in the rest of my patch. Could you tell me how I could do it.

Thanks community.

TFL's icon

If your sound source is monophonic (sounding as only one note), you can do pitch tracking with [fzero~] or [retune~ @retune 0 @pitchdetection 1], among other solutions. They will give you a float representing the estimated fundamental frequency of the played note.

For more complex sound, you'll need to be more specific about the nature of your sounds and what you want to do with the analysis.

François Kolaczek's icon

Thanks for your return

I want to detect state changes in music to trigger elements. If the music is not very busy, there is silence, if there are many components...

TFL's icon

Then you need more than simple pitch detection and a single float output.

Check FluCoMa and Mubu packages, both allow you to perform various analysis and extract various informations both offline on pre-recorded material or in real time.

Peter Ostry's icon

If you are not really interested in tonality, but in level changes in different frequency ranges, you could connect a row of parallel bandpass filters to the input and compare their levels with the levels of an identical filter row at your noise source. You would measure the levels with suitable average values. The number of bandpass filters determines the achievable resolution, ‘level jump in time unit’ would be the trigger method.

The frequency-dependent measurement results from the frequency bands that you analyse or ignore.

A constantly playing bagpipe, for example, would repeatedly trigger higher frequencies, indicating that something is changing, not that a new instrument is playing. A steam locomotive or a bubbling mountain creek would mostly trigger depending on the level. I think that a driving ride cymbal or a steady bass line could trigger in a periodic manner. Maybe the real challenge is, to determine what "busy" means …

You could also compare the input with different noise sources. Pink noise probably doesn't work with Metallica.

François Kolaczek's icon

Thanks for your feedback. FluCoMa seems more suitable. Not easy to implement. Will try!

François Kolaczek's icon

Finally, I used the FFT object and then I used the avg object. I averaged this value over 2 seconds. The indicator obtained is rather representative