2 summary:: Basic psychoacoustic amplitude compensation (ANSI A-weighting curve).
3 related:: Classes/AmpComp
4 categories:: UGens>Analysis>Amplitude
9 Higher frequencies are normally perceived as louder, which AmpCompA
10 compensates. Following the measurings by Fletcher and Munson, the
11 ANSI standard describes a function for loudness vs. frequency.
13 Note that this curve is only valid for standardized amplitude.
16 derived from http://www.beis.de/Elektronik/AudioMeasure/WeightingFilters.html
17 and modified to map freq → amp.
21 var c1 = 424.31867740601;
22 var c2 = 11589.093052022;
23 var c3 = 544440.67046057;
24 var c4 = 148698928.24309;
28 var n1 = squared(c1 + r);
31 var n4 = squared(c4 + r);
32 var level = k * m1 / (n1 * n2 * n3 * n4);
41 For a simpler but more flexible curve, see link::Classes/AmpComp::
48 Input frequency value. For freq == root, the output is rootAmp.
51 Root freq relative to which the curve is calculated (usually lowest freq).
54 Amplitude at the minimum point of the curve (around 2512 Hz).
57 Amplitude at the root frequency.
60 Apart from code::freq::, the values are not modulatable
66 // compare a sine without compensation
68 { SinOsc.ar(MouseX.kr(300, 15000, 1)) * 0.1 }.play;
70 // with one that uses amplitude compensation
74 freq = MouseX.kr(300, 15000, 1);
75 SinOsc.ar(freq) * 0.3 * AmpCompA.kr(freq)
80 // adjust the minimum and root amp
81 // (in this way one can flatten out the curve for higher amplitudes)
86 freq = MouseX.kr(300, 18000, 1);
87 Formant.ar(300, freq, 20, 0.1) * AmpCompA.kr(freq, 300, 0.6, 0.3)
93 { AmpCompA.ar(Line.ar(48, 120, 1).midicps, 48.midicps) }.plot(1.0);
97 { AmpCompA.ar(Line.ar(0, 20000, 1)) }.plot(1.0);
99 // compare with AmpComp (exponential decay)
101 { AmpComp.ar(Line.ar(48, 120, 1).midicps, 48.midicps) }.plot(1.0);
105 { AmpComp.ar(Line.ar(40, 20000, 1), 40) }.plot(1.0);
109 // amplitude compensation in frequency modulation (using Fletscher-Munson curve)
113 freq = MouseX.kr(300, 15000, 1);
114 freq = freq * SinOsc.ar(MouseY.kr(3, 200, 1), 0, 0.5, 1);
115 SinOsc.ar(freq) * 0.1 * AmpCompA.ar(freq, 300)
119 // amplitude compensation in frequency modulation (using AmpComp exponential decay)
123 freq = MouseX.kr(300, 15000, 1);
124 freq = freq * SinOsc.ar(MouseY.kr(3, 200, 1), 0, 0.5, 1);
125 SinOsc.ar(freq) * 0.1 * AmpComp.ar(freq, 300)
130 // without amplitude compensation
134 freq = MouseX.kr(300, 15000, 1);
135 freq = freq * SinOsc.ar(MouseY.kr(3, 200, 1), 0, 0.5, 1);
136 SinOsc.ar(freq) * 0.1
144 [1] Function freq -> dB,
145 derived from http://www.beis.de/Elektronik/AudioMeasure/WeightingFilters.html
146 and modified to map freq -> amp
149 var k = 3.5041384e16;
150 var c1 = 424.31867740601;
151 var c2 = 11589.093052022;
152 var c3 = 544440.67046057;
153 var c4 = 148698928.24309;
157 var n1 = squared(c1 + r);
160 var n4 = squared(c4 + r);
161 var level = k * m1 / (n1 * n2 * n3 * n4);