From ec095a08b4a9409534ab8ce2b1d06d6d4f16907a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E5=9D=9A=E6=9E=9C?= <753610399@qq.com> Date: Mon, 9 Sep 2019 21:59:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=BC=BA!isSecureContext=E4=B8=8B?= =?UTF-8?q?=E7=9A=84=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 ++++++---- app-support-sample/index.html | 2 +- dist/recorder-core.js | 2 +- index.html | 4 ++-- recorder.mp3.min.js | 2 +- recorder.wav.min.js | 2 +- src/recorder-core.js | 19 +++++++++++++++---- 7 files changed, 27 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 03832f4..06afa87 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # :open_book:Recorder用于html5录音 -[在线测试](https://xiangyuecn.github.io/Recorder/),支持大部分已实现`getUserMedia`的移动端、PC端浏览器;主要包括:Chrome、Firefox、Safari、Android WebView、腾讯Android X5内核(QQ、微信);不支持:UC系内核(典型的支付宝,大部分国产手机厂商的浏览器)。快捷方式: [【RecordApp测试】](https://jiebian.life/web/h5/github/recordapp.aspx),[【Android、IOS App Demo】](https://github.com/xiangyuecn/Recorder/tree/master/app-support-sample),[【工具】裸(RAW、WAV)PCM转WAV播放测试和转码](https://xiangyuecn.github.io/Recorder/assets/%E5%B7%A5%E5%85%B7-%E8%A3%B8PCM%E8%BD%ACWAV%E6%92%AD%E6%94%BE%E6%B5%8B%E8%AF%95.html) ,[查看caniuse浏览器支持情况](https://caniuse.com/#search=getUserMedia)。 +[在线测试](https://xiangyuecn.github.io/Recorder/),支持大部分已实现`getUserMedia`的移动端、PC端浏览器;主要包括:Chrome、Firefox、Safari、Android WebView、腾讯Android X5内核(QQ、微信);不支持:UC系内核(典型的支付宝,大部分国产手机厂商的浏览器),IOS上除Safari外的其他任何形式的浏览器(含PWA、WebClip)。快捷方式: [【RecordApp测试】](https://jiebian.life/web/h5/github/recordapp.aspx),[【Android、IOS App Demo】](https://github.com/xiangyuecn/Recorder/tree/master/app-support-sample),[【工具】裸(RAW、WAV)PCM转WAV播放测试和转码](https://xiangyuecn.github.io/Recorder/assets/%E5%B7%A5%E5%85%B7-%E8%A3%B8PCM%E8%BD%ACWAV%E6%92%AD%E6%94%BE%E6%B5%8B%E8%AF%95.html) ,[查看caniuse浏览器支持情况](https://caniuse.com/#search=getUserMedia)。 录音默认输出mp3格式,另外可选wav格式(raw pcm format此格式录音文件超大);有限支持ogg(beta)、webm(beta)、amr(beta)格式;支持任意格式扩展(前提有相应编码器)。 @@ -247,7 +247,7 @@ set={ **注意:set内是数字的明确传数字**,不要传字符串之类的导致不可预测的异常,其他有配置的地方也是一样(感谢`214282049@qq.com`19-01-10发的反馈邮件)。 ### 【方法】rec.open(success,fail) -请求打开录音资源,如果浏览器不支持录音或用户拒绝麦克风权限将会调用`fail`;打开后需要调用`close`来关闭,因为浏览器或设备的系统可能会显示正在录音。 +请求打开录音资源,如果浏览器不支持录音、用户拒绝麦克风权限、或者非安全环境(非https、file等)将会调用`fail`;打开后需要调用`close`来关闭,因为浏览器或设备的系统可能会显示正在录音。 注意:此方法回调是可能是同步的(异常、或者已持有资源时)也可能是异步的(浏览器弹出权限请求时);一般使用时打开,用完立即关闭;可重复调用,可用来测试是否能录音。 @@ -266,15 +266,17 @@ set={ 注意:如果创建了多个Recorder对象并且调用了open(应避免同时有多个对象进行了open),只有最后一个新建的才有权限进行实际的资源释放(和多个对象close调用顺序无关),浏览器或设备的系统才会不再显示正在录音的提示。 ### 【方法】rec.start() -开始录音,需先调用`open`;如果不支持、错误,不会有任何提示,因为stop时自然能得到错误。 +开始录音,需先调用`open`;最佳实践为:每次调用`start`前都调用一次`open`以达到最佳的兼容性,录音`stop`后调用`close`进行关闭;如果不支持、错误,不会有任何提示,因为stop时自然能得到错误。 -### 【方法】rec.stop(success,fail) +### 【方法】rec.stop(success,fail,autoClose) 结束录音并返回录音数据`blob对象`,拿到blob对象就可以为所欲为了,不限于立即播放、上传 `success(blob,duration)`:`blob`:录音数据audio/mp3|wav...格式,`duration`:录音时长,单位毫秒 `fail(errMsg)`:录音出错回调 +`autoClose`:`false` 可选,是否自动调用`close`,默认为`false`不调用 + 提示:stop时会进行音频编码,根据类型的不同音频编码花费的时间也不相同。对于支持边录边转码(Worker)的类型,将极速完成编码并回调;对于不支持的10几秒录音花费2秒左右算是正常,但内部采用了分段编码+setTimeout来处理,界面卡顿不明显。 diff --git a/app-support-sample/index.html b/app-support-sample/index.html index 8110c31..84d4f4e 100644 --- a/app-support-sample/index.html +++ b/app-support-sample/index.html @@ -232,7 +232,7 @@ UA:{fn:navigator.userAgent} RecordApp库修改时间(有可能修改了忘改):{fn:RecordApp.LM} -Recorder库修改时间(有可能修改了忘改):{fn:RecorderLM} +Recorder库修改时间(有可能修改了忘改):{fn:Recorder.LM} 本页面修改时间(有可能修改了忘改):{fn:PageLM} diff --git a/dist/recorder-core.js b/dist/recorder-core.js index e219253..5fa6584 100644 --- a/dist/recorder-core.js +++ b/dist/recorder-core.js @@ -3,4 +3,4 @@ https://github.com/xiangyuecn/Recorder src: recorder-core.js */ -!function(a){"use strict";a.RecorderLM="2019-9-6 23:22:12";var f=function(){};function m(e){return new t(e)}function t(e){var t={type:"mp3",bitRate:16,sampleRate:16e3,bufferSize:4096,onProcess:f};for(var a in e)t[a]=e[a];this.set=t,this._S=9}m.IsOpen=function(){var e=m.Stream;if(e){var t=e.getTracks();if(0"+u.length+" 花:"+(Date.now()-n)+"ms"),setTimeout(function(){n=Date.now(),r[o.type](u,function(e){i(e,p)},function(e){s(e)})})}else s("未加载"+o.type+"编码器");else s("未采集到录音")}},a.Recorder=m}(window); \ No newline at end of file +!function(f){"use strict";v.LM="2019-9-9 21:09:34";var u=function(){};function v(e){return new t(e)}function t(e){var t={type:"mp3",bitRate:16,sampleRate:16e3,bufferSize:4096,onProcess:u};for(var a in e)t[a]=e[a];this.set=t,this._S=9}v.IsOpen=function(){var e=v.Stream;if(e){var t=e.getTracks();if(0"+m.length+" 花:"+(Date.now()-n)+"ms"),setTimeout(function(){n=Date.now(),r[o.type](m,function(e){c(e,u)},function(e){i(e)})})}else i("未加载"+o.type+"编码器");else i("未采集到录音")}},f.Recorder=v}(window); \ No newline at end of file diff --git a/index.html b/index.html index 40ab15c..71f29de 100644 --- a/index.html +++ b/index.html @@ -191,7 +191,7 @@ UA:{fn:navigator.userAgent} -Recorder库修改时间(有可能修改了忘改):{fn:RecorderLM} +Recorder库修改时间(有可能修改了忘改):{fn:Recorder.LM} 本页面修改时间(有可能修改了忘改):{fn:PageLM} @@ -259,7 +259,7 @@ rec.open(function(){ dialogCancel(); - reclog("已打开:"+type+" "+bit+"kbps"); + reclog("已打开:"+type+" "+bit+"kbps 最佳实践是: 每次录音都先open -> start -> stop -> close,才能确保最佳的兼容性"); wave=Recorder.WaveView({elem:".recwave"}); },function(e,isUserNotAllow){ diff --git a/recorder.mp3.min.js b/recorder.mp3.min.js index 70c441a..944ed78 100644 --- a/recorder.mp3.min.js +++ b/recorder.mp3.min.js @@ -3,4 +3,4 @@ https://github.com/xiangyuecn/Recorder src: recorder-core.js,engine/mp3.js,engine/mp3-engine.js */ -!function(a){"use strict";a.RecorderLM="2019-9-6 23:22:12";var f=function(){};function u(e){return new t(e)}function t(e){var t={type:"mp3",bitRate:16,sampleRate:16e3,bufferSize:4096,onProcess:f};for(var a in e)t[a]=e[a];this.set=t,this._S=9}u.IsOpen=function(){var e=u.Stream;if(e){var t=e.getTracks();if(0"+c.length+" 花:"+(Date.now()-s)+"ms"),setTimeout(function(){s=Date.now(),n[r.type](c,function(e){_(e,l)},function(e){i(e)})})}else i("未加载"+r.type+"编码器");else i("未采集到录音")}},a.Recorder=u}(window),function(){"use strict";Recorder.prototype.enc_mp3={stable:!0,testmsg:"采样率范围48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000"},Recorder.prototype.mp3=function(t,a,e){var s=this.set,n=t.length,r=this.mp3_start(s);if(r)return this.mp3_encode(r,t),void this.mp3_complete(r,a,e,1);var i=new Recorder.lamejs.Mp3Encoder(1,s.sampleRate,s.bitRate),_=[],o=0,l=function(){var e;o>=1;0!=e--;)n[r++]=i>a[s++]?0:1,n[r++]=i>a[s++]?0:1}function A(e,t,a,s,n,r){var i=(e>>=1)%2;for(e>>=1;0!=e--;){var _,o,l,f,c,h,u,b;_=a[s++]*t,o=a[s++]*t,c=0|_,l=a[s++]*t,h=0|o,f=a[s++]*t,u=0|l,_+=R.adj43[c],b=0|f,o+=R.adj43[h],n[r++]=0|_,l+=R.adj43[u],n[r++]=0|o,f+=R.adj43[b],n[r++]=0|l,n[r++]=0|f}0!=i&&(c=0|(_=a[s++]*t),h=0|(o=a[s++]*t),_+=R.adj43[c],o+=R.adj43[h],n[r++]=0|_,n[r++]=0|o)}var _=[1,2,5,7,7,10,10,13,13,13,13,13,13,13,13];function v(e,t,a,s){var n=function(e,t,a){var s=0,n=0;do{var r=e[t++],i=e[t++];s>=16)&&(_=r,s++),n.bits+=_,s}(e,t,a,_[n-1],s);case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:return function(e,t,a,s,n){var r=0,i=0,_=0,o=F.ht[s].xlen,l=F.ht[s].hlen,f=F.ht[s+1].hlen,c=F.ht[s+2].hlen;do{var h=e[t+0]*o+e[t+1];t+=2,r+=l[h],i+=f[h],_+=c[h]}while(t=n);r++);for(i=r-8;i<24&&!(F.ht[i].linmax>=n);i++);return function(e,t,a,s,n,r){var i,_=65536*F.ht[s].xlen+F.ht[n].xlen,o=0;do{var l=e[t++],f=e[t++];0!=l&&(14>=16)&&(o=i,s=n),r.bits+=o,s}(e,t,a,i,r,s)}}function u(e,t,a,s,n,r,i,_){for(var o=t.big_values,l=2;l>1<<1);for(null!=a&&(a.sfb_count1=0);1t.big_values&&(r=t.big_values),i=t.big_values;else if(t.block_type==Pe.NORM_TYPE){if(r=t.region0_count=e.bv_scf[n-2],i=t.region1_count=e.bv_scf[n-1],i=e.scalefac_band.l[r+i+2],r=e.scalefac_band.l[r+1],ir)return y.LARGE_BITS;if(function(e,t,a,s,n){var r,i,_,o=0,l=0,f=0,c=0,h=t,u=0,b=h,p=0,m=e,d=0;for(_=null!=n&&s.global_gain==n.global_gain,i=s.block_type==Pe.SHORT_TYPE?38:21,r=0;r<=i;r++){var v=-1;if((_||s.block_type==Pe.NORM_TYPE)&&(v=s.global_gain-(s.scalefac[r]+(0!=s.preflag?R.pretab[r]:0)<s.max_nonzero_coeff&&(g=s.max_nonzero_coeff-o+1,ke.fill(t,s.max_nonzero_coeff,576,0),(S=g)<0&&(S=0),r=i+1),0==l&&0==f&&(b=h,p=u,m=e,d=c),null!=n&&0=n.sfb_count1&&0=n.step[r]?(0!=l&&(A(l,a,m,d,b,p),l=0,b=h,p=u,m=e,d=c),f+=S):(0!=f&&(M(f,a,m,d,b,p),f=0,b=h,p=u,m=e,d=c),l+=S),S<=0){0!=f&&(M(f,a,m,d,b,p),f=0),0!=l&&(A(l,a,m,d,b,p),l=0);break}}r<=i&&(u+=s.width[r],c+=s.width[r],o+=s.width[r])}0!=l&&(A(l,a,m,d,b,p),l=0),0!=f&&(M(f,a,m,d,b,p),f=0)}(t,n,R.IPOW20(a.global_gain),a,s),0!=(2&e.substep_shaping))for(var i=0,_=a.global_gain+a.scalefac_scale,o=.634521682242439/R.IPOW20(_),l=0;l=o?n[f]:0}return this.noquant_count_bits(e,a,s)},this.best_huffman_divide=function(e,t){var a=new E,s=t.l3_enc,n=Be(23),r=Be(23),i=Be(23),_=Be(23);if(t.block_type!=Pe.SHORT_TYPE||1!=e.mode_gr){a.assign(t),t.block_type==Pe.NORM_TYPE&&(!function(e,t,a,s,n,r,i){for(var _=t.big_values,o=0;o<=22;o++)s[o]=y.LARGE_BITS;for(o=0;o<16;o++){var l=e.scalefac_band.l[o+1];if(_<=l)break;var f=0,c=new d(f),h=v(a,0,l,c);f=c.bits;for(var u=0;u<8;u++){var b=e.scalefac_band.l[o+u+2];if(_<=b)break;var p=f,m=v(a,l,b,c=new d(p));p=c.bits,s[o+u]>p&&(s[o+u]=p,r[(n[o+u]=o)+u]=h,i[o+u]=m)}}}(e,t,s,n,r,i,_),u(e,a,t,s,n,r,i,_));var o=a.big_values;if(!(0==o||1<(s[o-2]|s[o-1])||576<(o=t.count1+2))){a.assign(t),a.count1=o;for(var l=0,f=0;o>a.big_values;o-=4){var c=2*(2*(2*s[o-4]+s[o-3])+s[o-2])+s[o-1];l+=F.t32l[c],f+=F.t33l[c]}if(a.big_values=o,a.count1table_select=0,fa.part2_3_length&&t.assign(a)}}}};var h=[1,1,1,1,8,2,2,2,4,4,4,8,8,8,16,16],b=[1,2,4,8,1,2,4,8,2,4,8,2,4,8,4,8],p=[0,0,0,0,3,1,1,1,2,2,2,3,3,3,4,4],m=[0,1,2,3,0,1,2,3,1,2,3,1,2,3,2,3];T.slen1_tab=p,T.slen2_tab=m,this.best_scalefac_store=function(e,t,a,s){var n,r,i,_,o=s.tt[t][a],l=0;for(n=i=0;n>=1);o.scalefac_scale=l=1}}if(0==o.preflag&&o.block_type!=Pe.SHORT_TYPE&&2==e.mode_gr){for(n=11;nf&&(s.part2_length=f,s.scalefac_compress=r)}}(a,s),l=0),n=0;ns[t]&&(e.part2_length=s[t],e.scalefac_compress=t);return e.part2_length==y.LARGE_BITS};var g=[[15,15,7,7],[15,15,7,0],[7,3,0,0],[15,31,31,0],[7,7,7,0],[3,3,0,0]];this.scale_bitcount_lsf=function(e,t){var a,s,n,r,i,_,o,l,f=Be(4),c=t.scalefac;for(a=0!=t.preflag?2:0,o=0;o<4;o++)f[o]=0;if(t.block_type==Pe.SHORT_TYPE){s=1;var h=R.nr_of_sfb_block[a][s];for(n=l=0;n<4;n++)for(r=h[n]/3,o=0;of[n]&&(f[n]=c[3*l+i])}else{s=0;h=R.nr_of_sfb_block[a][s];for(n=l=0;n<4;n++)for(r=h[n],o=0;of[n]&&(f[n]=c[l])}for(_=!1,n=0;n<4;n++)f[n]>g[a][n]&&(_=!0);if(!_){var u,b,p,m;for(t.sfb_partition_table=R.nr_of_sfb_block[a][s],n=0;n<4;n++)t.slen[n]=S[f[n]];switch(u=t.slen[0],b=t.slen[1],p=t.slen[2],m=t.slen[3],a){case 0:t.scalefac_compress=(5*u+b<<4)+(p<<2)+m;break;case 1:t.scalefac_compress=400+(5*u+b<<2)+p;break;case 2:t.scalefac_compress=500+3*u+b;break;default:$.err.printf("intensity stereo not implemented yet\n")}}if(!_)for(n=t.part2_length=0;n<4;n++)t.part2_length+=t.slen[n]*t.sfb_partition_table[n];return _};var S=[0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4];this.huffman_init=function(e){for(var t=2;t<=576;t+=2){for(var a,s=0;e.scalefac_band.l[++s]t;)a--;for(a<0&&(a=n[s][0]),e.bv_scf[t-2]=a,a=n[s][1];e.scalefac_band.l[a+e.bv_scf[t-2]+2]>t;)a--;a<0&&(a=n[s][1]),e.bv_scf[t-1]=a}}}function Y(){var r=64.82,i=.95,s=Y.RMS_WINDOW_TIME_NUMERATOR,n=Y.RMS_WINDOW_TIME_DENOMINATOR,d=[[.038575994352,-3.84664617118067,-.02160367184185,7.81501653005538,-.00123395316851,-11.34170355132042,-9291677959e-14,13.05504219327545,-.01655260341619,-12.28759895145294,.02161526843274,9.4829380631979,-.02074045215285,-5.87257861775999,.00594298065125,2.75465861874613,.00306428023191,-.86984376593551,.00012025322027,.13919314567432,.00288463683916],[.0541865640643,-3.47845948550071,-.02911007808948,6.36317777566148,-.00848709379851,-8.54751527471874,-.00851165645469,9.4769360780128,-.00834990904936,-8.81498681370155,.02245293253339,6.85401540936998,-.02596338512915,-4.39470996079559,.01624864962975,2.19611684890774,-.00240879051584,-.75104302451432,.00674613682247,.13149317958808,-.00187763777362],[.15457299681924,-2.37898834973084,-.09331049056315,2.84868151156327,-.06247880153653,-2.64577170229825,.02163541888798,2.23697657451713,-.05588393329856,-1.67148153367602,.04781476674921,1.00595954808547,.00222312597743,-.45953458054983,.03174092540049,.16378164858596,-.01390589421898,-.05032077717131,.00651420667831,.0234789740702,-.00881362733839],[.30296907319327,-1.61273165137247,-.22613988682123,1.0797749225997,-.08587323730772,-.2565625775407,.03282930172664,-.1627671912044,-.00915702933434,-.22638893773906,-.02364141202522,.39120800788284,-.00584456039913,-.22138138954925,.06276101321749,.04500235387352,-828086748e-14,.02005851806501,.00205861885564,.00302439095741,-.02950134983287],[.33642304856132,-1.49858979367799,-.2557224142557,.87350271418188,-.11828570177555,.12205022308084,.11921148675203,-.80774944671438,-.07834489609479,.47854794562326,-.0046997791438,-.12453458140019,-.0058950022444,-.04067510197014,.05724228140351,.08333755284107,.00832043980773,-.04237348025746,-.0163538138454,.02977207319925,-.0176017656815],[.4491525660845,-.62820619233671,-.14351757464547,.29661783706366,-.22784394429749,-.372563729424,-.01419140100551,.00213767857124,.04078262797139,-.42029820170918,-.12398163381748,.22199650564824,.04097565135648,.00613424350682,.10478503600251,.06747620744683,-.01863887810927,.05784820375801,-.03193428438915,.03222754072173,.00541907748707],[.56619470757641,-1.04800335126349,-.75464456939302,.29156311971249,.1624213774223,-.26806001042947,.16744243493672,.00819999645858,-.18901604199609,.45054734505008,.3093178284183,-.33032403314006,-.27562961986224,.0673936833311,.00647310677246,-.04784254229033,.08647503780351,.01639907836189,-.0378898455484,.01807364323573,-.00588215443421],[.58100494960553,-.51035327095184,-.53174909058578,-.31863563325245,-.14289799034253,-.20256413484477,.17520704835522,.1472815413433,.02377945217615,.38952639978999,.15558449135573,-.23313271880868,-.25344790059353,-.05246019024463,.01628462406333,-.02505961724053,.06920467763959,.02442357316099,-.03721611395801,.01818801111503,-.00749618797172],[.53648789255105,-.2504987195602,-.42163034350696,-.43193942311114,-.00275953611929,-.03424681017675,.04267842219415,-.04678328784242,-.10214864179676,.26408300200955,.14590772289388,.15113130533216,-.02459864859345,-.17556493366449,-.11202315195388,-.18823009262115,-.04060034127,.05477720428674,.0478866554818,.0470440968812,-.02217936801134]],v=[[.98621192462708,-1.97223372919527,-1.97242384925416,.97261396931306,.98621192462708],[.98500175787242,-1.96977855582618,-1.97000351574484,.9702284756635,.98500175787242],[.97938932735214,-1.95835380975398,-1.95877865470428,.95920349965459,.97938932735214],[.97531843204928,-1.95002759149878,-1.95063686409857,.95124613669835,.97531843204928],[.97316523498161,-1.94561023566527,-1.94633046996323,.94705070426118,.97316523498161],[.96454515552826,-1.92783286977036,-1.92909031105652,.93034775234268,.96454515552826],[.96009142950541,-1.91858953033784,-1.92018285901082,.92177618768381,.96009142950541],[.95856916599601,-1.9154210807478,-1.91713833199203,.91885558323625,.95856916599601],[.94597685600279,-1.88903307939452,-1.89195371200558,.89487434461664,.94597685600279]];function g(e,t,a,s,n,r){for(;0!=n--;)a[s]=1e-10+e[t+0]*r[0]-a[s-1]*r[1]+e[t-1]*r[2]-a[s-2]*r[3]+e[t-2]*r[4]-a[s-3]*r[5]+e[t-3]*r[6]-a[s-4]*r[7]+e[t-4]*r[8]-a[s-5]*r[9]+e[t-5]*r[10]-a[s-6]*r[11]+e[t-6]*r[12]-a[s-7]*r[13]+e[t-7]*r[14]-a[s-8]*r[15]+e[t-8]*r[16]-a[s-9]*r[17]+e[t-9]*r[18]-a[s-10]*r[19]+e[t-10]*r[20],++s,++t}function S(e,t,a,s,n,r){for(;0!=n--;)a[s]=e[t+0]*r[0]-a[s-1]*r[1]+e[t-1]*r[2]-a[s-2]*r[3]+e[t-2]*r[4],++s,++t}function R(e){return e*e}this.InitGainAnalysis=function(e,t){return function(e,t){for(var a=0;ae.sampleWindow-e.totsamp?e.sampleWindow-e.totsamp:c,uMAX_ORDER-u&&(h=MAX_ORDER-u)):(_=a+u,o=t,l=n+u,f=s),g(o,_,e.lstepbuf,e.lstep+e.totsamp,h,d[e.reqindex]),g(f,l,e.rstepbuf,e.rstep+e.totsamp,h,d[e.reqindex]),S(e.lstepbuf,e.lstep+e.totsamp,e.loutbuf,e.lout+e.totsamp,h,v[e.reqindex]),S(e.rstepbuf,e.rstep+e.totsamp,e.routbuf,e.rout+e.totsamp,h,v[e.reqindex]),_=e.lout+e.totsamp,o=e.loutbuf,l=e.rout+e.totsamp,f=e.routbuf;for(var b=h%8;0!=b--;)e.lsum+=R(o[_++]),e.rsum+=R(f[l++]);for(b=h/8;0!=b--;)e.lsum+=R(o[_+0])+R(o[_+1])+R(o[_+2])+R(o[_+3])+R(o[_+4])+R(o[_+5])+R(o[_+6])+R(o[_+7]),_+=8,e.rsum+=R(f[l+0])+R(f[l+1])+R(f[l+2])+R(f[l+3])+R(f[l+4])+R(f[l+5])+R(f[l+6])+R(f[l+7]),l+=8;if(c-=h,u+=h,e.totsamp+=h,e.totsamp==e.sampleWindow){var p=10*Y.STEPS_per_dB*w((e.lsum+e.rsum)/e.totsamp*.5+1e-37),m=p<=0?0:0|p;m>=e.A.length&&(m=e.A.length-1),e.A[m]++,e.lsum=e.rsum=0,$.arraycopy(e.loutbuf,e.totsamp,e.loutbuf,0,MAX_ORDER),$.arraycopy(e.routbuf,e.totsamp,e.routbuf,0,MAX_ORDER),$.arraycopy(e.lstepbuf,e.totsamp,e.lstepbuf,0,MAX_ORDER),$.arraycopy(e.rstepbuf,e.totsamp,e.rstepbuf,0,MAX_ORDER),e.totsamp=0}if(e.totsamp>e.sampleWindow)return GAIN_ANALYSIS_ERROR}return r>24,e[t+1]=255&a>>16,e[t+2]=255&a>>8,e[t+3]=255&a}function V(e,t,a){e[t+0]=255&a>>8,e[t+1]=255&a}function _(e,t,a){return 255&(e<>8^a[255&(t^e)]}this.addVbrFrame=function(e){var t=e.internal_flags,a=F.bitrate_table[e.version][t.bitrate_index];!function(e,t){if(e.nVbrNumFrames++,e.sum+=t,e.seen++,!(e.seen>3&1,i=e[a+2]>>2&3,_=e[a+3]>>6&3,o=e[a+2]>>4&15;if(o=F.bitrate_table[r][o],e[a+1]>>4==14?t.samprate=F.samplerate_table[2][i]:t.samprate=F.samplerate_table[r][i],s=e,n=a+=0!=r?3!=_?36:21:3!=_?21:13,!new String(s,n,m.length(),p).equals(m)&&!new String(s,n,d.length(),p).equals(d))return null;a+=4,t.hId=r;var l=t.flags=v(e,a);if(a+=4,0!=(1&l)&&(t.frames=v(e,a),a+=4),0!=(2&l)&&(t.bytes=v(e,a),a+=4),0!=(4&l)){if(null!=t.toc)for(var f=0;f>4;var h=(15&e[a+1])<<8;return(c<0||3e3e.pos-1&&(n=e.pos-1);var r=0|256*e.bag[n]/e.sum;255e.scale_right||e.disable_reservoir&&e.brate<320||e.noATH||e.ATHonly||0==x||e.in_samplerate<=32e3)&&(M=1),i=S+(R<<2)+(M<<5)+(A<<6),_=f.nMusicCRC,O(a,s+c,b),c+=4;for(var P=0;P<9;P++)a[s+c+P]=255&p.charAt(P);a[s+(c+=9)]=255&r,a[s+ ++c]=255&d,O(a,s+ ++c,v),V(a,s+(c+=4),g),V(a,s+(c+=2),0),a[s+(c+=2)]=255&o,a[s+ ++c]=255<=l?255:255&l,a[s+ ++c]=255&h>>4,a[s+c+1]=255&(h<<4)+(u>>8),a[s+c+2]=255&u,a[s+(c+=3)]=255&i,c++,a[s+c++]=0,V(a,s+c,e.preset),O(a,s+(c+=2),t),V(a,s+(c+=4),_),c+=2;for(var I=0;Is.length?-1:(n<1||t.write(s,0,n),0)}}function C(){var o=this,s=32773,c=null,h=null,r=null,u=null;this.setModules=function(e,t,a,s){c=e,h=t,r=a,u=s};var b=null,l=0,p=0,m=0;function d(e,t,a){for(;0>a<>a<>3]|=t>>a<<8-(7&s)-n,s+=n}e.header[e.h_ptr].ptr=s}function n(e,t){e<<=8;for(var a=0;a<8;a++)0!=(65536&((t<<=1)^(e<<=1)))&&(t^=s);return t}function v(e,t){var a,s=F.ht[t.count1table_select+32],n=0,r=t.big_values,i=t.big_values;for(a=(t.count1-t.big_values)/4;0t.big_values&&(a=t.big_values);var s=g(e,t.table_select[0],0,a,t);return s+=g(e,t.table_select[1],a,t.big_values,t)}function R(e,t){var a,s,n,r;a=t.big_values;var i=t.region0_count+1;return n=e.scalefac_band.l[i],i+=t.region1_count+1,a>8),t[5]=byte(255&a)},this.flush_bitstream=function(e){var t,a,s=e.internal_flags,n=s.h_ptr-1;if(-1==n&&(n=G.MAX_HEADER_BUF-1),t=s.l3_side,!((a=A(e,new M))<0)){if(_(e,a),s.ResvSize=0,t.main_data_begin=0,s.findReplayGain){var r=c.GetTitleGain(s.rgdata);s.RadioGain=0|Math.floor(10*r+.5)}s.findPeakSample&&(s.noclipGainChange=0|Math.ceil(20*w(s.PeakSample/32767)*10),0 ResvSize"),8*t.main_data_begin!=a.ResvSize&&($.err.printf("bit reservoir error: \nl3_side.main_data_begin: %d \nResvoir size: %d \nresv drain (post) %d \nresv drain (pre) %d \nheader and sideinfo: %d \ndata bits: %d \ntotal bits: %d (remainder: %d) \nbitsperframe: %d \n",8*t.main_data_begin,a.ResvSize,t.resvDrain_post,t.resvDrain_pre,8*a.sideinfo_len,n-t.resvDrain_post-8*a.sideinfo_len,n,n%8,s),$.err.println("This is a fatal error. It has several possible causes:"),$.err.println("90%% LAME compiled with buggy version of gcc using advanced optimizations"),$.err.println(" 9%% Your system is overclocked"),$.err.println(" 1%% bug in LAME encoding library"),a.ResvSize=8*t.main_data_begin),1e9e.PeakSample?e.PeakSample=o[0][_]:-o[0][_]>e.PeakSample&&(e.PeakSample=-o[0][_]);if(1e.PeakSample?e.PeakSample=o[1][_]:-o[1][_]>e.PeakSample&&(e.PeakSample=-o[1][_])}if(e.findReplayGain&&c.AnalyzeSamples(e.rgdata,o[0],0,o[1],0,f,e.channels_out)==Y.GAIN_ANALYSIS_ERROR)return-6}}return r},this.init_bit_stream_w=function(e){b=B(U.LAME_MAXMP3BUFFER),e.h_ptr=e.w_ptr=0,e.header[e.h_ptr].write_timing=0,p=-1,l=m=0}}function e(e,t,a,s){this.xlen=e,this.linmax=t,this.table=a,this.hlen=s}xe.STEREO=new xe(0),xe.JOINT_STEREO=new xe(1),xe.DUAL_CHANNEL=new xe(2),xe.MONO=new xe(3),xe.NOT_SET=new xe(4),Y.STEPS_per_dB=100,Y.MAX_dB=120,Y.GAIN_NOT_ENOUGH_SAMPLES=-24601,Y.GAIN_ANALYSIS_ERROR=0,Y.GAIN_ANALYSIS_OK=1,Y.INIT_GAIN_ANALYSIS_ERROR=0,Y.INIT_GAIN_ANALYSIS_OK=1,Y.MAX_ORDER=Y.YULE_ORDER=10,Y.MAX_SAMPLES_PER_WINDOW=(Y.MAX_SAMP_FREQ=48e3)*(Y.RMS_WINDOW_TIME_NUMERATOR=1)/(Y.RMS_WINDOW_TIME_DENOMINATOR=20)+1,R.NUMTOCENTRIES=100,R.MAXFRAMESIZE=2880,C.EQ=function(e,t){return Math.abs(e)>Math.abs(t)?Math.abs(e-t)<=1e-6*Math.abs(e):Math.abs(e-t)<=1e-6*Math.abs(t)},C.NEQ=function(e,t){return!C.EQ(e,t)};var F={};function j(e){this.bits=e}function k(){this.over_noise=0,this.tot_noise=0,this.max_noise=0,this.over_count=0,this.over_SSD=0,this.bits=0}function r(e,t,a,s){this.l=Be(1+Pe.SBMAX_l),this.s=Be(1+Pe.SBMAX_s),this.psfb21=Be(1+Pe.PSFB21),this.psfb12=Be(1+Pe.PSFB12);var n=this.l,r=this.s;4==arguments.length&&(this.arrL=e,this.arrS=t,this.arr21=a,this.arr12=s,$.arraycopy(this.arrL,0,n,0,Math.min(this.arrL.length,this.l.length)),$.arraycopy(this.arrS,0,r,0,Math.min(this.arrS.length,this.s.length)),$.arraycopy(this.arr21,0,this.psfb21,0,Math.min(this.arr21.length,this.psfb21.length)),$.arraycopy(this.arr12,0,this.psfb12,0,Math.min(this.arr12.length,this.psfb12.length)))}function y(){var l=null,b=null,s=null;this.setModules=function(e,t,a){l=e,b=t,s=a},this.IPOW20=function(e){return u[e]};var E=2.220446049250313e-16,f=y.IXMAX_VAL+2,c=y.Q_MAX,h=y.Q_MAX2,n=100;this.nr_of_sfb_block=[[[6,5,5,5],[9,9,9,9],[6,9,9,9]],[[6,5,7,3],[9,9,12,6],[6,9,12,6]],[[11,10,0,0],[18,18,0,0],[15,18,0,0]],[[7,7,7,0],[12,12,12,0],[6,15,12,0]],[[6,6,6,3],[12,9,9,6],[6,12,9,6]],[[8,8,5,0],[15,12,9,0],[6,18,9,0]]];var M=[0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,3,3,3,2,0];this.pretab=M,this.sfBandIndex=[new r([0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576],[0,4,8,12,18,24,32,42,56,74,100,132,174,192],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]),new r([0,6,12,18,24,30,36,44,54,66,80,96,114,136,162,194,232,278,332,394,464,540,576],[0,4,8,12,18,26,36,48,62,80,104,136,180,192],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]),new r([0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576],[0,4,8,12,18,26,36,48,62,80,104,134,174,192],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]),new r([0,4,8,12,16,20,24,30,36,44,52,62,74,90,110,134,162,196,238,288,342,418,576],[0,4,8,12,16,22,30,40,52,66,84,106,136,192],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]),new r([0,4,8,12,16,20,24,30,36,42,50,60,72,88,106,128,156,190,230,276,330,384,576],[0,4,8,12,16,22,28,38,50,64,80,100,126,192],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]),new r([0,4,8,12,16,20,24,30,36,44,54,66,82,102,126,156,194,240,296,364,448,550,576],[0,4,8,12,16,22,30,42,58,78,104,138,180,192],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]),new r([0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576],[0,4,8,12,18,26,36,48,62,80,104,134,174,192],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]),new r([0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576],[0,4,8,12,18,26,36,48,62,80,104,134,174,192],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]),new r([0,12,24,36,48,60,72,88,108,132,160,192,232,280,336,400,476,566,568,570,572,574,576],[0,8,16,24,36,52,72,96,124,160,162,164,166,192],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0])];var A=we(c+h+1),u=we(c),p=we(f),m=we(f);function d(e,t){var a=s.ATHformula(t,e);return a-=n,a=Math.pow(10,a/10+e.ATHlower)}function B(e){this.s=e}this.adj43=m,this.iteration_init=function(e){var t,a=e.internal_flags,s=a.l3_side;if(0==a.iteration_init_init){for(a.iteration_init_init=1,s.main_data_begin=0,function(e){for(var t=e.internal_flags.ATH.l,a=e.internal_flags.ATH.psfb21,s=e.internal_flags.ATH.s,n=e.internal_flags.ATH.psfb12,r=e.internal_flags,i=e.out_samplerate,_=0;_>2&63)&&(t-=64),n=Math.pow(10,t/4/10),32<=(t=e.exp_nspsytune>>8&63)&&(t-=64),r=Math.pow(10,t/4/10),32<=(t=e.exp_nspsytune>>14&63)&&(t-=64),i=Math.pow(10,t/4/10),32<=(t=e.exp_nspsytune>>20&63)&&(t-=64),_=i*Math.pow(10,t/4/10),t=0;t3*s/4&&(f[_]=3*s/4),f[_]<0&&(f[_]=0),f[_]+a[_]>G.MAX_BITS_PER_CHANNEL&&(f[_]=Math.max(0,G.MAX_BITS_PER_CHANNEL-a[_])),i+=f[_];if(hG.MAX_BITS_PER_CHANNEL-e[0]&&(r=G.MAX_BITS_PER_CHANNEL-e[0]),r<0&&(r=0),125<=e[1]&&(125>1,B=0;do{B+=T=f[_]*f[_],R+=T>1;S=v/m,R=E;do{var T,k;B+=T=f[_]*f[_],R+=Ts[r-3+1]&&(s[r-3+1]+=(s[r-3]-s[r-3+1])*i.decay),s[r-3+1]>s[r-3+2]&&(s[r-3+2]+=(s[r-3+1]-s[r-3+2])*i.decay))}return o},this.calc_noise_core=function(e,t,a,s){var n=0,r=t.s,i=e.l3_enc;if(r>e.count1)for(;0!=a--;){o=e.xr[r],r++,n+=o*o,o=e.xr[r],r++,n+=o*o}else if(r>e.big_values){var _=we(2);for(_[0]=0,_[1]=s;0!=a--;){o=Math.abs(e.xr[r])-_[i[r]],r++,n+=o*o,o=Math.abs(e.xr[r])-_[i[r]],r++,n+=o*o}}else for(;0!=a--;){var o;o=Math.abs(e.xr[r])-p[i[r]]*s,r++,n+=o*o,o=Math.abs(e.xr[r])-p[i[r]]*s,r++,n+=o*o}return t.s=r,n},this.calc_noise=function(e,t,a,s,n){var r,i,_=0,o=0,l=0,f=0,c=0,h=-20,u=0,b=e.scalefac,p=0;for(r=s.over_SSD=0;r>1,u+e.width[r]>e.max_nonzero_coeff)i=0<(g=e.max_nonzero_coeff-u+1)?g>>1:0;var R=new B(u);v=this.calc_noise_core(e,R,i,S),u=R.s,null!=n&&(n.step[r]=d,n.noise[r]=v),v=a[_++]=v/t[o++],v=ee.FAST_LOG10(Math.max(v,1e-20)),null!=n&&(n.noise_log[r]=v)}if(null!=n&&(n.global_gain=e.global_gain),c+=v,0a.max_noise-.2&&a.tot_noisea.max_noise-.2&&a.tot_noisea.max_noise-.1&&a.tot_noise+a.over_noisea.max_noise-.15&&a.tot_noise+a.over_noise+a.over_noiset.xrpow_max&&(t.xrpow_max=s[f+c]);if(2==i.noise_shaping_amp)return}}}(e,t,a,s,n);var i=_(t);return!i&&(!(i=2==r.mode_gr?M.scale_bitcount(t):M.scale_bitcount_lsf(r,t))||(1e.xrpow_max&&(e.xrpow_max=t[a+i])}e.scalefac[s]=r>>1}e.preflag=0,e.scalefac_scale=1}(t,s),i=!1):t.block_type==Pe.SHORT_TYPE&&0>t.scalefac_scale))n[s]=f,o+=3*l;else{n[s]=0;var c=210+(f<t.xrpow_max&&(t.xrpow_max=a[o+h]);o+=l*(3-r-1)}}var u=R.IPOW20(202);for(o+=t.width[s]*(r+1),h=-t.width[s];h<0;h++)a[o+h]*=u,a[o+h]>t.xrpow_max&&(t.xrpow_max=a[o+h])}}return!1}(r,t,s)||_(t))),i||(i=2==r.mode_gr?M.scale_bitcount(t):M.scale_bitcount_lsf(r,t)),!i))}this.setModules=function(e,t,a,s){d=e,g=t,this.rv=t,R=a,this.qupvt=a,M=s,n.setModules(R,M)},this.ms_convert=function(e,t){for(var a=0;a<576;++a){var s=e.tt[t][0].xr[a],n=e.tt[t][1].xr[a];e.tt[t][0].xr[a]=(s+n)*(.5*ee.SQRT2),e.tt[t][1].xr[a]=(s-n)*(.5*ee.SQRT2)}},this.init_xrpow=function(e,t,a){var s=0,n=0|t.max_nonzero_coeff;if(t.xrpow_max=0,ke.fill(a,n,576,0),1e-20<(s=function(e,t,a,s){for(var n=s=0;n<=a;++n){var r=Math.abs(e.xr[n]);s+=r,t[n]=Math.sqrt(r*Math.sqrt(r)),t[n]>e.xrpow_max&&(e.xrpow_max=t[n])}return s}(t,a,n,s))){var r=0;0!=(2&e.substep_shaping)&&(r=1);for(var i=0;iS&&_.global_gain<=g;)_.global_gain++;if(_.global_gain>g)break;if(0==f.over_count){for(;(_.part2_3_length=M.count_bits(i,s,_,c))>h&&_.global_gain<=g;)_.global_gain++;if(_.global_gain>g)break}if(R.calc_noise(_,a,l,v,c),v.bits=_.part2_3_length,0!=(B(t.block_type!=Pe.SHORT_TYPE?e.quant_comp:e.quant_comp_short,f,v,_,l)?1:0))h=t.part2_3_length,f=v,t.assign(_),m=0,$.arraycopy(s,0,o,0,576);else if(0==i.full_outer_loop){if(++m>d&&0==f.over_count)break;if(3==i.noise_shaping_amp&&b&&30r[f.VBR_max_bitrate]&&(_[p][d]*=r[f.VBR_max_bitrate],_[p][d]/=u),i[p][d]>_[p][d]&&(i[p][d]=_[p][d]);return h},this.bitpressure_strategy=function(e,t,a,s){for(var n=0;nG.MAX_BITS_PER_CHANNEL&&(s[_][o]=G.MAX_BITS_PER_CHANNEL),b+=s[_][o]}if(G.MAX_BITS_PER_GRANULEG.MAX_BITS_PER_CHANNEL&&(s[_][o]=G.MAX_BITS_PER_CHANNEL),l+=s[_][o];if(l>r[0])for(_=0;_=s?(e.ATH.adjust*=.075*s+.925,e.ATH.adjust=s?e.ATH.adjust=s:e.ATH.adjust>1,u=(h=(c=s)<<1)+c,s=h<<1,r=(n=t)+b;R=e[n+0]-e[n+c],S=e[n+0]+e[n+c],w=e[n+h]-e[n+u],A=e[n+h]+e[n+u],e[n+h]=S-A,e[n+0]=S+A,e[n+u]=R-w,e[n+c]=R+w,R=e[r+0]-e[r+c],S=e[r+0]+e[r+c],w=ee.SQRT2*e[r+u],A=ee.SQRT2*e[r+h],e[r+h]=S-A,e[r+0]=S+A,e[r+u]=R-w,e[r+c]=R+w,r+=s,(n+=s)<_;);for(l=k[i+0],o=k[i+1],f=1;fL[u+3-2]?Q/=L[u+3-2]:Q=L[u+3-2]>10*Q?L[u+3-2]/(10*Q):0,D[u+3]=Q}if(e.analysis){var W=D[0];for(u=1;u<12;u++)WV&&(C[u/3]=u%3+1);for(u=1;u<4;u++){(N[u-1]>N[u]?N[u-1]/N[u]:N[u]/N[u-1])<1.7&&(C[u]=0,1==u&&(C[0]=0))}for(0!=C[0]&&0!=S.nsPsy.lastAttacks[c]&&(C[0]=0),3!=S.nsPsy.lastAttacks[c]&&C[0]+C[1]+C[2]+C[3]==0||((X=0)!=C[1]&&0!=C[0]&&(C[1]=0),0!=C[2]&&0!=C[1]&&(C[2]=0),0!=C[3]&&0!=C[2]&&(C[3]=0)),c<2?k[c]=X:0==X&&(k[0]=k[1]=0),o[c]=S.tot_ener[c],he(e,F,j,R,1&c,M,1&c,s,c,t,a),Re(S,F,A,q,Y),Me(S,q,Y,y),d=0;d<3;d++){var J,$;for(de(e,j,B,w,c,d),pe(S,B,w,c,d),m=0;m1.58*e.thm[1].l[t]||e.thm[1].l[t]>1.58*e.thm[0].l[t])){var a=e.mld_l[t]*e.en[3].l[t],s=Math.max(e.thm[2].l[t],Math.min(e.thm[3].l[t],a));a=e.mld_l[t]*e.en[2].l[t];var n=Math.max(e.thm[3].l[t],Math.min(e.thm[2].l[t],a));e.thm[2].l[t]=s,e.thm[3].l[t]=n}for(t=0;t1.58*e.thm[1].s[t][r]||e.thm[1].s[t][r]>1.58*e.thm[0].s[t][r]||(a=e.mld_s[t]*e.en[3].s[t][r],s=Math.max(e.thm[2].s[t][r],Math.min(e.thm[3].s[t][r],a)),a=e.mld_s[t]*e.en[2].s[t][r],n=Math.max(e.thm[3].s[t][r],Math.min(e.thm[2].s[t][r],a)),e.thm[2].s[t][r]=s,e.thm[3].s[t][r]=n)}(S),g=e.msfix,0g&&(s[o]=g),1a[o]&&(s[o]=a[o]),l.masking_lower<1&&(s[o]*=l.masking_lower)}for(;of&&(s[r]=f),1a[r]&&(s[r]=a[r]),e.masking_lower<1&&(s[r]*=e.masking_lower)}for(;rR[m+3-2]?x/=R[m+3-2]:x=R[m+3-2]>10*x?R[m+3-2]/(10*x):0,S[m+3]=x}for(m=0;m<3;++m){var P=R[3*m+3]+R[3*m+4]+R[3*m+5],I=1;6*R[3*m+5]w&&(o[b][m/3]=m%3+1);for(m=1;m<4;m++){var O=M[m-1],V=M[m];Math.max(O,V)<4e4&&O<1.7*V&&V<1.7*O&&(1==m&&o[b][0]<=o[b][m]&&(o[b][0]=0),o[b][m]=0)}o[b][0]<=c.nsPsy.lastAttacks[b]&&(o[b][0]=0),3!=c.nsPsy.lastAttacks[b]&&o[b][0]+o[b][1]+o[b][2]+o[b][3]==0||((T=0)!=o[b][1]&&0!=o[b][0]&&(o[b][1]=0),0!=o[b][2]&&0!=o[b][1]&&(o[b][2]=0),0!=o[b][3]&&0!=o[b][2]&&(o[b][3]=0)),b<2?l[b]=T:0==T&&(l[0]=l[1]=0),i[b]=c.tot_ener[b]}}(e,t,a,s,n,r,o,M,A,B),function(e,t){var a=e.internal_flags;e.short_blocks!=Ee.short_block_coupled||0!=t[0]&&0!=t[1]||(t[0]=t[1]=0);for(var s=0;s=n&&(p=i*(l[t]-n)/(24-n)+r*(24-l[t])/(24-n)),c[t]=Math.pow(10,p/10),0=n&&(p=o*(l[t]-n)/(24-n)+_*(24-l[t])/(24-n)),c[t]=Math.pow(10,p/10),g=K.MAX_VALUE;for(d=0;da.npart_l-1&&(a.s3ind[R][1]=a.npart_l-1);var M=576*a.mode_gr/h;if(a.ATH.decay=Math.pow(10,-1.2*M),a.ATH.adjust=.01,-(a.ATH.adjustLimit=1)!=e.ATHtype){var A=e.out_samplerate/Pe.BLKSIZE,B=0;for(t=v=0;t=d)for(l=0;le.in_samplerate&&(e.lowpassfreq=e.in_samplerate/2),e.out_samplerate=(t=0|e.lowpassfreq,a=e.in_samplerate,s=44100,48e3<=a?s=48e3:44100<=a?s=44100:32e3<=a?s=32e3:24e3<=a?s=24e3:22050<=a?s=22050:16e3<=a?s=16e3:12e3<=a?s=12e3:11025<=a?s=11025:8e3<=a&&(s=8e3),-1==t?s:(t<=15960&&(s=44100),t<=15250&&(s=32e3),t<=11220&&(s=24e3),t<=9970&&(s=22050),t<=7230&&(s=16e3),t<=5420&&(s=12e3),t<=4510&&(s=11025),t<=3970&&(s=8e3),a=t.lowpass2&&(a=Math.min(a,r)),t.lowpass1t.highpass1?x((t.highpass2-l)/(t.highpass2-t.highpass1+1e-20)):1,o=t.lowpass2>t.lowpass1?x((l-t.lowpass1)/(t.lowpass2-t.lowpass1+1e-20)):1,t.amp_filter[r]=_*o}}(e),n.samplerate_index=P(e.out_samplerate,e),n.samplerate_index<0)return e.internal_flags=null,-1;if(e.VBR==ye.vbr_off){if(e.free_format)n.bitrate_index=0;else if(e.brate=I(e.brate,e.version,e.out_samplerate),n.bitrate_index=H(e.brate,e.version,e.out_samplerate),n.bitrate_index<=0)return e.internal_flags=null,-1}else n.bitrate_index=1;e.analysis&&(e.bWriteVbrTag=!1),null!=n.pinfo&&(e.bWriteVbrTag=!1),A.init_bit_stream_w(n);for(var c,h,u,b=n.samplerate_index+3*e.version+6*(e.out_samplerate<16e3?1:0),p=0;p=f){var R=i-u;if(0==i&&(R=0),(_=L(e,b[0],b[1],n,r,R))<0)return _;for(r+=_,u+=_,h.mf_size-=e.framesize,h.mf_samples_to_encode-=e.framesize,l=0;li&&(s.ResvMax=i),(s.ResvMax<0||e.disable_reservoir)&&(s.ResvMax=0);var _=t.bits*s.mode_gr+Math.min(s.ResvSize,s.ResvMax);return a<_&&(_=a),n.resvDrain_pre=0,null!=s.pinfo&&(s.pinfo.mean_bits=t.bits/2,s.pinfo.resvsize=s.ResvSize),_},this.ResvMaxBits=function(e,t,a,s){var n,r=e.internal_flags,i=r.ResvSize,_=r.ResvMax;0!=s&&(i+=t),0!=(1&r.substep_shaping)&&(_*=.9),a.bits=t,9*_<10*i?(n=i-9*_/10,a.bits+=n,r.substep_shaping|=128):(n=0,r.substep_shaping&=127,e.disable_reservoir||0!=(1&r.substep_shaping)||(a.bits-=.1*t));var o=i<6*r.ResvMax/10?i:6*r.ResvMax/10;return(o-=n)<0&&(o=0),o},this.ResvAdjust=function(e,t){e.ResvSize-=t.part2_3_length+t.part2_length},this.ResvFrameEnd=function(e,t){var a,s=e.l3_side;e.ResvSize+=t*e.mode_gr;var n=0;s.resvDrain_post=0,(s.resvDrain_pre=0)!=(a=e.ResvSize%8)&&(n+=a),0<(a=e.ResvSize-n-e.ResvMax)&&(n+=a);var r=Math.min(8*s.main_data_begin,n)/8;s.resvDrain_pre+=8*r,n-=8*r,e.ResvSize-=8*r,s.main_data_begin-=r,s.resvDrain_post+=n,e.ResvSize-=n}},b=new T,p=new function(){this.setModules=function(e,t,a){}},m=new function(){};n.setModules(r,i,_,o,l,f,c,h,m),i.setModules(r,m,c,f),h.setModules(i,c),_.setModules(n),l.setModules(i,u,o,b),o.setModules(b,u,n.enc.psy),u.setModules(i),b.setModules(o),f.setModules(n,i,c),a.setModules(p,m),p.setModules(c,h,_);var d=n.lame_init();d.num_channels=s,d.in_samplerate=e,d.out_samplerate=e,d.brate=t,d.mode=xe.STEREO,d.quality=3,d.bWriteVbrTag=!1,d.disable_reservoir=!0,d.write_id3tag_automatic=!1,n.lame_init_params(d);var v=1152,g=0|1.25*v+7200,S=B(g);this.encodeBuffer=function(e,t){1==s&&(t=e),e.length>v&&(v=e.length,S=B(g=0|1.25*v+7200));var a=n.lame_encode_buffer(d,e,t,e.length,S,0,g);return new Int8Array(S.subarray(0,a))},this.flush=function(){var e=n.lame_encode_flush(d,S,0,g);return new Int8Array(S.subarray(0,e))}},a.WavHeader=_}a(),Recorder.lamejs=a}(); \ No newline at end of file +!function(f){"use strict";b.LM="2019-9-9 21:09:34";var c=function(){};function b(e){return new t(e)}function t(e){var t={type:"mp3",bitRate:16,sampleRate:16e3,bufferSize:4096,onProcess:c};for(var a in e)t[a]=e[a];this.set=t,this._S=9}b.IsOpen=function(){var e=b.Stream;if(e){var t=e.getTracks();if(0"+u.length+" 花:"+(Date.now()-s)+"ms"),setTimeout(function(){s=Date.now(),n[r.type](u,function(e){o(e,c)},function(e){_(e)})})}else _("未加载"+r.type+"编码器");else _("未采集到录音")}},f.Recorder=b}(window),function(){"use strict";Recorder.prototype.enc_mp3={stable:!0,testmsg:"采样率范围48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000"},Recorder.prototype.mp3=function(t,a,e){var s=this.set,n=t.length,r=this.mp3_start(s);if(r)return this.mp3_encode(r,t),void this.mp3_complete(r,a,e,1);var i=new Recorder.lamejs.Mp3Encoder(1,s.sampleRate,s.bitRate),_=[],o=0,l=function(){var e;o>=1;0!=e--;)n[r++]=i>a[s++]?0:1,n[r++]=i>a[s++]?0:1}function A(e,t,a,s,n,r){var i=(e>>=1)%2;for(e>>=1;0!=e--;){var _,o,l,f,c,h,u,b;_=a[s++]*t,o=a[s++]*t,c=0|_,l=a[s++]*t,h=0|o,f=a[s++]*t,u=0|l,_+=R.adj43[c],b=0|f,o+=R.adj43[h],n[r++]=0|_,l+=R.adj43[u],n[r++]=0|o,f+=R.adj43[b],n[r++]=0|l,n[r++]=0|f}0!=i&&(c=0|(_=a[s++]*t),h=0|(o=a[s++]*t),_+=R.adj43[c],o+=R.adj43[h],n[r++]=0|_,n[r++]=0|o)}var _=[1,2,5,7,7,10,10,13,13,13,13,13,13,13,13];function v(e,t,a,s){var n=function(e,t,a){var s=0,n=0;do{var r=e[t++],i=e[t++];s>=16)&&(_=r,s++),n.bits+=_,s}(e,t,a,_[n-1],s);case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:return function(e,t,a,s,n){var r=0,i=0,_=0,o=F.ht[s].xlen,l=F.ht[s].hlen,f=F.ht[s+1].hlen,c=F.ht[s+2].hlen;do{var h=e[t+0]*o+e[t+1];t+=2,r+=l[h],i+=f[h],_+=c[h]}while(t=n);r++);for(i=r-8;i<24&&!(F.ht[i].linmax>=n);i++);return function(e,t,a,s,n,r){var i,_=65536*F.ht[s].xlen+F.ht[n].xlen,o=0;do{var l=e[t++],f=e[t++];0!=l&&(14>=16)&&(o=i,s=n),r.bits+=o,s}(e,t,a,i,r,s)}}function u(e,t,a,s,n,r,i,_){for(var o=t.big_values,l=2;l>1<<1);for(null!=a&&(a.sfb_count1=0);1t.big_values&&(r=t.big_values),i=t.big_values;else if(t.block_type==Pe.NORM_TYPE){if(r=t.region0_count=e.bv_scf[n-2],i=t.region1_count=e.bv_scf[n-1],i=e.scalefac_band.l[r+i+2],r=e.scalefac_band.l[r+1],ir)return y.LARGE_BITS;if(function(e,t,a,s,n){var r,i,_,o=0,l=0,f=0,c=0,h=t,u=0,b=h,p=0,m=e,d=0;for(_=null!=n&&s.global_gain==n.global_gain,i=s.block_type==Pe.SHORT_TYPE?38:21,r=0;r<=i;r++){var v=-1;if((_||s.block_type==Pe.NORM_TYPE)&&(v=s.global_gain-(s.scalefac[r]+(0!=s.preflag?R.pretab[r]:0)<s.max_nonzero_coeff&&(g=s.max_nonzero_coeff-o+1,ke.fill(t,s.max_nonzero_coeff,576,0),(S=g)<0&&(S=0),r=i+1),0==l&&0==f&&(b=h,p=u,m=e,d=c),null!=n&&0=n.sfb_count1&&0=n.step[r]?(0!=l&&(A(l,a,m,d,b,p),l=0,b=h,p=u,m=e,d=c),f+=S):(0!=f&&(M(f,a,m,d,b,p),f=0,b=h,p=u,m=e,d=c),l+=S),S<=0){0!=f&&(M(f,a,m,d,b,p),f=0),0!=l&&(A(l,a,m,d,b,p),l=0);break}}r<=i&&(u+=s.width[r],c+=s.width[r],o+=s.width[r])}0!=l&&(A(l,a,m,d,b,p),l=0),0!=f&&(M(f,a,m,d,b,p),f=0)}(t,n,R.IPOW20(a.global_gain),a,s),0!=(2&e.substep_shaping))for(var i=0,_=a.global_gain+a.scalefac_scale,o=.634521682242439/R.IPOW20(_),l=0;l=o?n[f]:0}return this.noquant_count_bits(e,a,s)},this.best_huffman_divide=function(e,t){var a=new E,s=t.l3_enc,n=Be(23),r=Be(23),i=Be(23),_=Be(23);if(t.block_type!=Pe.SHORT_TYPE||1!=e.mode_gr){a.assign(t),t.block_type==Pe.NORM_TYPE&&(!function(e,t,a,s,n,r,i){for(var _=t.big_values,o=0;o<=22;o++)s[o]=y.LARGE_BITS;for(o=0;o<16;o++){var l=e.scalefac_band.l[o+1];if(_<=l)break;var f=0,c=new d(f),h=v(a,0,l,c);f=c.bits;for(var u=0;u<8;u++){var b=e.scalefac_band.l[o+u+2];if(_<=b)break;var p=f,m=v(a,l,b,c=new d(p));p=c.bits,s[o+u]>p&&(s[o+u]=p,r[(n[o+u]=o)+u]=h,i[o+u]=m)}}}(e,t,s,n,r,i,_),u(e,a,t,s,n,r,i,_));var o=a.big_values;if(!(0==o||1<(s[o-2]|s[o-1])||576<(o=t.count1+2))){a.assign(t),a.count1=o;for(var l=0,f=0;o>a.big_values;o-=4){var c=2*(2*(2*s[o-4]+s[o-3])+s[o-2])+s[o-1];l+=F.t32l[c],f+=F.t33l[c]}if(a.big_values=o,a.count1table_select=0,fa.part2_3_length&&t.assign(a)}}}};var h=[1,1,1,1,8,2,2,2,4,4,4,8,8,8,16,16],b=[1,2,4,8,1,2,4,8,2,4,8,2,4,8,4,8],p=[0,0,0,0,3,1,1,1,2,2,2,3,3,3,4,4],m=[0,1,2,3,0,1,2,3,1,2,3,1,2,3,2,3];T.slen1_tab=p,T.slen2_tab=m,this.best_scalefac_store=function(e,t,a,s){var n,r,i,_,o=s.tt[t][a],l=0;for(n=i=0;n>=1);o.scalefac_scale=l=1}}if(0==o.preflag&&o.block_type!=Pe.SHORT_TYPE&&2==e.mode_gr){for(n=11;nf&&(s.part2_length=f,s.scalefac_compress=r)}}(a,s),l=0),n=0;ns[t]&&(e.part2_length=s[t],e.scalefac_compress=t);return e.part2_length==y.LARGE_BITS};var g=[[15,15,7,7],[15,15,7,0],[7,3,0,0],[15,31,31,0],[7,7,7,0],[3,3,0,0]];this.scale_bitcount_lsf=function(e,t){var a,s,n,r,i,_,o,l,f=Be(4),c=t.scalefac;for(a=0!=t.preflag?2:0,o=0;o<4;o++)f[o]=0;if(t.block_type==Pe.SHORT_TYPE){s=1;var h=R.nr_of_sfb_block[a][s];for(n=l=0;n<4;n++)for(r=h[n]/3,o=0;of[n]&&(f[n]=c[3*l+i])}else{s=0;h=R.nr_of_sfb_block[a][s];for(n=l=0;n<4;n++)for(r=h[n],o=0;of[n]&&(f[n]=c[l])}for(_=!1,n=0;n<4;n++)f[n]>g[a][n]&&(_=!0);if(!_){var u,b,p,m;for(t.sfb_partition_table=R.nr_of_sfb_block[a][s],n=0;n<4;n++)t.slen[n]=S[f[n]];switch(u=t.slen[0],b=t.slen[1],p=t.slen[2],m=t.slen[3],a){case 0:t.scalefac_compress=(5*u+b<<4)+(p<<2)+m;break;case 1:t.scalefac_compress=400+(5*u+b<<2)+p;break;case 2:t.scalefac_compress=500+3*u+b;break;default:$.err.printf("intensity stereo not implemented yet\n")}}if(!_)for(n=t.part2_length=0;n<4;n++)t.part2_length+=t.slen[n]*t.sfb_partition_table[n];return _};var S=[0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4];this.huffman_init=function(e){for(var t=2;t<=576;t+=2){for(var a,s=0;e.scalefac_band.l[++s]t;)a--;for(a<0&&(a=n[s][0]),e.bv_scf[t-2]=a,a=n[s][1];e.scalefac_band.l[a+e.bv_scf[t-2]+2]>t;)a--;a<0&&(a=n[s][1]),e.bv_scf[t-1]=a}}}function Y(){var r=64.82,i=.95,s=Y.RMS_WINDOW_TIME_NUMERATOR,n=Y.RMS_WINDOW_TIME_DENOMINATOR,d=[[.038575994352,-3.84664617118067,-.02160367184185,7.81501653005538,-.00123395316851,-11.34170355132042,-9291677959e-14,13.05504219327545,-.01655260341619,-12.28759895145294,.02161526843274,9.4829380631979,-.02074045215285,-5.87257861775999,.00594298065125,2.75465861874613,.00306428023191,-.86984376593551,.00012025322027,.13919314567432,.00288463683916],[.0541865640643,-3.47845948550071,-.02911007808948,6.36317777566148,-.00848709379851,-8.54751527471874,-.00851165645469,9.4769360780128,-.00834990904936,-8.81498681370155,.02245293253339,6.85401540936998,-.02596338512915,-4.39470996079559,.01624864962975,2.19611684890774,-.00240879051584,-.75104302451432,.00674613682247,.13149317958808,-.00187763777362],[.15457299681924,-2.37898834973084,-.09331049056315,2.84868151156327,-.06247880153653,-2.64577170229825,.02163541888798,2.23697657451713,-.05588393329856,-1.67148153367602,.04781476674921,1.00595954808547,.00222312597743,-.45953458054983,.03174092540049,.16378164858596,-.01390589421898,-.05032077717131,.00651420667831,.0234789740702,-.00881362733839],[.30296907319327,-1.61273165137247,-.22613988682123,1.0797749225997,-.08587323730772,-.2565625775407,.03282930172664,-.1627671912044,-.00915702933434,-.22638893773906,-.02364141202522,.39120800788284,-.00584456039913,-.22138138954925,.06276101321749,.04500235387352,-828086748e-14,.02005851806501,.00205861885564,.00302439095741,-.02950134983287],[.33642304856132,-1.49858979367799,-.2557224142557,.87350271418188,-.11828570177555,.12205022308084,.11921148675203,-.80774944671438,-.07834489609479,.47854794562326,-.0046997791438,-.12453458140019,-.0058950022444,-.04067510197014,.05724228140351,.08333755284107,.00832043980773,-.04237348025746,-.0163538138454,.02977207319925,-.0176017656815],[.4491525660845,-.62820619233671,-.14351757464547,.29661783706366,-.22784394429749,-.372563729424,-.01419140100551,.00213767857124,.04078262797139,-.42029820170918,-.12398163381748,.22199650564824,.04097565135648,.00613424350682,.10478503600251,.06747620744683,-.01863887810927,.05784820375801,-.03193428438915,.03222754072173,.00541907748707],[.56619470757641,-1.04800335126349,-.75464456939302,.29156311971249,.1624213774223,-.26806001042947,.16744243493672,.00819999645858,-.18901604199609,.45054734505008,.3093178284183,-.33032403314006,-.27562961986224,.0673936833311,.00647310677246,-.04784254229033,.08647503780351,.01639907836189,-.0378898455484,.01807364323573,-.00588215443421],[.58100494960553,-.51035327095184,-.53174909058578,-.31863563325245,-.14289799034253,-.20256413484477,.17520704835522,.1472815413433,.02377945217615,.38952639978999,.15558449135573,-.23313271880868,-.25344790059353,-.05246019024463,.01628462406333,-.02505961724053,.06920467763959,.02442357316099,-.03721611395801,.01818801111503,-.00749618797172],[.53648789255105,-.2504987195602,-.42163034350696,-.43193942311114,-.00275953611929,-.03424681017675,.04267842219415,-.04678328784242,-.10214864179676,.26408300200955,.14590772289388,.15113130533216,-.02459864859345,-.17556493366449,-.11202315195388,-.18823009262115,-.04060034127,.05477720428674,.0478866554818,.0470440968812,-.02217936801134]],v=[[.98621192462708,-1.97223372919527,-1.97242384925416,.97261396931306,.98621192462708],[.98500175787242,-1.96977855582618,-1.97000351574484,.9702284756635,.98500175787242],[.97938932735214,-1.95835380975398,-1.95877865470428,.95920349965459,.97938932735214],[.97531843204928,-1.95002759149878,-1.95063686409857,.95124613669835,.97531843204928],[.97316523498161,-1.94561023566527,-1.94633046996323,.94705070426118,.97316523498161],[.96454515552826,-1.92783286977036,-1.92909031105652,.93034775234268,.96454515552826],[.96009142950541,-1.91858953033784,-1.92018285901082,.92177618768381,.96009142950541],[.95856916599601,-1.9154210807478,-1.91713833199203,.91885558323625,.95856916599601],[.94597685600279,-1.88903307939452,-1.89195371200558,.89487434461664,.94597685600279]];function g(e,t,a,s,n,r){for(;0!=n--;)a[s]=1e-10+e[t+0]*r[0]-a[s-1]*r[1]+e[t-1]*r[2]-a[s-2]*r[3]+e[t-2]*r[4]-a[s-3]*r[5]+e[t-3]*r[6]-a[s-4]*r[7]+e[t-4]*r[8]-a[s-5]*r[9]+e[t-5]*r[10]-a[s-6]*r[11]+e[t-6]*r[12]-a[s-7]*r[13]+e[t-7]*r[14]-a[s-8]*r[15]+e[t-8]*r[16]-a[s-9]*r[17]+e[t-9]*r[18]-a[s-10]*r[19]+e[t-10]*r[20],++s,++t}function S(e,t,a,s,n,r){for(;0!=n--;)a[s]=e[t+0]*r[0]-a[s-1]*r[1]+e[t-1]*r[2]-a[s-2]*r[3]+e[t-2]*r[4],++s,++t}function R(e){return e*e}this.InitGainAnalysis=function(e,t){return function(e,t){for(var a=0;ae.sampleWindow-e.totsamp?e.sampleWindow-e.totsamp:c,uMAX_ORDER-u&&(h=MAX_ORDER-u)):(_=a+u,o=t,l=n+u,f=s),g(o,_,e.lstepbuf,e.lstep+e.totsamp,h,d[e.reqindex]),g(f,l,e.rstepbuf,e.rstep+e.totsamp,h,d[e.reqindex]),S(e.lstepbuf,e.lstep+e.totsamp,e.loutbuf,e.lout+e.totsamp,h,v[e.reqindex]),S(e.rstepbuf,e.rstep+e.totsamp,e.routbuf,e.rout+e.totsamp,h,v[e.reqindex]),_=e.lout+e.totsamp,o=e.loutbuf,l=e.rout+e.totsamp,f=e.routbuf;for(var b=h%8;0!=b--;)e.lsum+=R(o[_++]),e.rsum+=R(f[l++]);for(b=h/8;0!=b--;)e.lsum+=R(o[_+0])+R(o[_+1])+R(o[_+2])+R(o[_+3])+R(o[_+4])+R(o[_+5])+R(o[_+6])+R(o[_+7]),_+=8,e.rsum+=R(f[l+0])+R(f[l+1])+R(f[l+2])+R(f[l+3])+R(f[l+4])+R(f[l+5])+R(f[l+6])+R(f[l+7]),l+=8;if(c-=h,u+=h,e.totsamp+=h,e.totsamp==e.sampleWindow){var p=10*Y.STEPS_per_dB*w((e.lsum+e.rsum)/e.totsamp*.5+1e-37),m=p<=0?0:0|p;m>=e.A.length&&(m=e.A.length-1),e.A[m]++,e.lsum=e.rsum=0,$.arraycopy(e.loutbuf,e.totsamp,e.loutbuf,0,MAX_ORDER),$.arraycopy(e.routbuf,e.totsamp,e.routbuf,0,MAX_ORDER),$.arraycopy(e.lstepbuf,e.totsamp,e.lstepbuf,0,MAX_ORDER),$.arraycopy(e.rstepbuf,e.totsamp,e.rstepbuf,0,MAX_ORDER),e.totsamp=0}if(e.totsamp>e.sampleWindow)return GAIN_ANALYSIS_ERROR}return r>24,e[t+1]=255&a>>16,e[t+2]=255&a>>8,e[t+3]=255&a}function V(e,t,a){e[t+0]=255&a>>8,e[t+1]=255&a}function _(e,t,a){return 255&(e<>8^a[255&(t^e)]}this.addVbrFrame=function(e){var t=e.internal_flags,a=F.bitrate_table[e.version][t.bitrate_index];!function(e,t){if(e.nVbrNumFrames++,e.sum+=t,e.seen++,!(e.seen>3&1,i=e[a+2]>>2&3,_=e[a+3]>>6&3,o=e[a+2]>>4&15;if(o=F.bitrate_table[r][o],e[a+1]>>4==14?t.samprate=F.samplerate_table[2][i]:t.samprate=F.samplerate_table[r][i],s=e,n=a+=0!=r?3!=_?36:21:3!=_?21:13,!new String(s,n,m.length(),p).equals(m)&&!new String(s,n,d.length(),p).equals(d))return null;a+=4,t.hId=r;var l=t.flags=v(e,a);if(a+=4,0!=(1&l)&&(t.frames=v(e,a),a+=4),0!=(2&l)&&(t.bytes=v(e,a),a+=4),0!=(4&l)){if(null!=t.toc)for(var f=0;f>4;var h=(15&e[a+1])<<8;return(c<0||3e3e.pos-1&&(n=e.pos-1);var r=0|256*e.bag[n]/e.sum;255e.scale_right||e.disable_reservoir&&e.brate<320||e.noATH||e.ATHonly||0==x||e.in_samplerate<=32e3)&&(M=1),i=S+(R<<2)+(M<<5)+(A<<6),_=f.nMusicCRC,O(a,s+c,b),c+=4;for(var P=0;P<9;P++)a[s+c+P]=255&p.charAt(P);a[s+(c+=9)]=255&r,a[s+ ++c]=255&d,O(a,s+ ++c,v),V(a,s+(c+=4),g),V(a,s+(c+=2),0),a[s+(c+=2)]=255&o,a[s+ ++c]=255<=l?255:255&l,a[s+ ++c]=255&h>>4,a[s+c+1]=255&(h<<4)+(u>>8),a[s+c+2]=255&u,a[s+(c+=3)]=255&i,c++,a[s+c++]=0,V(a,s+c,e.preset),O(a,s+(c+=2),t),V(a,s+(c+=4),_),c+=2;for(var I=0;Is.length?-1:(n<1||t.write(s,0,n),0)}}function C(){var o=this,s=32773,c=null,h=null,r=null,u=null;this.setModules=function(e,t,a,s){c=e,h=t,r=a,u=s};var b=null,l=0,p=0,m=0;function d(e,t,a){for(;0>a<>a<>3]|=t>>a<<8-(7&s)-n,s+=n}e.header[e.h_ptr].ptr=s}function n(e,t){e<<=8;for(var a=0;a<8;a++)0!=(65536&((t<<=1)^(e<<=1)))&&(t^=s);return t}function v(e,t){var a,s=F.ht[t.count1table_select+32],n=0,r=t.big_values,i=t.big_values;for(a=(t.count1-t.big_values)/4;0t.big_values&&(a=t.big_values);var s=g(e,t.table_select[0],0,a,t);return s+=g(e,t.table_select[1],a,t.big_values,t)}function R(e,t){var a,s,n,r;a=t.big_values;var i=t.region0_count+1;return n=e.scalefac_band.l[i],i+=t.region1_count+1,a>8),t[5]=byte(255&a)},this.flush_bitstream=function(e){var t,a,s=e.internal_flags,n=s.h_ptr-1;if(-1==n&&(n=G.MAX_HEADER_BUF-1),t=s.l3_side,!((a=A(e,new M))<0)){if(_(e,a),s.ResvSize=0,t.main_data_begin=0,s.findReplayGain){var r=c.GetTitleGain(s.rgdata);s.RadioGain=0|Math.floor(10*r+.5)}s.findPeakSample&&(s.noclipGainChange=0|Math.ceil(20*w(s.PeakSample/32767)*10),0 ResvSize"),8*t.main_data_begin!=a.ResvSize&&($.err.printf("bit reservoir error: \nl3_side.main_data_begin: %d \nResvoir size: %d \nresv drain (post) %d \nresv drain (pre) %d \nheader and sideinfo: %d \ndata bits: %d \ntotal bits: %d (remainder: %d) \nbitsperframe: %d \n",8*t.main_data_begin,a.ResvSize,t.resvDrain_post,t.resvDrain_pre,8*a.sideinfo_len,n-t.resvDrain_post-8*a.sideinfo_len,n,n%8,s),$.err.println("This is a fatal error. It has several possible causes:"),$.err.println("90%% LAME compiled with buggy version of gcc using advanced optimizations"),$.err.println(" 9%% Your system is overclocked"),$.err.println(" 1%% bug in LAME encoding library"),a.ResvSize=8*t.main_data_begin),1e9e.PeakSample?e.PeakSample=o[0][_]:-o[0][_]>e.PeakSample&&(e.PeakSample=-o[0][_]);if(1e.PeakSample?e.PeakSample=o[1][_]:-o[1][_]>e.PeakSample&&(e.PeakSample=-o[1][_])}if(e.findReplayGain&&c.AnalyzeSamples(e.rgdata,o[0],0,o[1],0,f,e.channels_out)==Y.GAIN_ANALYSIS_ERROR)return-6}}return r},this.init_bit_stream_w=function(e){b=B(U.LAME_MAXMP3BUFFER),e.h_ptr=e.w_ptr=0,e.header[e.h_ptr].write_timing=0,p=-1,l=m=0}}function e(e,t,a,s){this.xlen=e,this.linmax=t,this.table=a,this.hlen=s}xe.STEREO=new xe(0),xe.JOINT_STEREO=new xe(1),xe.DUAL_CHANNEL=new xe(2),xe.MONO=new xe(3),xe.NOT_SET=new xe(4),Y.STEPS_per_dB=100,Y.MAX_dB=120,Y.GAIN_NOT_ENOUGH_SAMPLES=-24601,Y.GAIN_ANALYSIS_ERROR=0,Y.GAIN_ANALYSIS_OK=1,Y.INIT_GAIN_ANALYSIS_ERROR=0,Y.INIT_GAIN_ANALYSIS_OK=1,Y.MAX_ORDER=Y.YULE_ORDER=10,Y.MAX_SAMPLES_PER_WINDOW=(Y.MAX_SAMP_FREQ=48e3)*(Y.RMS_WINDOW_TIME_NUMERATOR=1)/(Y.RMS_WINDOW_TIME_DENOMINATOR=20)+1,R.NUMTOCENTRIES=100,R.MAXFRAMESIZE=2880,C.EQ=function(e,t){return Math.abs(e)>Math.abs(t)?Math.abs(e-t)<=1e-6*Math.abs(e):Math.abs(e-t)<=1e-6*Math.abs(t)},C.NEQ=function(e,t){return!C.EQ(e,t)};var F={};function j(e){this.bits=e}function k(){this.over_noise=0,this.tot_noise=0,this.max_noise=0,this.over_count=0,this.over_SSD=0,this.bits=0}function r(e,t,a,s){this.l=Be(1+Pe.SBMAX_l),this.s=Be(1+Pe.SBMAX_s),this.psfb21=Be(1+Pe.PSFB21),this.psfb12=Be(1+Pe.PSFB12);var n=this.l,r=this.s;4==arguments.length&&(this.arrL=e,this.arrS=t,this.arr21=a,this.arr12=s,$.arraycopy(this.arrL,0,n,0,Math.min(this.arrL.length,this.l.length)),$.arraycopy(this.arrS,0,r,0,Math.min(this.arrS.length,this.s.length)),$.arraycopy(this.arr21,0,this.psfb21,0,Math.min(this.arr21.length,this.psfb21.length)),$.arraycopy(this.arr12,0,this.psfb12,0,Math.min(this.arr12.length,this.psfb12.length)))}function y(){var l=null,b=null,s=null;this.setModules=function(e,t,a){l=e,b=t,s=a},this.IPOW20=function(e){return u[e]};var E=2.220446049250313e-16,f=y.IXMAX_VAL+2,c=y.Q_MAX,h=y.Q_MAX2,n=100;this.nr_of_sfb_block=[[[6,5,5,5],[9,9,9,9],[6,9,9,9]],[[6,5,7,3],[9,9,12,6],[6,9,12,6]],[[11,10,0,0],[18,18,0,0],[15,18,0,0]],[[7,7,7,0],[12,12,12,0],[6,15,12,0]],[[6,6,6,3],[12,9,9,6],[6,12,9,6]],[[8,8,5,0],[15,12,9,0],[6,18,9,0]]];var M=[0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,3,3,3,2,0];this.pretab=M,this.sfBandIndex=[new r([0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576],[0,4,8,12,18,24,32,42,56,74,100,132,174,192],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]),new r([0,6,12,18,24,30,36,44,54,66,80,96,114,136,162,194,232,278,332,394,464,540,576],[0,4,8,12,18,26,36,48,62,80,104,136,180,192],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]),new r([0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576],[0,4,8,12,18,26,36,48,62,80,104,134,174,192],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]),new r([0,4,8,12,16,20,24,30,36,44,52,62,74,90,110,134,162,196,238,288,342,418,576],[0,4,8,12,16,22,30,40,52,66,84,106,136,192],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]),new r([0,4,8,12,16,20,24,30,36,42,50,60,72,88,106,128,156,190,230,276,330,384,576],[0,4,8,12,16,22,28,38,50,64,80,100,126,192],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]),new r([0,4,8,12,16,20,24,30,36,44,54,66,82,102,126,156,194,240,296,364,448,550,576],[0,4,8,12,16,22,30,42,58,78,104,138,180,192],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]),new r([0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576],[0,4,8,12,18,26,36,48,62,80,104,134,174,192],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]),new r([0,6,12,18,24,30,36,44,54,66,80,96,116,140,168,200,238,284,336,396,464,522,576],[0,4,8,12,18,26,36,48,62,80,104,134,174,192],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]),new r([0,12,24,36,48,60,72,88,108,132,160,192,232,280,336,400,476,566,568,570,572,574,576],[0,8,16,24,36,52,72,96,124,160,162,164,166,192],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0])];var A=we(c+h+1),u=we(c),p=we(f),m=we(f);function d(e,t){var a=s.ATHformula(t,e);return a-=n,a=Math.pow(10,a/10+e.ATHlower)}function B(e){this.s=e}this.adj43=m,this.iteration_init=function(e){var t,a=e.internal_flags,s=a.l3_side;if(0==a.iteration_init_init){for(a.iteration_init_init=1,s.main_data_begin=0,function(e){for(var t=e.internal_flags.ATH.l,a=e.internal_flags.ATH.psfb21,s=e.internal_flags.ATH.s,n=e.internal_flags.ATH.psfb12,r=e.internal_flags,i=e.out_samplerate,_=0;_>2&63)&&(t-=64),n=Math.pow(10,t/4/10),32<=(t=e.exp_nspsytune>>8&63)&&(t-=64),r=Math.pow(10,t/4/10),32<=(t=e.exp_nspsytune>>14&63)&&(t-=64),i=Math.pow(10,t/4/10),32<=(t=e.exp_nspsytune>>20&63)&&(t-=64),_=i*Math.pow(10,t/4/10),t=0;t3*s/4&&(f[_]=3*s/4),f[_]<0&&(f[_]=0),f[_]+a[_]>G.MAX_BITS_PER_CHANNEL&&(f[_]=Math.max(0,G.MAX_BITS_PER_CHANNEL-a[_])),i+=f[_];if(hG.MAX_BITS_PER_CHANNEL-e[0]&&(r=G.MAX_BITS_PER_CHANNEL-e[0]),r<0&&(r=0),125<=e[1]&&(125>1,B=0;do{B+=T=f[_]*f[_],R+=T>1;S=v/m,R=E;do{var T,k;B+=T=f[_]*f[_],R+=Ts[r-3+1]&&(s[r-3+1]+=(s[r-3]-s[r-3+1])*i.decay),s[r-3+1]>s[r-3+2]&&(s[r-3+2]+=(s[r-3+1]-s[r-3+2])*i.decay))}return o},this.calc_noise_core=function(e,t,a,s){var n=0,r=t.s,i=e.l3_enc;if(r>e.count1)for(;0!=a--;){o=e.xr[r],r++,n+=o*o,o=e.xr[r],r++,n+=o*o}else if(r>e.big_values){var _=we(2);for(_[0]=0,_[1]=s;0!=a--;){o=Math.abs(e.xr[r])-_[i[r]],r++,n+=o*o,o=Math.abs(e.xr[r])-_[i[r]],r++,n+=o*o}}else for(;0!=a--;){var o;o=Math.abs(e.xr[r])-p[i[r]]*s,r++,n+=o*o,o=Math.abs(e.xr[r])-p[i[r]]*s,r++,n+=o*o}return t.s=r,n},this.calc_noise=function(e,t,a,s,n){var r,i,_=0,o=0,l=0,f=0,c=0,h=-20,u=0,b=e.scalefac,p=0;for(r=s.over_SSD=0;r>1,u+e.width[r]>e.max_nonzero_coeff)i=0<(g=e.max_nonzero_coeff-u+1)?g>>1:0;var R=new B(u);v=this.calc_noise_core(e,R,i,S),u=R.s,null!=n&&(n.step[r]=d,n.noise[r]=v),v=a[_++]=v/t[o++],v=ee.FAST_LOG10(Math.max(v,1e-20)),null!=n&&(n.noise_log[r]=v)}if(null!=n&&(n.global_gain=e.global_gain),c+=v,0a.max_noise-.2&&a.tot_noisea.max_noise-.2&&a.tot_noisea.max_noise-.1&&a.tot_noise+a.over_noisea.max_noise-.15&&a.tot_noise+a.over_noise+a.over_noiset.xrpow_max&&(t.xrpow_max=s[f+c]);if(2==i.noise_shaping_amp)return}}}(e,t,a,s,n);var i=_(t);return!i&&(!(i=2==r.mode_gr?M.scale_bitcount(t):M.scale_bitcount_lsf(r,t))||(1e.xrpow_max&&(e.xrpow_max=t[a+i])}e.scalefac[s]=r>>1}e.preflag=0,e.scalefac_scale=1}(t,s),i=!1):t.block_type==Pe.SHORT_TYPE&&0>t.scalefac_scale))n[s]=f,o+=3*l;else{n[s]=0;var c=210+(f<t.xrpow_max&&(t.xrpow_max=a[o+h]);o+=l*(3-r-1)}}var u=R.IPOW20(202);for(o+=t.width[s]*(r+1),h=-t.width[s];h<0;h++)a[o+h]*=u,a[o+h]>t.xrpow_max&&(t.xrpow_max=a[o+h])}}return!1}(r,t,s)||_(t))),i||(i=2==r.mode_gr?M.scale_bitcount(t):M.scale_bitcount_lsf(r,t)),!i))}this.setModules=function(e,t,a,s){d=e,g=t,this.rv=t,R=a,this.qupvt=a,M=s,n.setModules(R,M)},this.ms_convert=function(e,t){for(var a=0;a<576;++a){var s=e.tt[t][0].xr[a],n=e.tt[t][1].xr[a];e.tt[t][0].xr[a]=(s+n)*(.5*ee.SQRT2),e.tt[t][1].xr[a]=(s-n)*(.5*ee.SQRT2)}},this.init_xrpow=function(e,t,a){var s=0,n=0|t.max_nonzero_coeff;if(t.xrpow_max=0,ke.fill(a,n,576,0),1e-20<(s=function(e,t,a,s){for(var n=s=0;n<=a;++n){var r=Math.abs(e.xr[n]);s+=r,t[n]=Math.sqrt(r*Math.sqrt(r)),t[n]>e.xrpow_max&&(e.xrpow_max=t[n])}return s}(t,a,n,s))){var r=0;0!=(2&e.substep_shaping)&&(r=1);for(var i=0;iS&&_.global_gain<=g;)_.global_gain++;if(_.global_gain>g)break;if(0==f.over_count){for(;(_.part2_3_length=M.count_bits(i,s,_,c))>h&&_.global_gain<=g;)_.global_gain++;if(_.global_gain>g)break}if(R.calc_noise(_,a,l,v,c),v.bits=_.part2_3_length,0!=(B(t.block_type!=Pe.SHORT_TYPE?e.quant_comp:e.quant_comp_short,f,v,_,l)?1:0))h=t.part2_3_length,f=v,t.assign(_),m=0,$.arraycopy(s,0,o,0,576);else if(0==i.full_outer_loop){if(++m>d&&0==f.over_count)break;if(3==i.noise_shaping_amp&&b&&30r[f.VBR_max_bitrate]&&(_[p][d]*=r[f.VBR_max_bitrate],_[p][d]/=u),i[p][d]>_[p][d]&&(i[p][d]=_[p][d]);return h},this.bitpressure_strategy=function(e,t,a,s){for(var n=0;nG.MAX_BITS_PER_CHANNEL&&(s[_][o]=G.MAX_BITS_PER_CHANNEL),b+=s[_][o]}if(G.MAX_BITS_PER_GRANULEG.MAX_BITS_PER_CHANNEL&&(s[_][o]=G.MAX_BITS_PER_CHANNEL),l+=s[_][o];if(l>r[0])for(_=0;_=s?(e.ATH.adjust*=.075*s+.925,e.ATH.adjust=s?e.ATH.adjust=s:e.ATH.adjust>1,u=(h=(c=s)<<1)+c,s=h<<1,r=(n=t)+b;R=e[n+0]-e[n+c],S=e[n+0]+e[n+c],w=e[n+h]-e[n+u],A=e[n+h]+e[n+u],e[n+h]=S-A,e[n+0]=S+A,e[n+u]=R-w,e[n+c]=R+w,R=e[r+0]-e[r+c],S=e[r+0]+e[r+c],w=ee.SQRT2*e[r+u],A=ee.SQRT2*e[r+h],e[r+h]=S-A,e[r+0]=S+A,e[r+u]=R-w,e[r+c]=R+w,r+=s,(n+=s)<_;);for(l=k[i+0],o=k[i+1],f=1;fL[u+3-2]?Q/=L[u+3-2]:Q=L[u+3-2]>10*Q?L[u+3-2]/(10*Q):0,D[u+3]=Q}if(e.analysis){var W=D[0];for(u=1;u<12;u++)WV&&(C[u/3]=u%3+1);for(u=1;u<4;u++){(N[u-1]>N[u]?N[u-1]/N[u]:N[u]/N[u-1])<1.7&&(C[u]=0,1==u&&(C[0]=0))}for(0!=C[0]&&0!=S.nsPsy.lastAttacks[c]&&(C[0]=0),3!=S.nsPsy.lastAttacks[c]&&C[0]+C[1]+C[2]+C[3]==0||((X=0)!=C[1]&&0!=C[0]&&(C[1]=0),0!=C[2]&&0!=C[1]&&(C[2]=0),0!=C[3]&&0!=C[2]&&(C[3]=0)),c<2?k[c]=X:0==X&&(k[0]=k[1]=0),o[c]=S.tot_ener[c],he(e,F,j,R,1&c,M,1&c,s,c,t,a),Re(S,F,A,q,Y),Me(S,q,Y,y),d=0;d<3;d++){var J,$;for(de(e,j,B,w,c,d),pe(S,B,w,c,d),m=0;m1.58*e.thm[1].l[t]||e.thm[1].l[t]>1.58*e.thm[0].l[t])){var a=e.mld_l[t]*e.en[3].l[t],s=Math.max(e.thm[2].l[t],Math.min(e.thm[3].l[t],a));a=e.mld_l[t]*e.en[2].l[t];var n=Math.max(e.thm[3].l[t],Math.min(e.thm[2].l[t],a));e.thm[2].l[t]=s,e.thm[3].l[t]=n}for(t=0;t1.58*e.thm[1].s[t][r]||e.thm[1].s[t][r]>1.58*e.thm[0].s[t][r]||(a=e.mld_s[t]*e.en[3].s[t][r],s=Math.max(e.thm[2].s[t][r],Math.min(e.thm[3].s[t][r],a)),a=e.mld_s[t]*e.en[2].s[t][r],n=Math.max(e.thm[3].s[t][r],Math.min(e.thm[2].s[t][r],a)),e.thm[2].s[t][r]=s,e.thm[3].s[t][r]=n)}(S),g=e.msfix,0g&&(s[o]=g),1a[o]&&(s[o]=a[o]),l.masking_lower<1&&(s[o]*=l.masking_lower)}for(;of&&(s[r]=f),1a[r]&&(s[r]=a[r]),e.masking_lower<1&&(s[r]*=e.masking_lower)}for(;rR[m+3-2]?x/=R[m+3-2]:x=R[m+3-2]>10*x?R[m+3-2]/(10*x):0,S[m+3]=x}for(m=0;m<3;++m){var P=R[3*m+3]+R[3*m+4]+R[3*m+5],I=1;6*R[3*m+5]w&&(o[b][m/3]=m%3+1);for(m=1;m<4;m++){var O=M[m-1],V=M[m];Math.max(O,V)<4e4&&O<1.7*V&&V<1.7*O&&(1==m&&o[b][0]<=o[b][m]&&(o[b][0]=0),o[b][m]=0)}o[b][0]<=c.nsPsy.lastAttacks[b]&&(o[b][0]=0),3!=c.nsPsy.lastAttacks[b]&&o[b][0]+o[b][1]+o[b][2]+o[b][3]==0||((T=0)!=o[b][1]&&0!=o[b][0]&&(o[b][1]=0),0!=o[b][2]&&0!=o[b][1]&&(o[b][2]=0),0!=o[b][3]&&0!=o[b][2]&&(o[b][3]=0)),b<2?l[b]=T:0==T&&(l[0]=l[1]=0),i[b]=c.tot_ener[b]}}(e,t,a,s,n,r,o,M,A,B),function(e,t){var a=e.internal_flags;e.short_blocks!=Ee.short_block_coupled||0!=t[0]&&0!=t[1]||(t[0]=t[1]=0);for(var s=0;s=n&&(p=i*(l[t]-n)/(24-n)+r*(24-l[t])/(24-n)),c[t]=Math.pow(10,p/10),0=n&&(p=o*(l[t]-n)/(24-n)+_*(24-l[t])/(24-n)),c[t]=Math.pow(10,p/10),g=K.MAX_VALUE;for(d=0;da.npart_l-1&&(a.s3ind[R][1]=a.npart_l-1);var M=576*a.mode_gr/h;if(a.ATH.decay=Math.pow(10,-1.2*M),a.ATH.adjust=.01,-(a.ATH.adjustLimit=1)!=e.ATHtype){var A=e.out_samplerate/Pe.BLKSIZE,B=0;for(t=v=0;t=d)for(l=0;le.in_samplerate&&(e.lowpassfreq=e.in_samplerate/2),e.out_samplerate=(t=0|e.lowpassfreq,a=e.in_samplerate,s=44100,48e3<=a?s=48e3:44100<=a?s=44100:32e3<=a?s=32e3:24e3<=a?s=24e3:22050<=a?s=22050:16e3<=a?s=16e3:12e3<=a?s=12e3:11025<=a?s=11025:8e3<=a&&(s=8e3),-1==t?s:(t<=15960&&(s=44100),t<=15250&&(s=32e3),t<=11220&&(s=24e3),t<=9970&&(s=22050),t<=7230&&(s=16e3),t<=5420&&(s=12e3),t<=4510&&(s=11025),t<=3970&&(s=8e3),a=t.lowpass2&&(a=Math.min(a,r)),t.lowpass1t.highpass1?x((t.highpass2-l)/(t.highpass2-t.highpass1+1e-20)):1,o=t.lowpass2>t.lowpass1?x((l-t.lowpass1)/(t.lowpass2-t.lowpass1+1e-20)):1,t.amp_filter[r]=_*o}}(e),n.samplerate_index=P(e.out_samplerate,e),n.samplerate_index<0)return e.internal_flags=null,-1;if(e.VBR==ye.vbr_off){if(e.free_format)n.bitrate_index=0;else if(e.brate=I(e.brate,e.version,e.out_samplerate),n.bitrate_index=H(e.brate,e.version,e.out_samplerate),n.bitrate_index<=0)return e.internal_flags=null,-1}else n.bitrate_index=1;e.analysis&&(e.bWriteVbrTag=!1),null!=n.pinfo&&(e.bWriteVbrTag=!1),A.init_bit_stream_w(n);for(var c,h,u,b=n.samplerate_index+3*e.version+6*(e.out_samplerate<16e3?1:0),p=0;p=f){var R=i-u;if(0==i&&(R=0),(_=L(e,b[0],b[1],n,r,R))<0)return _;for(r+=_,u+=_,h.mf_size-=e.framesize,h.mf_samples_to_encode-=e.framesize,l=0;li&&(s.ResvMax=i),(s.ResvMax<0||e.disable_reservoir)&&(s.ResvMax=0);var _=t.bits*s.mode_gr+Math.min(s.ResvSize,s.ResvMax);return a<_&&(_=a),n.resvDrain_pre=0,null!=s.pinfo&&(s.pinfo.mean_bits=t.bits/2,s.pinfo.resvsize=s.ResvSize),_},this.ResvMaxBits=function(e,t,a,s){var n,r=e.internal_flags,i=r.ResvSize,_=r.ResvMax;0!=s&&(i+=t),0!=(1&r.substep_shaping)&&(_*=.9),a.bits=t,9*_<10*i?(n=i-9*_/10,a.bits+=n,r.substep_shaping|=128):(n=0,r.substep_shaping&=127,e.disable_reservoir||0!=(1&r.substep_shaping)||(a.bits-=.1*t));var o=i<6*r.ResvMax/10?i:6*r.ResvMax/10;return(o-=n)<0&&(o=0),o},this.ResvAdjust=function(e,t){e.ResvSize-=t.part2_3_length+t.part2_length},this.ResvFrameEnd=function(e,t){var a,s=e.l3_side;e.ResvSize+=t*e.mode_gr;var n=0;s.resvDrain_post=0,(s.resvDrain_pre=0)!=(a=e.ResvSize%8)&&(n+=a),0<(a=e.ResvSize-n-e.ResvMax)&&(n+=a);var r=Math.min(8*s.main_data_begin,n)/8;s.resvDrain_pre+=8*r,n-=8*r,e.ResvSize-=8*r,s.main_data_begin-=r,s.resvDrain_post+=n,e.ResvSize-=n}},b=new T,p=new function(){this.setModules=function(e,t,a){}},m=new function(){};n.setModules(r,i,_,o,l,f,c,h,m),i.setModules(r,m,c,f),h.setModules(i,c),_.setModules(n),l.setModules(i,u,o,b),o.setModules(b,u,n.enc.psy),u.setModules(i),b.setModules(o),f.setModules(n,i,c),a.setModules(p,m),p.setModules(c,h,_);var d=n.lame_init();d.num_channels=s,d.in_samplerate=e,d.out_samplerate=e,d.brate=t,d.mode=xe.STEREO,d.quality=3,d.bWriteVbrTag=!1,d.disable_reservoir=!0,d.write_id3tag_automatic=!1,n.lame_init_params(d);var v=1152,g=0|1.25*v+7200,S=B(g);this.encodeBuffer=function(e,t){1==s&&(t=e),e.length>v&&(v=e.length,S=B(g=0|1.25*v+7200));var a=n.lame_encode_buffer(d,e,t,e.length,S,0,g);return new Int8Array(S.subarray(0,a))},this.flush=function(){var e=n.lame_encode_flush(d,S,0,g);return new Int8Array(S.subarray(0,e))}},a.WavHeader=_}a(),Recorder.lamejs=a}(); \ No newline at end of file diff --git a/recorder.wav.min.js b/recorder.wav.min.js index 383d9f5..7d078ad 100644 --- a/recorder.wav.min.js +++ b/recorder.wav.min.js @@ -3,4 +3,4 @@ https://github.com/xiangyuecn/Recorder src: recorder-core.js,engine/wav.js */ -!function(a){"use strict";a.RecorderLM="2019-9-6 23:22:12";var p=function(){};function v(e){return new t(e)}function t(e){var t={type:"mp3",bitRate:16,sampleRate:16e3,bufferSize:4096,onProcess:p};for(var a in e)t[a]=e[a];this.set=t,this._S=9}v.IsOpen=function(){var e=v.Stream;if(e){var t=e.getTracks();if(0"+u.length+" 花:"+(Date.now()-n)+"ms"),setTimeout(function(){n=Date.now(),r[o.type](u,function(e){i(e,f)},function(e){s(e)})})}else s("未加载"+o.type+"编码器");else s("未采集到录音")}},a.Recorder=v}(window),function(){"use strict";Recorder.prototype.enc_wav={stable:!0,testmsg:"比特率取值范围8位、16位"},Recorder.prototype.wav=function(e,t,a){var n=this.set,r=e.length,o=n.sampleRate,s=8==n.bitRate?8:16,i=r*(s/8),c=new ArrayBuffer(44+i),f=new DataView(c),p=0,u=function(e){for(var t=0;t>8);f.setInt8(p,h,!0)}else for(m=0;m"+v.length+" 花:"+(Date.now()-n)+"ms"),setTimeout(function(){n=Date.now(),r[o.type](v,function(e){c(e,u)},function(e){i(e)})})}else i("未加载"+o.type+"编码器");else i("未采集到录音")}},p.Recorder=m}(window),function(){"use strict";Recorder.prototype.enc_wav={stable:!0,testmsg:"比特率取值范围8位、16位"},Recorder.prototype.wav=function(e,t,a){var n=this.set,r=e.length,o=n.sampleRate,s=8==n.bitRate?8:16,i=r*(s/8),c=new ArrayBuffer(44+i),f=new DataView(c),p=0,u=function(e){for(var t=0;t>8);f.setInt8(p,h,!0)}else for(m=0;m