1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8">
5 <meta http-equiv=
"Content-Style-Type" content=
"text/css">
7 <meta name=
"Generator" content=
"Cocoa HTML Writer">
8 <meta name=
"CocoaVersion" content=
"949.35">
9 <style type=
"text/css">
10 p
.p1
{margin: 0.0px 0.0px 0.0px 0.0px; font: 22.0px Helvetica
}
11 p
.p2
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; min-height: 14.0px}
12 p
.p3
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
}
13 p
.p4
{margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Monaco
; color: #5a653b}
14 p
.p5
{margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica
; color: #0021e7}
15 p
.p6
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #ad140d; min-height: 12.0px}
16 p
.p7
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #000000; min-height: 12.0px}
17 p
.p8
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #bf0000}
18 p
.p9
{margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco
; color: #000000}
19 span
.s1
{color: #000000}
20 span
.s2
{text-decoration: underline
}
21 span
.s3
{color: #0000bf}
22 span
.Apple-tab-span
{white-space:pre
}
26 <p class=
"p1"><b>PV_JensenAndersen
</b></p>
27 <p class=
"p2"><br></p>
28 <p class=
"p3">FFT feature detector for onset detection based on work described in
<span class=
"Apple-converted-space"> </span></p>
29 <p class=
"p2"><br></p>
30 <p class=
"p4">Jensen,K.
& Andersen, T. H. (
2003). Real-time Beat Estimation Using Feature Extraction.
<span class=
"Apple-converted-space"> </span></p>
31 <p class=
"p4">In Proceedings of the Computer Music Modeling and Retrieval Symposium, Lecture Notes in Computer Science. Springer Verlag.
</p>
32 <p class=
"p2"><br></p>
33 <p class=
"p3">First order derivatives of the features are taken. Threshold may need to be set low to pick up on changes.
<span class=
"Apple-converted-space"> </span></p>
34 <p class=
"p2"><br></p>
35 <p class=
"p3"><b>*ar(buffer, propsc=
0.25, prophfe=
0.25, prophfc=
0.25, propsf=
0.25, threshold=
1.0, waittime=
0.04)
</b></p>
36 <p class=
"p2"><br></p>
37 <p class=
"p3"><b>buffer-
</b> FFT buffer to read from.
</p>
38 <p class=
"p2"><br></p>
39 <p class=
"p3"><b>propsc-
</b> Proportion of spectral centroid feature.
</p>
40 <p class=
"p2"><br></p>
41 <p class=
"p3"><b>prophfe-
</b> Proportion of high frequency energy feature.
</p>
42 <p class=
"p2"><br></p>
43 <p class=
"p3"><b>prophfc-
</b> Proportion of high frequency content feature.
</p>
44 <p class=
"p2"><br></p>
45 <p class=
"p3"><b>propsf-
</b> Proportion of spectral flux feature.
</p>
46 <p class=
"p2"><br></p>
47 <p class=
"p3"><b>threshold-
</b> Threshold level for allowing a detection
</p>
48 <p class=
"p2"><br></p>
49 <p class=
"p3"><b>waittime-
</b> If triggered, minimum wait until a further frame can cause another spot (useful to stop multiple detects on heavy signals)
</p>
50 <p class=
"p2"><br></p>
51 <p class=
"p5"><span class=
"s1">See also
<a href=
"FFT Overview.html"><span class=
"s2">FFT Overview
</span></a>.
</span></p>
52 <p class=
"p2"><br></p>
53 <p class=
"p6"><br></p>
54 <p class=
"p7"><br></p>
55 <p class=
"p8">// Examples
</p>
56 <p class=
"p7"><br></p>
57 <p class=
"p8">// external sound in
<span class=
"Apple-tab-span"> </span><span class=
"Apple-tab-span"> </span></p>
60 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"s3">var
</span> source1, detect;
</p>
61 <p class=
"p9"><span class=
"Apple-tab-span"> </span>source1 =
<span class=
"s3">SoundIn
</span>.ar(
0);
<span class=
"Apple-converted-space"> </span></p>
62 <p class=
"p9"><span class=
"Apple-tab-span"> </span>detect =
<span class=
"s3">PV_JensenAndersen
</span>.ar(
<span class=
"s3">FFT
</span>(
<span class=
"s3">LocalBuf
</span>(
2048), source1), threshold:
<span class=
"s3">MouseX
</span>.kr(
0.1,
1.0));
</p>
63 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"s3">SinOsc
</span>.ar([
440,
445],
0,
<span class=
"s3">Decay
</span>.ar(
0.1 * detect,
0.1));
</p>
64 <p class=
"p9">}.play;
<span class=
"Apple-tab-span"> </span></p>
66 <p class=
"p7"><br></p>
67 <p class=
"p7"><br></p>
68 <p class=
"p8">// using test sound:
<span class=
"Apple-converted-space"> </span></p>
69 <p class=
"p8">// mouse y is difficulty, mouse x is threshold
</p>
72 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"s3">var
</span> source1, detect, difficulty, rate;
</p>
73 <p class=
"p9"><span class=
"Apple-tab-span"> </span>rate =
<span class=
"s3">LFNoise1
</span>.kr(
0.3).exprange(
1,
5);
</p>
74 <p class=
"p9"><span class=
"Apple-tab-span"> </span>difficulty =
<span class=
"s3">MouseY
</span>.kr(
0.01,
0.4,
1);
</p>
75 <p class=
"p9"><span class=
"Apple-tab-span"> </span>source1 =
<span class=
"s3">Decay
</span>.ar(
<span class=
"s3">Impulse
</span>.ar(rate),
0.5 / rate,
1 - difficulty, difficulty);
</p>
76 <p class=
"p9"><span class=
"Apple-tab-span"> </span>source1 = source1 *
<span class=
"s3">PinkNoise
</span>.ar(
1.dup);
</p>
77 <p class=
"p9"><span class=
"Apple-tab-span"> </span>detect =
<span class=
"s3">PV_JensenAndersen
</span>.ar(
<span class=
"s3">FFT
</span>(
<span class=
"s3">LocalBuf
</span>(
2048), source1), threshold:
<span class=
"s3">MouseX
</span>.kr(
0.1,
1.0));
</p>
78 <p class=
"p9"><span class=
"Apple-tab-span"> </span><span class=
"s3">SinOsc
</span>.ar([
440,
445],
0,
<span class=
"s3">Decay
</span>.ar(
0.1 * detect,
0.1)) + source1;
</p>
79 <p class=
"p9">}.play;
<span class=
"Apple-tab-span"> </span></p>
81 <p class=
"p7"><br></p>
82 <p class=
"p7"><br></p>