00 \u00a0 \/**********************************************************************
01 \u00a0 Copyright (c) 2014-2016 Mark C. Erickson
02 \u00a0
03 \u00a0 Permission is hereby granted, free of charge, to any person obtaining
04 \u00a0 a copy of this software and associated documentation files (the
05 \u00a0 \"Software\"), to deal in the Software without restriction, including
06 \u00a0 without limitation the rights to use, copy, modify, merge, publish,
07 \u00a0 distribute, sublicense, and\/or sell copies of the Software, and to
08 \u00a0 permit persons to whom the Software is furnished to do so, subject to
09 \u00a0 the following conditions:
10 \u00a0
11 \u00a0 The above copyright notice and this permission notice shall be included
12 \u00a0 in all copies or substantial portions of the Software.
13 \u00a0
14 \u00a0 THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 \u00a0 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 \u00a0 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 \u00a0 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 \u00a0 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 \u00a0 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 \u00a0 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 \u00a0
22 \u00a0 Reference: Rec. ITU-R BS.1770
23 \u00a0
24 \u00a0 **********************************************************************\/
25 \u00a0
<\/p>
Disclaimer...<\/a> 113 \u00a0 @gfx 100 18
26 \u00a0 desc:LUFS Meter, Mono [-18dB], v1.0.1
27 \u00a0
28 \u00a0 @init
29 \u00a0 a1a = -1.69065929318241; \/\/ 48k prefilter, boost highs, model effects of head as a sphere
30 \u00a0 a2a = 0.73248077421585;
31 \u00a0 b0a = 1.53512485958697;
32 \u00a0 b1a = -2.69169618940638;
33 \u00a0 b2a = 1.19839281085285;
34 \u00a0
35 \u00a0 srate == 44100 ? (
36 \u00a0 \ta1a = -1.66365511325602; \/\/ 44k prefilter, boost highs, model effects of head as a sphere
37 \u00a0 \ta2a = 0.71259542807323;
38 \u00a0 \tb0a = 1.53084123005035;
39 \u00a0 \tb1a = -2.65097999515473;
40 \u00a0 \tb2a = 1.16907907992159;
41 \u00a0 );
42 \u00a0
43 \u00a0 axn=0;
44 \u00a0 axn1=0;
45 \u00a0 axn2=0;
46 \u00a0 ayn=0;
47 \u00a0 ayn1=0;
48 \u00a0 ayn2=0;
49 \u00a0
50 \u00a0 a1b = -1.99004745483398; \/\/ 48k High Pass
51 \u00a0 a2b = 0.99007225036621;
52 \u00a0 b0b = 1.0;
53 \u00a0 b1b = -2.0;
54 \u00a0 b2b = 1.0;
55 \u00a0
56 \u00a0 srate == 44100 ? (
57 \u00a0 \ta1b = -1.98916967362980; \/\/ 44k High Pass
58 \u00a0 \ta2b = 0.98919903578704;
59 \u00a0 \tb0b = 0.99956006454251;
60 \u00a0 \tb1b = -1.99912012908503;
61 \u00a0 \tb2b = 0.99956006454251;
62 \u00a0 );
63 \u00a0
64 \u00a0 bxn=0;
65 \u00a0 bxn1=0;
66 \u00a0 bxn2=0;
67 \u00a0 byn=0;
68 \u00a0 byn1=0;
69 \u00a0 byn2=0;
70 \u00a0
71 \u00a0 buf = 0; \/\/ buffer exists at offset 0
72 \u00a0 bufpos = 0;
73 \u00a0 buflength = srate * 3;\/\/1.2; \/\/ 1200 ms
74 \u00a0
75 \u00a0 rmsSum = 0;
76 \u00a0 rmsTarget = 0.01;
77 \u00a0 LUFS_REF = pow(10, 20\/-18);
78 \u00a0
79 \u00a0
80 \u00a0 @sample
81 \u00a0 axn2=axn1;
82 \u00a0 axn1=axn;
83 \u00a0 axn=spl0;
84 \u00a0 ayn2=ayn1;
85 \u00a0 ayn1=ayn;
86 \u00a0
87 \u00a0 ayn=b0a*axn + b1a*axn1 + b2a*axn2 - a1a*ayn1 - a2a*ayn2;
88 \u00a0
89 \u00a0 bxn2=bxn1;
90 \u00a0 bxn1=bxn;
91 \u00a0 bxn=ayn * sqrt(1.3);
92 \u00a0 byn2=byn1;
93 \u00a0 byn1=byn;
94 \u00a0
95 \u00a0 byn=b0b*bxn + b1b*bxn1 + b2b*bxn2 - a1b*byn1 - a2b*byn2;
96 \u00a0
97 \u00a0 rmsValue = byn * byn;
98 \u00a0 rmsSum -= buf[bufpos];
99 \u00a0 buf[bufpos] = rmsValue;
100 \u00a0 rmsSum += rmsValue;
101 \u00a0
102 \u00a0 bufpos = bufpos + 1 ;
103 \u00a0 bufpos > buflength ? bufpos = 0;
104 \u00a0
105 \u00a0 gain = 1.0;
106 \u00a0 rmsDelta = rmsSum \/ buflength;
107 \u00a0 rmsDB = 20 * log10(sqrt(rmsDelta) \/ LUFS_REF) - 24; \/\/ -21 for stereo simulation
108 \u00a0
109 \u00a0 spl0 = axn;
110 \u00a0 spl1 = spl1;
111 \u00a0
Graphics...<\/a><\/p>
114 \u00a0 gfx_x=gfx_y=5;
115 \u00a0 gfx_r=0.7;
116 \u00a0 gfx_g=1;
117 \u00a0 gfx_b=0.1;
118 \u00a0 gfx_a=1;
119 \u00a0 gfx_drawchar($'L');
120 \u00a0 gfx_drawchar($'U');
121 \u00a0 gfx_drawchar($'F');
122 \u00a0 gfx_drawchar($'S');
123 \u00a0 gfx_drawchar($' ');
124 \u00a0 gfx_drawchar($'1');
125 \u00a0 gfx_drawchar($'8');
126 \u00a0 gfx_drawchar($':');
127 \u00a0 gfx_drawchar($' ');
128 \u00a0 gfx_drawnumber(rmsDB,1);
129 \u00a0
130 \u00a0 \n
<\/p>Download<\/a>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/www.auriculaonline.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/320"}],"collection":[{"href":"http:\/\/www.auriculaonline.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.auriculaonline.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.auriculaonline.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.auriculaonline.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=320"}],"version-history":[{"count":3,"href":"http:\/\/www.auriculaonline.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/320\/revisions"}],"predecessor-version":[{"id":584,"href":"http:\/\/www.auriculaonline.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/320\/revisions\/584"}],"wp:attachment":[{"href":"http:\/\/www.auriculaonline.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=320"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.auriculaonline.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=320"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.auriculaonline.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=320"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}