1 class:: PV_HainsworthFoote
2 summary:: FFT onset detector.
3 related:: Classes/PV_JensenAndersen
9 FFT onset detector based on work described in emphasis:: Hainsworth, S. (2003) Techniques for the Automated Analysis of Musical Audio. PhD, University of Cambridge engineering dept. ::
10 See especially p128. The Hainsworth metric is a modification of the Kullback Liebler
14 The onset detector has general ability to spot spectral change, so may
15 have some ability to track chord changes aside from obvious transient
16 jolts, but there's no guarantee it won't be confused by frequency
20 Hainsworth metric on it's own gives good results but Foote might be
21 useful in some situations: experimental.
36 What strength of detection signal from Hainsworth metric to use.
41 What strength of detection signal from Foote metric to use. The
42 Foote metric is normalised to (0..1).
47 Threshold hold level for allowing a detection.
52 If triggered, minimum wait until a further frame can cause
53 another spot (useful to stop multiple detects on heavy signals).
60 //just Hainsworth metric with low threshold
64 source1= AudioIn.ar(1);
65 detect= PV_HainsworthFoote.ar(FFT(LocalBuf(2048),source1), 1.0, 0.0);
66 Out.ar(0,SinOsc.ar([440,445],0,Decay.ar(0.1*detect,0.1)));
71 //spot note transitions
75 source1= LFSaw.ar(LFNoise0.kr(1,90,400),0,0.5);
76 detect= PV_HainsworthFoote.ar(FFT(LocalBuf(2048),source1), 1.0, 0.0, 0.9, 0.5);
77 Out.ar(0,Pan2.ar(source1,-1.0)+ Pan2.ar(SinOsc.ar(440,0,Decay.ar(0.1*detect,0.1)),1.0));
83 //Foote solo- never triggers with threshold over 1.0, threshold under mouse control
87 source1= AudioIn.ar(1);
88 detect= PV_HainsworthFoote.ar(FFT(LocalBuf(2048),source1), 0.0, 1.0, MouseX.kr(0.0,1.1), 0.02);
89 Out.ar(0,Pan2.ar(source1,-1.0)+ Pan2.ar(SinOsc.ar(440,0,Decay.ar(0.1*detect,0.1)),1.0));
94 //compare to Amplitude UGen
98 source1= AudioIn.ar(1);
99 detect= (Amplitude.ar(source1)) > (MouseX.kr(0.0,1.1));
100 Out.ar(0,Pan2.ar(source1,-1.0)+ Pan2.ar(SinOsc.ar(440,0,Decay.ar(0.1*detect,0.1)),1.0));