Calculating Spectral Flux

Spectral Flux is the measurement of when the spectrum changes or how much change occurs in the spectrum.  Flux can be programmed further into transient detection or onset detection.  In order to calculate the flux of a spectrum, the current frame and previous frame are compared (subtracted) and then in a program such as Max/MSP, square rooted to imitate a logarithmic scale.

The following short tutorial shows how to calculate spectral flux using objects native to Max/MSP.  To start we need to make a subpatch to use within the pfft~ object.  In this subpatch fftin~ 1 will be used to do the analysis and obtain the real and imaginary numbers.  These numbers will be connected to cartopol~ to be converted to phase and amplitude information.  FFTin~ to cartopol~ is generally used a lot for spectral processing in Max/MSP so remembering this 2 objects is useful and important.

The vectral~ object will be used at this point to track the amplitude information by frame.  The output of this is then subtracted from the current amplitude number and sqrt~ to make everything “logarithmic”.

The last part of the process is obtaining the analysis information as a number outside of the subpatch.  If fftout~ 1 is used, the program will think that you are resynthesizing a sound. Instead fftout~ 1 nofft is used to create an outlet for pfft~ and output the analysis number.  The nofft flag will not use an ifft to resynthesize and instead acts as a regular output.

Screen Shot 2016-02-04 at 12.59.53 PM.png


One thought on “Calculating Spectral Flux

  1. Hello, I just wanted to thank you for sharing the patch so thoroughly explained and in a very easy to follow manner.
    Moreover, I wish to share a bizarre discovery, I found your website (this post) on the same day you posted it (five years ago), plus, today is also my birthday… ahahah what are the odds?!
    Thank you again, and stay safe.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s