TITLE:: FluidOnsetSlice SUMMARY:: Spectral Difference-Based Real-Time Audio Slicer CATEGORIES:: Libraries>FluidDecomposition RELATED:: Guides/FluCoMa, Guides/FluidDecomposition DESCRIPTION:: This class implements many spectral based onset detection algorythms, most of them taken from the literature (http://www.dafx.ca/proceedings/papers/p_133.pdf) It is part of the Fluid Decomposition Toolkit of the FluCoMa project.footnote::This was made possible thanks to the FluCoMa project ( http://www.flucoma.org/ ) funded by the European Research Council ( https://erc.europa.eu/ ) under the European Union’s Horizon 2020 research and innovation programme (grant agreement No 725899).:: The process will return an audio steam with sample-long impulses at estimated starting points of the different slices. CLASSMETHODS:: METHOD:: ar The audio rate version of the object. ARGUMENT:: in The audio to be processed. ARGUMENT:: function 0 - Energy =sum of squares of magnitudes / nBins (\power) 1 - HFC = sum of (squared mag * binNum) / nBins 2 - SpectralFlux = dif in mag between consecutive frames (half rectified) 3 - MKL = sum of log of mag ratio per bin (or: sum of dif of log mag per bin) (\mkl) 4 - IS = itakura - saito divergence 5 - Cosine = cosine distance 6 - PhaseDev = takes 2 past frames, project to current, as anticipated steady state, then compute differences (sums) (\phase) 7 - WPhaseDev = same, but weighted by magnitude to remove chaos noise floor (\wphase) 8 - ComplexDev = same as kPhaseDev, but in the complex domain - anticipated amp(steady) and phase(projected) - complex subtraction -> sum of mag (\complex) 9 - RComplexDev =same as above, but rectified (\rcomplex) ARGUMENT:: thresh diff for each... ARGUMENT:: debounce The minimum duration of a slice in number of hops. ARGUMENT:: filtSize The size of a smoothing filter that is applied on the novelty curve. A larger filter filter size allows for cleaner cuts on very sharp changes. ARGUMENT:: frameDelta distance in samples between the comparison window (flux,mkl,kls,cosine) ARGUMENT:: winSize The window size. As sinusoidal estimation relies on spectral frames, we need to decide what precision we give it spectrally and temporally, in line with Gabor Uncertainty principles. http://www.subsurfwiki.org/wiki/Gabor_uncertainty ARGUMENT:: hopSize The window hope size. As sinusoidal estimation relies on spectral frames, we need to move the window forward. It can be any size but low overlap will create audible artefacts. The -1 default value will default to half of winSize (overlap of 2). ARGUMENT:: fftSize The inner FFT/IFFT size. It should be at least 4 samples long, at least the size of the window, and a power of 2. Making it larger allows an oversampling of the spectral precision. The -1 default value will default to windowSize. ARGUMENT:: maxFFTSize How large can the FFT be, by allocating memory at instantiation time. This is not modulatable. RETURNS:: An audio stream with impulses at detected transients. The latency between the input and the output is winSize. EXAMPLES:: code:: (some example code) ::