H&&(q[h/3]=h%3+1);for(h=1;h<4;h++)(N[h-1]>N[h]?(ke(01.58*e.thm[1].l[t]||e.thm[1].l[t]>1.58*e.thm[0].l[t])){var n=e.mld_l[t]*e.en[3].l[t],a=Math.max(e.thm[2].l[t],Math.min(e.thm[3].l[t],n));n=e.mld_l[t]*e.en[2].l[t];var r=Math.max(e.thm[3].l[t],Math.min(e.thm[2].l[t],n));e.thm[2].l[t]=a,e.thm[3].l[t]=r}for(t=0;t 1.58*e.thm[1].s[t][s]||e.thm[1].s[t][s]>1.58*e.thm[0].s[t][s]||(n=e.mld_s[t]*e.en[3].s[t][s],a=Math.max(e.thm[2].s[t][s],Math.min(e.thm[3].s[t][s],n)),n=e.mld_s[t]*e.en[2].s[t][s],r=Math.max(e.thm[3].s[t][s],Math.min(e.thm[2].s[t][s],n)),e.thm[2].s[t][s]=a,e.thm[3].s[t][s]=r)}(w),g=e.msfix,0 g&&(a[_]=g),1 n[_]&&(a[_]=n[_]),l.masking_lower<1&&(a[_]*=l.masking_lower),ke(0<=a[_])}for(;_ f&&(a[s]=f),1 n[s]&&(a[s]=n[s]),e.masking_lower<1&&(a[s]*=e.masking_lower),ke(0<=a[s])}for(;s S[b+3-2]?(ke(0 10*k?(ke(0R&&(_[p][b/3]=b%3+1);for(b=1;b<4;b++){var V=y[b-1],H=y[b];Math.max(V,H)<4e4&&V<1.7*H&&H<1.7*V&&(1==b&&_[p][0]<=_[p][b]&&(_[p][0]=0),_[p][b]=0)}_[p][0]<=c.nsPsy.lastAttacks[p]&&(_[p][0]=0),3!=c.nsPsy.lastAttacks[p]&&_[p][0]+_[p][1]+_[p][2]+_[p][3]==0||((A=0)!=_[p][1]&&0!=_[p][0]&&(_[p][1]=0),0!=_[p][2]&&0!=_[p][1]&&(_[p][2]=0),0!=_[p][3]&&0!=_[p][2]&&(_[p][3]=0)),p<2?l[p]=A:0==A&&(l[0]=l[1]=0),i[p]=c.tot_ener[p]}}(e,t,n,a,r,s,_,y,M,x),function(e,t){var n=e.internal_flags;e.short_blocks!=Re.short_block_coupled||0!=t[0]&&0!=t[1]||(t[0]=t[1]=0);for(var a=0;a =s&&(b=o*(f[t]-s)/(24-s)+i*(24-f[t])/(24-s)),u[t]=Math.pow(10,b/10),0 =s&&(b=l*(f[t]-s)/(24-s)+_*(24-f[t])/(24-s)),u[t]=Math.pow(10,b/10),g=G.MAX_VALUE,m=0;m a.npart_l-1&&(a.s3ind[S][1]=a.npart_l-1);var y=576*a.mode_gr/h;if(a.ATH.decay=Math.pow(10,-1.2*y),a.ATH.adjust=.01,a.ATH.adjustLimit=1,ke(a.bo_l[Pe.SBMAX_l-1]<=a.npart_l),ke(a.bo_s[Pe.SBMAX_s-1]<=a.npart_s),-1!=e.ATHtype){var M=e.out_samplerate/Pe.BLKSIZE,x=0;for(t=v=0;t >1,h=(u=(c=a)<<1)+c,a=u<<1,s=(r=t)+p;S=e[r+0]-e[r+c],w=e[r+0]+e[r+c],R=e[r+u]-e[r+h],M=e[r+u]+e[r+h],e[r+u]=w-M,e[r+0]=w+M,e[r+h]=S-R,e[r+c]=S+R,S=e[s+0]-e[s+c],w=e[s+0]+e[s+c],R=E.SQRT2*e[s+h],M=E.SQRT2*e[s+u],e[s+u]=w-M,e[s+0]=w+M,e[s+h]=S-R,e[s+c]=S+R,s+=a,(r+=a) n.max_noise-.2&&n.tot_noise n.max_noise-.2&&n.tot_noise n.max_noise-.1&&n.tot_noise+n.over_noise n.max_noise-.15&&n.tot_noise+n.over_noise+n.over_noise t.xrpow_max&&(t.xrpow_max=a[f+c]);if(2==i.noise_shaping_amp)return}}}(e,t,n,a,r);var i=o(t);return!(i||(i=2==s.mode_gr?y.scale_bitcount(t):y.scale_bitcount_lsf(s,t))&&(1 e.xrpow_max&&(e.xrpow_max=t[n+i])}e.scalefac[a]=s>>1}e.preflag=0,e.scalefac_scale=1}(t,a),i=!1):t.block_type==L.SHORT_TYPE&&0 >t.scalefac_scale))r[a]=f,_+=3*l;else{r[a]=0;var c=210+(f< t.xrpow_max&&(t.xrpow_max=n[_+u]);_+=l*(3-s-1)}}var h=S.IPOW20(202);for(_+=t.width[a]*(s+1),u=-t.width[a];u<0;u++)n[_+u]*=h,n[_+u]>t.xrpow_max&&(t.xrpow_max=n[_+u])}}return!1}(s,t,a)||o(t))),i||(i=2==s.mode_gr?y.scale_bitcount(t):y.scale_bitcount_lsf(s,t)),i))}this.setModules=function(e,t,n,a){m=e,g=t,this.rv=t,S=n,this.qupvt=n,y=a,r.setModules(S,y)},this.ms_convert=function(e,t){for(var n=0;n<576;++n){var a=e.tt[t][0].xr[n],r=e.tt[t][1].xr[n];e.tt[t][0].xr[n]=(a+r)*(.5*i.SQRT2),e.tt[t][1].xr[n]=(a-r)*(.5*i.SQRT2)}},this.init_xrpow=function(e,t,n){var a=0,r=0|t.max_nonzero_coeff;if(T(null!=n),t.xrpow_max=0,T(0<=r&&r<=575),b.fill(n,r,576,0),1e-20<(a=function(e,t,n,a){for(var r=a=0;r<=n;++r){var s=Math.abs(e.xr[r]);a+=s,t[r]=Math.sqrt(s*Math.sqrt(s)),t[r]>e.xrpow_max&&(e.xrpow_max=t[r])}return a}(t,n,r,a))){var s=0;0!=(2&e.substep_shaping)&&(s=1);for(var i=0;i w&&o.global_gain<=g;)o.global_gain++;if(o.global_gain>g)break;if(0==f.over_count){for(;(o.part2_3_length=y.count_bits(i,a,o,c))>u&&o.global_gain<=g;)o.global_gain++;if(o.global_gain>g)break}if(S.calc_noise(o,n,l,v,c),v.bits=o.part2_3_length,0!=(x(t.block_type!=L.SHORT_TYPE?e.quant_comp:e.quant_comp_short,f,v,o,l)?1:0))u=t.part2_3_length,f=v,t.assign(o),b=0,A.arraycopy(a,0,_,0,576);else if(0==i.full_outer_loop){if(++b>m&&0==f.over_count)break;if(3==i.noise_shaping_amp&&p&&30s[f.VBR_max_bitrate]&&(o[d][m]*=s[f.VBR_max_bitrate],o[d][m]/=h),i[d][m]>o[d][m]&&(i[d][m]=o[d][m]);return u},this.bitpressure_strategy=function(e,t,n,a){for(var r=0;r LameInternalFlags.MAX_BITS_PER_CHANNEL&&(a[o][_]=LameInternalFlags.MAX_BITS_PER_CHANNEL),p+=a[o][_]}if(p>LameInternalFlags.MAX_BITS_PER_GRANULE)for(_=0;_ LameInternalFlags.MAX_BITS_PER_CHANNEL&&(a[o][_]=LameInternalFlags.MAX_BITS_PER_CHANNEL),l+=a[o][_];if(l>s[0])for(o=0;o i&&(a.ResvMax=i),(a.ResvMax<0||e.disable_reservoir)&&(a.ResvMax=0);var o=t.bits*a.mode_gr+Math.min(a.ResvSize,a.ResvMax);return n >24,e[t+1]=255&n>>16,e[t+2]=255&n>>8,e[t+3]=255&n}function H(e,t,n){e[t+0]=255&n>>8,e[t+1]=255&n}function o(e,t,n){return 255&(e< >8^n[255&(t^e)]}this.addVbrFrame=function(e){var t=e.internal_flags,n=Tables.bitrate_table[e.version][t.bitrate_index];r(null!=t.VBR_seek_table.bag),function(e,t){if(e.nVbrNumFrames++,e.sum+=t,e.seen++,!(e.seen >3&1,i=e[n+2]>>2&3,o=e[n+3]>>6&3,_=e[n+2]>>4&15;if(_=Tables.bitrate_table[s][_],e[n+1]>>4==14?t.samprate=Tables.samplerate_table[2][i]:t.samprate=Tables.samplerate_table[s][i],a=e,r=n+=0!=s?3!=o?36:21:3!=o?21:13,!new String(a,r,p.length(),null).equals(p)&&!new String(a,r,d.length(),null).equals(d))return null;n+=4,t.hId=s;var l=t.flags=b(e,n);if(n+=4,0!=(1&l)&&(t.frames=b(e,n),n+=4),0!=(2&l)&&(t.bytes=b(e,n),n+=4),0!=(4&l)){if(null!=t.toc)for(var f=0;f >4;var u=(15&e[n+1])<<8;return(c<0||3e3 e.pos-1&&(r=e.pos-1);var s=0|256*e.bag[r]/e.sum;255 e.scale_right||e.disable_reservoir&&e.brate<320||e.noATH||e.ATHonly||0==k||e.in_samplerate<=32e3)&&(y=1),i=w+(S<<2)+(y<<5)+(M<<6),o=f.nMusicCRC,V(n,a+c,p),c+=4;for(var P=0;P<9;P++)n[a+c+P]=255&d.charAt(P);n[a+(c+=9)]=255&s,n[a+ ++c]=255&m,V(n,a+ ++c,v),H(n,a+(c+=4),g),H(n,a+(c+=2),0),n[a+(c+=2)]=255&_,n[a+ ++c]=255<=l?255:255&l,n[a+ ++c]=255&u>>4,n[a+c+1]=255&(u<<4)+(h>>8),n[a+c+2]=255&h,n[a+(c+=3)]=255&i,c++,n[a+c++]=0,H(n,a+c,e.preset),V(n,a+(c+=2),t),H(n,a+(c+=4),o),c+=2;for(var L=0;La.length?-1:(r<1||t.write(a,0,r),0)}}s.NUMTOCENTRIES=100,s.MAXFRAMESIZE=2880,e.exports=s},function(e,t,n){var a=n(48);"string"==typeof a&&(a=[[e.i,a,""]]),a.locals&&(e.exports=a.locals);(0,n(3).default)("5b0bec03",a,!1,{})},function(e,t,n){(e.exports=n(2)(!1)).push([e.i,"\n.ar-icon {\n fill: #747474;\n border-radius: 50%;\n border: 1px solid #05CBCD;\n background-color: #FFFFFF;\n padding: 5px;\n cursor: pointer;\n transition: .2s;\n}\n.ar-icon--no-border {\n border: 0;\n border-radius: 0;\n padding: 0;\n}\n.ar-icon--rec {\n fill: white;\n background-color: #FF6B64;\n border-color: transparent;\n}\n.ar-icon--pulse {\n animation: ripple .5s linear infinite;\n}\n@keyframes ripple {\n0% {\n box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.1), 0 0 0 1px rgba(255, 0, 0, 0.1), 0 0 0 5px rgba(255, 0, 0, 0.1);\n}\n100% {\n box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.1), 0 0 0 10px rgba(255, 0, 0, 0.1), 0 0 0 20px rgba(255, 0, 0, 0);\n}\n}\n.ar-icon__xs {\n width: 18px;\n height: 18px;\n line-height: 18px;\n}\n.ar-icon__sm {\n width: 30px;\n height: 30px;\n line-height: 30px;\n}\n.ar-icon__lg {\n width: 45px;\n height: 45px;\n line-height: 45px;\n box-shadow: 0 2px 5px 1px rgba(158, 158, 158, 0.5);\n}\n",""])},function(e,t,n){"use strict";n.r(t);var a={props:{name:{type:String}},data:function(){return{icons:{download:'',mic:'',pause:'',play:'',save:'',stop:'',volume:''}}}},r=function(){var e=this,t=e.$createElement;return(e._self._c||t)("div",{domProps:{innerHTML:e._s(e.icons[e.name])}})};function s(e,t,n,a,r,s,i,o){var _=typeof(e=e||{}).default;"object"!==_&&"function"!==_||(e=e.default);var l,f="function"==typeof e?e.options:e;if(t&&(f.render=t,f.staticRenderFns=n,f._compiled=!0),a&&(f.functional=!0),s&&(f._scopeId=s),i?(l=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),r&&r.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(i)},f._ssrRegister=l):r&&(l=o?function(){r.call(this,this.$root.$options.shadowRoot)}:r),l)if(f.functional){f._injectStyles=l;var c=f.render;f.render=function(e,t){return l.call(t),c(e,t)}}else{var u=f.beforeCreate;f.beforeCreate=u?[].concat(u,l):[l]}return{exports:e,options:f}}r._withStripped=!0;var i=s(a,r,[],!1,null,null,null);i.options.__file="src/components/icon-button.vue";var o=i.exports;function _(e,t){var n=t.getBoundingClientRect().width,a=e.target.getBoundingClientRect().left,r=(e.clientX-a)/n;try{if(!e.target.className.match(/^ar\-line\-control/))return}catch(e){return}return r=1<(r=r<0?0:r)?1:r}function l(e){return new Date(1e3*e).toISOString().substr(14,5)}var f={props:{refId:{type:String},eventName:{type:String},percentage:{type:Number,default:0},rowDirection:{type:Boolean,default:!0}},methods:{onMouseDown:function(e){var t=_(e,this.$refs[this.refId]);this.$emit("change-linehead",t),document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.onMouseUp)},onMouseUp:function(e){document.removeEventListener("mouseup",this.onMouseUp),document.removeEventListener("mousemove",this.onMouseMove);var t=_(e,this.$refs[this.refId]);this.$emit("change-linehead",t)},onMouseMove:function(e){var t=_(e,this.$refs[this.refId]);this.$emit("change-linehead",t)}},computed:{calculateSize:function(){var e=this.percentage<1?100*this.percentage:this.percentage;return(this.rowDirection?"width":"height")+": "+e+"%"}}},c=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{ref:e.refId,staticClass:"ar-line-control",on:{mousedown:e.onMouseDown}},[n("div",{staticClass:"ar-line-control__head",style:e.calculateSize})])};c._withStripped=!0;var u=s(f,c,[],!1,function(e){n(19)},null,null);u.options.__file="src/components/line-control.vue";var h=u.exports,p={data:function(){return{volume:.8}},components:{IconButton:o,LineControl:h},methods:{onChangeLinehead:function(e){this.$emit("change-volume",e),this.volume=e}}},d=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"ar-volume"},[n("icon-button",{staticClass:"ar-volume__icon",attrs:{name:"volume"}}),e._v(" "),n("line-control",{staticClass:"ar-volume-bar",attrs:{"ref-id":"volume",percentage:e.volume},on:{"change-linehead":e.onChangeLinehead}})],1)};d._withStripped=!0;var b=s(p,d,[],!1,function(e){n(21)},null,null);b.options.__file="src/components/volume-control.vue";var m=b.exports,v={props:{src:{type:String},record:{type:Object},filename:{type:String}},data:function(){return{isPlaying:!1,duration:l(0),playedTime:l(0),progress:0}},components:{IconButton:o,LineControl:h,VolumeControl:m},mounted:function(){var t=this;this.player=document.getElementById(this.playerUniqId),this.player.addEventListener("ended",function(){t.isPlaying=!1}),this.player.addEventListener("loadeddata",function(e){t._resetProgress(),t.duration=l(t.player.duration)}),this.player.addEventListener("timeupdate",this._onTimeUpdate),this.$eventBus.$on("remove-record",function(){t._resetProgress()})},computed:{audioSource:function(){var e=this.src||this.record.url;if(e)return e;this._resetProgress()},playBtnIcon:function(){return this.isPlaying?"pause":"play"},playerUniqId:function(){return"audio-player"+this._uid}},methods:{playback:function(){var e=this;this.audioSource&&(this.isPlaying?this.player.pause():setTimeout(function(){e.player.play()},0),this.isPlaying=!this.isPlaying)},_resetProgress:function(){this.isPlaying&&this.player.pause(),this.duration=l(0),this.playedTime=l(0),this.progress=0,this.isPlaying=!1},_onTimeUpdate:function(){this.playedTime=l(this.player.currentTime),this.progress=this.player.currentTime/this.player.duration*100},_onUpdateProgress:function(e){e&&(this.player.currentTime=e*this.player.duration)},_onChangeVolume:function(e){e&&(this.player.volume=e)}}},g=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"ar-player"},[n("div",{staticClass:"ar-player-actions"},[n("icon-button",{staticClass:"ar-icon ar-icon__lg ar-player__play",class:{"ar-player__play--active":t.isPlaying},attrs:{id:"play",name:t.playBtnIcon},nativeOn:{click:function(e){return t.playback(e)}}})],1),t._v(" "),n("div",{staticClass:"ar-player-bar"},[n("div",{staticClass:"ar-player__time"},[t._v(t._s(t.playedTime))]),t._v(" "),n("line-control",{staticClass:"ar-player__progress",attrs:{"ref-id":"progress",percentage:t.progress},on:{"change-linehead":t._onUpdateProgress}}),t._v(" "),n("div",{staticClass:"ar-player__time"},[t._v(t._s(t.duration))]),t._v(" "),n("volume-control",{on:{"change-volume":t._onChangeVolume}})],1),t._v(" "),n("audio",{attrs:{id:t.playerUniqId,src:t.audioSource}})])};g._withStripped=!0;var w=s(v,g,[],!1,function(e){n(17)},null,null);w.options.__file="src/components/player.vue";var S=w.exports,y={props:{record:{type:Object},filename:{type:String}},components:{IconButton:o},methods:{download:function(){if(this.record.url){var e=document.createElement("a");e.href=this.record.url,e.download=this.filename+".mp3",e.click()}}}},M=function(){var t=this,e=t.$createElement;return(t._self._c||e)("icon-button",{staticClass:"ar-icon ar-icon__xs ar-icon--no-border",attrs:{id:"download",name:"download"},nativeOn:{click:function(e){return t.download(e)}}})};M._withStripped=!0;var x=s(y,M,[],!1,function(e){n(25)},null,null);x.options.__file="src/components/downloader.vue";var R=x.exports,A=n(16),B=function(){function a(e,t){for(var n=0;n =this.attempts||(!this.isRecording||this.isRecording&&this.isPause?this.recorder.start():this.recorder.pause())},stopRecorder:function(){this.isRecording&&(this.recorder.stop(),this.recordList=this.recorder.recordList())},removeRecord:function(e){this.recordList.splice(e,1),this.$set(this.selected,"url",null),this.$eventBus.$emit("remove-record")},choiceRecord:function(e){this.selected!==e&&(this.selected=e,this.selectRecord&&this.selectRecord(e))},_initRecorder:function(){return new k({beforeRecording:this.beforeRecording,afterRecording:this.afterRecording,pauseRecording:this.pauseRecording,micFailed:this.micFailed})}},computed:{attemptsLeft:function(){return this.attempts-this.recordList.length},iconButtonType:function(){return this.isRecording&&this.isPause?"mic":this.isRecording?"pause":"mic"},isPause:function(){return this.recorder.isPause},isRecording:function(){return this.recorder.isRecording},recordedTime:function(){return this.time&&this.recorder.duration>=60*this.time&&this.stopRecorder(),l(this.recorder.duration)},volume:function(){return parseFloat(this.recorder.volume)}}},N=function(){var a=this,e=a.$createElement,r=a._self._c||e;return r("div",{staticClass:"ar"},[a.isUploading?r("div",{staticClass:"ar__overlay"}):a._e(),a._v(" "),a.isUploading?r("div",{staticClass:"ar-spinner"},[r("div",{staticClass:"ar-spinner__dot"}),a._v(" "),r("div",{staticClass:"ar-spinner__dot"}),a._v(" "),r("div",{staticClass:"ar-spinner__dot"})]):a._e(),a._v(" "),r("div",{staticClass:"ar-content",class:{ar__blur:a.isUploading}},[r("div",{staticClass:"ar-recorder"},[r("icon-button",{staticClass:"ar-icon ar-icon__lg",class:{"ar-icon--rec":a.isRecording,"ar-icon--pulse":a.isRecording&&.02 ", "license": "MIT", "scripts": { "dev": "webpack-dev-server --env.NODE_ENV=development --mode development --open --hot --https", "build": "webpack --env.NODE_ENV=production --mode production --progress --hide-modules" }, - "dependencies": {}, + "dependencies": { + "lamejs": "^1.2.0" + }, "browserslist": [ "> 1%", "last 2 versions", diff --git a/screenshot.png b/screenshot.png index c7779c3..25a48fd 100644 Binary files a/screenshot.png and b/screenshot.png differ diff --git a/src/components/downloader.vue b/src/components/downloader.vue new file mode 100644 index 0000000..224123b --- /dev/null +++ b/src/components/downloader.vue @@ -0,0 +1,37 @@ + + + + + + + diff --git a/src/components/line-control.vue b/src/components/line-control.vue index 1b9ab55..17dabc4 100644 --- a/src/components/line-control.vue +++ b/src/components/line-control.vue @@ -35,7 +35,7 @@ }, methods: { onMouseDown (ev) { - let seekPos = calculateLineHeadPosition(ev, this.$refs[this.refId]) + const seekPos = calculateLineHeadPosition(ev, this.$refs[this.refId]) this.$emit('change-linehead', seekPos) document.addEventListener('mousemove', this.onMouseMove) document.addEventListener('mouseup', this.onMouseUp) @@ -43,17 +43,17 @@ onMouseUp (ev) { document.removeEventListener('mouseup', this.onMouseUp) document.removeEventListener('mousemove', this.onMouseMove) - let seekPos = calculateLineHeadPosition(ev, this.$refs[this.refId]) + const seekPos = calculateLineHeadPosition(ev, this.$refs[this.refId]) this.$emit('change-linehead', seekPos) }, onMouseMove (ev) { - let seekPos = calculateLineHeadPosition(ev, this.$refs[this.refId]) + const seekPos = calculateLineHeadPosition(ev, this.$refs[this.refId]) this.$emit('change-linehead', seekPos) } }, computed: { calculateSize () { - let value = this.percentage < 1 ? this.percentage * 100 : this.percentage + const value = this.percentage < 1 ? this.percentage * 100 : this.percentage return `${this.rowDirection ? 'width' : 'height'}: ${value}%` } } diff --git a/src/components/player.vue b/src/components/player.vue index e001644..81ea69d 100644 --- a/src/components/player.vue +++ b/src/components/player.vue @@ -1,16 +1,26 @@ - - +-- - - + @click.native="playback"/>