1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="347509a0-ac71-442b-a628-96f3b0ba0d68",e._sentryDebugIdIdentifier="sentry-dbid-347509a0-ac71-442b-a628-96f3b0ba0d68")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9752],{9752:function(e,t,a){a.r(t),a.d(t,{default:function(){return y},processFrequencyShifterRegion:function(){return p}});var l=a(5893),n=a(7294),s=a(9299),r=a(653),o=a(6982),i=a(2868),c=a(7795),h=a(679),f=a(9690),d=a(4871),u=a(7611),m=a(3753),g=a(9793);class b{forward(e){let t=this.size,a=new Float32Array(2*t);for(let l=0;l<t;l++)a[2*this.reverseTable[l]]=e[l],a[2*this.reverseTable[l]+1]=0;let l=1;for(;l<t;){let e=t/l,n=0;for(let s=0;s<t;s+=2*l){n=0;for(let t=0;t<l;t++){let r=a[(s+t)*2],o=a[(s+t)*2+1],i=a[(s+t+l)*2],c=a[(s+t+l)*2+1],h=this.cos[n]*i-this.sin[n]*c,f=this.cos[n]*c+this.sin[n]*i;a[(s+t)*2]=r+h,a[(s+t)*2+1]=o+f,a[(s+t+l)*2]=r-h,a[(s+t+l)*2+1]=o-f,n+=e}}l<<=1}return a}inverse(e){let t=this.size,a=new Float32Array(2*t);for(let l=0;l<2*t;l+=2)a[l]=e[l],a[l+1]=-e[l+1];let l=this.forward(a);for(let e=0;e<2*t;e++)l[e]*=this.invSize;return l}constructor(e){this.size=e,this.invSize=1/e,this.reverseTable=new Uint32Array(e);let t=1,a=e>>1;for(;t<e;){for(let e=0;e<t;e++)this.reverseTable[e+t]=this.reverseTable[e]+a;t<<=1,a>>=1}this.sin=new Float32Array(e),this.cos=new Float32Array(e);for(let t=0;t<e;t++)this.sin[t]=Math.sin(-Math.PI*t/e),this.cos[t]=Math.cos(-Math.PI*t/e)}}async function p(e,t,a,l){let n=new(window.AudioContext||window.webkitAudioContext),s=e.sampleRate,r=a-t,o=n.createBuffer(e.numberOfChannels,r,s);for(let a=0;a<e.numberOfChannels;a++){let n=e.getChannelData(a),i=o.getChannelData(a),c=new Float32Array(r);for(let e=0;e<r;e++)c[e]=n[t+e];let h=new Float32Array(r),f=new Float32Array(4096);for(let e=0;e<4096;e++)f[e]=.5-.5*Math.cos(2*Math.PI*e/4095);for(let e=0;e<r-4096;e+=3072){let t=new Float32Array(4096);for(let a=0;a<4096;a++)e+a<r&&(t[a]=c[e+a]*f[a]);let a=function(e){let t=e.length,a=new b(t),l=a.forward(e);for(let e=1;e<t/2;e++)l[2*e]*=2,l[2*e+1]*=2;for(let e=t/2+1;e<t;e++)l[2*e]=0,l[2*e+1]=0;let n=a.inverse(l),s=new Float32Array(t);for(let e=0;e<t;e++)s[e]=n[2*e+1];return s}(t),n=l.amount||0,o=l.direction||"up";for(let l=0;l<4096;l++){let i;let c=(e+l)/s,d=Math.cos(2*Math.PI*n*c),u=Math.sin(2*Math.PI*n*c);i="up"===o||"both"===o?t[l]*d-a[l]*u:t[l]*d+a[l]*u,"both"===o&&(i=(i+(t[l]*d+a[l]*u))*.5),e+l<r&&(h[e+l]+=i*f[l])}}let d=0;for(let e=0;e<r;e++)d=Math.max(d,Math.abs(h[e]));if(d>0)for(let e=0;e<r;e++)h[e]/=d;if((l.feedback||0)>0){let e=new Float32Array(r),t=Math.floor(.1*s);for(let a=0;a<r;a++)e[a]=h[a],a>=t&&(e[a]+=e[a-t]*(l.feedback||0));for(let t=0;t<r;t++)h[t]=e[t]}for(let e=0;e<r;e++){let t=c[e],a=h[e];i[e]=t*(1-(l.mix||.5))+a*(l.mix||.5)}}return o}function y(e){var t;let{width:a,onApply:b}=e,{audioRef:y,addToEditHistory:x,audioURL:w}=(0,u.QV)(),{audioBuffer:M,applyProcessedAudio:v,activeRegion:j,audioContext:k}=(0,u.Pv)(),{freqShiftAmount:Z,setFreqShiftAmount:A,freqShiftMix:C,setFreqShiftMix:z,freqShiftFeedback:F,setFreqShiftFeedback:N,freqShiftDirection:P,setFreqShiftDirection:D,cutRegion:I}=(0,u.sv)(),O=(0,n.useRef)(null);(0,n.useEffect)(()=>{O.current||(O.current=new(window.AudioContext||window.webkitAudioContext))},[]);let R=(0,n.useCallback)((0,m.mq)(p,{audioBuffer:M,activeRegion:j,cutRegion:I,applyProcessedAudio:v,audioContext:k,parameters:{amount:Z,mix:C,feedback:F,direction:P||"up"},onApply:b}),[M,j,I,v,k,Z,C,F,P,b]),q=[{key:"up",name:"Up"},{key:"down",name:"Down"},{key:"both",name:"Both"}];return(0,l.jsx)(s.Z,{fluid:!0,className:"p-2",children:(0,l.jsxs)(r.Z,{className:"text-center align-items-end",children:[(0,l.jsxs)(o.Z,{xs:12,sm:6,md:3,lg:2,className:"mb-2",children:[(0,l.jsx)(i.Z.Label,{className:"text-white small mb-1",children:"Direction"}),(0,l.jsxs)(c.Z,{onSelect:e=>D(e),size:"sm",children:[(0,l.jsx)(c.Z.Toggle,{variant:"secondary",size:"sm",className:"w-100",children:(null===(t=q.find(e=>e.key===(P||"up")))||void 0===t?void 0:t.name)||"Up"}),(0,l.jsx)(c.Z.Menu,{className:"bg-daw-toolbars",children:q.map(e=>(0,l.jsx)(c.Z.Item,{eventKey:e.key,className:"text-white",children:e.name},e.key))})]})]}),(0,l.jsx)(o.Z,{xs:6,sm:4,md:2,lg:1,children:(0,l.jsx)(h.Z,{placement:"top",delay:{show:1500,hide:250},overlay:(0,l.jsx)(f.Z,{children:"Amount to shift all frequencies linearly. Unlike pitch shifting, this creates inharmonic, metallic tone
1s. 50-200Hz creates subtle dissonance, 500Hz+ creates alien effects."}),children:(0,l.jsx)("div",{children:(0,l.jsx)(g.Z,{value:Z,onChange:A,min:-500,max:500,step:1,label:"Shift",displayValue:"".concat(Z>0?"+":"").concat(Z,"Hz"),size:45,color:"#e75b5c"})})})}),(0,l.jsx)(o.Z,{xs:6,sm:4,md:2,lg:1,children:(0,l.jsx)(h.Z,{placement:"top",delay:{show:1500,hide:250},overlay:(0,l.jsx)(f.Z,{children:"Balance between dry and wet signal. Lower values (20-50%) add subtle shimmer and movement. Higher values (70-100%) create complete transformation."}),children:(0,l.jsx)("div",{children:(0,l.jsx)(g.Z,{value:C,onChange:z,min:0,max:1,label:"Mix",displayValue:"".concat(Math.round(100*C),"%"),size:45,color:"#7bafd4"})})})}),(0,l.jsx)(o.Z,{xs:6,sm:4,md:2,lg:1,children:(0,l.jsx)(h.Z,{placement:"top",delay:{show:1500,hide:250},overlay:(0,l.jsx)(f.Z,{children:"Routes output back through the shifter. Creates cascading frequency shifts and resonances. Use sparingly (10-40%) as it intensifies the effect dramatically."}),children:(0,l.jsx)("div",{children:(0,l.jsx)(g.Z,{value:F,onChange:N,min:0,max:.9,label:"Feedback",displayValue:"".concat(Math.round(100*F),"%"),size:45,color:"#cbb677"})})})}),(0,l.jsx)(o.Z,{xs:12,sm:6,md:3,lg:2,className:"mb-2",children:(0,l.jsx)(d.Z,{size:"sm",className:"w-100",onClick:R,children:"Apply to Region"})})]})})}},3753:function(e,t,a){a.d(t,{mq:function(){return n}});var l=a(9186);function n(e,t){return async()=>{let{audioBuffer:a,activeRegion:n,cutRegion:s,applyProcessedAudio:r,audioContext:o,parameters:i,onApply:c}=t,h=n||s;if(!h||!a){alert("Please select a region first");return}try{let t=a.sampleRate,n=Math.floor(h.start*t),s=Math.floor(h.end*t),f=a.getChannelData(0),d=0,u=0,m=0;for(let e=n;e<Math.min(n+1e4,s);e++){let t=f[e];d+=t*t,u=Math.max(u,Math.abs(t)),Math.abs(t)>1e-30&&m++}let g=Math.sqrt(d/Math.min(1e4,s-n));console.log("Original region RMS:",g),console.log("Original region max amplitude:",u),console.log("Original region non-zero samples:",m,"out of",Math.min(1e4,s-n));let b=-1;for(let e=n;e<s;e++)if(Math.abs(f[e])>1e-30){b=e;break}-1!==b&&(console.log("First non-zero sample at index:",b-n),console.log("First non-zero value:",f[b]));let p=[];for(let e=n;e<n+5&&e<s;e++){let t=f[e];p.push(1e-30>Math.abs(t)?0:t)}console.log("Original region first 5 samples (cleaned):",p);let y=await e(a,n,s,i);console.log("Effect processed region:",y),console.log("Region length:",y.length,"samples");let x=y.getChannelData(0),w=0,M=0;for(let e=0;e<Math.min(1e4,x.length);e++)w+=x[e]*x[e],M=Math.max(M,Math.abs(x[e]));let v=Math.sqrt(w/Math.min(1e4,x.length));console.log("Processed region RMS:",v),console.log("Processed region max amplitude:",M),console.log("Processed region first 5 samples:",Array.from(x.slice(0,5)));let j=(0,l.tl)(a,y,h.start,h.end,o);console.log("Output buffer after replacing region:",j),console.log("Output buffer length:",j.length,"samples");let k=j.getChannelData(0),Z=0;for(let e=0;e<Math.min(1e4,k.length);e++)Z+=k[e]*k[e];let A=Math.sqrt(Z/Math.min(1e4,k.length));return console.log("Output buffer RMS before passing to applyProcessedAudio:",A),console.log("Output buffer first 5 samples:",Array.from(k.slice(0,5))),i&&i.effectName&&(j.effectName=i.effectName),await r(j),c&&c(),!0}catch(e){return console.error("Error applying effect:",e),alert("Error applying effect. Please try again."),!1}}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.