{"version":3,"file":"audio-processor.mjs","sources":["../src/audio-processor.mjs"],"sourcesContent":["class audioProcessor extends AudioWorkletProcessor {\n\tconstructor(...args) {\n\t\tsuper(...args);\n\t\tthis.audioSample = 0;\n\t\tthis.byteSample = 0;\n\t\tthis.drawMode = 'Points';\n\t\tthis.errorDisplayed = true;\n\t\tthis.func = null;\n\t\tthis.getValues = null;\n\t\tthis.isFuncbeat = false;\n\t\tthis.isPlaying = false;\n\t\tthis.lastByteValue = [null, null];\n\t\tthis.lastFuncValue = [null, null];\n\t\tthis.lastTime = -1;\n\t\tthis.outValue = [0, 0];\n\t\tthis.playbackSpeed = 1;\n\t\tthis.sampleRate = 8000;\n\t\tthis.sampleRatio = 1;\n\t\tthis.pitchRatio = 1;   // >1 = pitch up without speed change\n\t\tthis.srDivisor = 1;\n\t\tthis.pcmBuf = new Float32Array(1024);\n\t\tthis.pcmHead = 0;\n\t\tObject.seal(this);\n\t\taudioProcessor.deleteGlobals();\n\t\taudioProcessor.freezeGlobals();\n\t\tthis.port.addEventListener('message', e => this.receiveData(e.data));\n\t\tthis.port.start();\n\t}\n\tstatic deleteGlobals() {\n\t\t// Delete single letter variables to prevent persistent variable errors (covers a good enough range)\n\t\tfor(let i = 0; i < 26; ++i) {\n\t\t\tdelete globalThis[String.fromCharCode(65 + i)];\n\t\t\tdelete globalThis[String.fromCharCode(97 + i)];\n\t\t}\n\t\t// Delete global variables\n\t\tfor(const name in globalThis) {\n\t\t\tif(Object.prototype.hasOwnProperty.call(globalThis, name)) {\n\t\t\t\tdelete globalThis[name];\n\t\t\t}\n\t\t}\n\t}\n\tstatic freezeGlobals() {\n\t\tObject.getOwnPropertyNames(globalThis).forEach(name => {\n\t\t\tconst prop = globalThis[name];\n\t\t\tconst type = typeof prop;\n\t\t\tif((type === 'object' || type === 'function') && name !== 'globalThis') {\n\t\t\t\tObject.freeze(prop);\n\t\t\t}\n\t\t\tif(type === 'function' && Object.prototype.hasOwnProperty.call(prop, 'prototype')) {\n\t\t\t\tObject.freeze(prop.prototype);\n\t\t\t}\n\t\t\tObject.defineProperty(globalThis, name, { writable: false, configurable: false });\n\t\t});\n\t}\n\tstatic getErrorMessage(err, time) {\n\t\tconst when = time === null ? 'compilation' : 't=' + time;\n\t\tif(!(err instanceof Error)) {\n\t\t\treturn `${ when } thrown: ${ typeof err === 'string' ? err : JSON.stringify(err) }`;\n\t\t}\n\t\tconst { message, lineNumber, columnNumber } = err;\n\t\treturn `${ when } error: ${ typeof message === 'string' ? message : JSON.stringify(message) }${\n\t\t\ttypeof lineNumber === 'number' && typeof columnNumber === 'number' ?\n\t\t\t\t` (at line ${ lineNumber - 3 }, character ${ +columnNumber })` : '' }`;\n\t}\n\tprocess(inputs, [chData]) {\n\t\tconst chDataLen = chData[0].length;\n\t\tif(!chDataLen || !this.isPlaying) {\n\t\t\treturn true;\n\t\t}\n\t\tlet time = this.sampleRatio * this.audioSample;\n\t\tlet { byteSample } = this;\n\t\tconst drawBuffer = [];\n\t\tconst isDiagram = this.drawMode === 'Combined' || this.drawMode === 'Diagram';\n\t\tfor(let i = 0; i < chDataLen; ++i) {\n\t\t\ttime += this.sampleRatio;\n\t\t\tconst currentTime = Math.floor(time / this.srDivisor) * this.srDivisor;\n\t\t\tif(this.lastTime !== currentTime) {\n\t\t\t\tlet funcValue;\n\t\t\t\tconst currentSample = Math.floor(byteSample / this.srDivisor) * this.srDivisor;\n\t\t\t\ttry {\n\t\t\t\t\tif(this.isFuncbeat) {\n\t\t\t\t\t\tfuncValue = this.func(currentSample * this.pitchRatio / this.sampleRate, this.sampleRate);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfuncValue = this.func(currentSample * this.pitchRatio);\n\t\t\t\t\t}\n\t\t\t\t} catch(err) {\n\t\t\t\t\tif(this.errorDisplayed) {\n\t\t\t\t\t\tthis.errorDisplayed = false;\n\t\t\t\t\t\tthis.sendData({\n\t\t\t\t\t\t\terror: {\n\t\t\t\t\t\t\t\tmessage: audioProcessor.getErrorMessage(err, currentSample),\n\t\t\t\t\t\t\t\tisRuntime: true\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tfuncValue = NaN;\n\t\t\t\t}\n\t\t\t\tfuncValue = Array.isArray(funcValue) ? [funcValue[0], funcValue[1]] : [funcValue, funcValue];\n\t\t\t\tlet hasValue = false;\n\t\t\t\tlet ch = 2;\n\t\t\t\twhile(ch--) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tfuncValue[ch] = +funcValue[ch];\n\t\t\t\t\t} catch(err) {\n\t\t\t\t\t\tfuncValue[ch] = NaN;\n\t\t\t\t\t}\n\t\t\t\t\tif(isDiagram) {\n\t\t\t\t\t\tif(!isNaN(funcValue[ch])) {\n\t\t\t\t\t\t\tthis.outValue[ch] = this.getValues(funcValue[ch], ch);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.lastByteValue[ch] = NaN;\n\t\t\t\t\t\t}\n\t\t\t\t\t\thasValue = true;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif(funcValue[ch] === this.lastFuncValue[ch]) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else if(!isNaN(funcValue[ch])) {\n\t\t\t\t\t\tthis.outValue[ch] = this.getValues(funcValue[ch], ch);\n\t\t\t\t\t\thasValue = true;\n\t\t\t\t\t} else if(!isNaN(this.lastFuncValue[ch])) {\n\t\t\t\t\t\tthis.lastByteValue[ch] = NaN;\n\t\t\t\t\t\thasValue = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(hasValue) {\n\t\t\t\t\tdrawBuffer.push({ t: currentSample, value: [...this.lastByteValue] });\n\t\t\t\t}\n\t\t\t\tbyteSample += currentTime - this.lastTime;\n\t\t\t\tthis.lastFuncValue = funcValue;\n\t\t\t\tthis.lastTime = currentTime;\n\t\t\t}\n\t\t\tchData[0][i] = this.outValue[0];\n\t\t\tchData[1][i] = this.outValue[1];\n\t\t\t// Accumulate PCM for projectM — write interleaved stereo to a ring buffer.\n\t\t\tlet h = this.pcmHead;\n\t\t\tif (h + 1 < this.pcmBuf.length) {\n\t\t\t\tthis.pcmBuf[h] = this.outValue[0];\n\t\t\t\tthis.pcmBuf[h + 1] = this.outValue[1];\n\t\t\t\tthis.pcmHead = h + 2;\n\t\t\t}\n\t\t}\n\t\tif(Math.abs(byteSample) > Number.MAX_SAFE_INTEGER) {\n\t\t\tthis.resetTime();\n\t\t\treturn true;\n\t\t}\n\t\tthis.audioSample += chDataLen;\n\t\tlet isSend = false;\n\t\tconst data = {};\n\t\tif(byteSample !== this.byteSample) {\n\t\t\tisSend = true;\n\t\t\tdata.byteSample = this.byteSample = byteSample;\n\t\t}\n\t\tif(drawBuffer.length) {\n\t\t\tisSend = true;\n\t\t\tdata.drawBuffer = drawBuffer;\n\t\t}\n\t\tif(this.pcmHead >= 512) {\n\t\t\tisSend = true;\n\t\t\tdata.pcm = this.pcmBuf.slice(0, this.pcmHead);\n\t\t\tthis.pcmHead = 0;\n\t\t}\n\t\tif(isSend) {\n\t\t\tthis.sendData(data);\n\t\t}\n\t\treturn true;\n\t}\n\treceiveData(data) {\n\t\tif(data.byteSample !== undefined) {\n\t\t\tthis.byteSample = +data.byteSample || 0;\n\t\t\tthis.resetValues();\n\t\t}\n\t\tif(data.errorDisplayed === true) {\n\t\t\tthis.errorDisplayed = true;\n\t\t}\n\t\tif(data.isPlaying !== undefined) {\n\t\t\tthis.isPlaying = data.isPlaying;\n\t\t}\n\t\tif(data.srDivisor !== undefined) {\n\t\t\tthis.srDivisor = data.srDivisor;\n\t\t}\n\t\tif(data.playbackSpeed !== undefined) {\n\t\t\tconst sampleRatio = this.sampleRatio / this.playbackSpeed;\n\t\t\tthis.playbackSpeed = data.playbackSpeed;\n\t\t\tthis.setSampleRatio(sampleRatio);\n\t\t}\n\t\tif(data.mode !== undefined) {\n\t\t\tthis.isFuncbeat = data.mode === 'Funcbeat';\n\t\t\tswitch(data.mode) {\n\t\t\tcase 'Bytebeat':\n\t\t\t\tthis.getValues = (funcValue, ch) => (this.lastByteValue[ch] = funcValue & 255) / 127.5 - 1;\n\t\t\t\tbreak;\n\t\t\tcase 'Signed Bytebeat':\n\t\t\t\tthis.getValues = (funcValue, ch) =>\n\t\t\t\t\t(this.lastByteValue[ch] = (funcValue + 128) & 255) / 127.5 - 1;\n\t\t\t\tbreak;\n\t\t\tcase 'Floatbeat':\n\t\t\tcase 'Funcbeat':\n\t\t\t\tthis.getValues = (funcValue, ch) => {\n\t\t\t\t\tconst outValue = Math.max(Math.min(funcValue, 1), -1);\n\t\t\t\t\tthis.lastByteValue[ch] = Math.round((outValue + 1) * 127.5);\n\t\t\t\t\treturn outValue;\n\t\t\t\t};\n\t\t\t\tbreak;\n\t\t\tdefault: this.getValues = (funcValue, ch) => (this.lastByteValue[ch] = NaN);\n\t\t\t}\n\t\t}\n\t\tif(data.drawMode !== undefined) {\n\t\t\tthis.drawMode = data.drawMode;\n\t\t}\n\t\tif(data.setFunction !== undefined) {\n\t\t\tthis.setFunction(data.setFunction);\n\t\t}\n\t\tif(data.resetTime === true) {\n\t\t\tthis.resetTime();\n\t\t}\n\t\tif(data.sampleRate !== undefined) {\n\t\t\tthis.sampleRate = data.sampleRate;\n\t\t}\n\t\tif(data.sampleRatio !== undefined) {\n\t\t\tthis.setSampleRatio(data.sampleRatio);\n\t\t}\n\t\tif(data.pitchRatio !== undefined) {\n\t\t\tthis.pitchRatio = data.pitchRatio;\n\t\t}\n\t}\n\tsendData(data) {\n\t\tthis.port.postMessage(data);\n\t}\n\tresetTime() {\n\t\tthis.byteSample = 0;\n\t\tthis.resetValues();\n\t\tthis.sendData({ byteSample: 0 });\n\t}\n\tresetValues() {\n\t\tthis.audioSample = 0;\n\t\tthis.lastByteValue = this.lastFuncValue = [null, null];\n\t\tthis.lastTime = -1;\n\t\tthis.outValue = [0, 0];\n\t}\n\tsetFunction(codeText) {\n\t\t// Create shortened Math functions\n\t\tconst params = Object.getOwnPropertyNames(Math);\n\t\tconst values = params.map(k => Math[k]);\n\t\tparams.push('int', 'window');\n\t\tvalues.push(Math.floor, globalThis);\n\t\taudioProcessor.deleteGlobals();\n\t\t// Code testing\n\t\tlet isCompiled = false;\n\t\tconst oldFunc = this.func;\n\t\ttry {\n\t\t\tif(this.isFuncbeat) {\n\t\t\t\tthis.func = new Function(...params, codeText).bind(globalThis, ...values);\n\t\t\t} else {\n\t\t\t\t// Optimize code like eval(unescape(escape`XXXX`.replace(/u(..)/g,\"$1%\")))\n\t\t\t\tcodeText = codeText.trim().replace(\n\t\t\t\t\t/^eval\\(unescape\\(escape(?:`|\\('|\\(\"|\\(`)(.*?)(?:`|'\\)|\"\\)|`\\)).replace\\(\\/u\\(\\.\\.\\)\\/g,[\"'`]\\$1%[\"'`]\\)\\)\\)$/,\n\t\t\t\t\t(match, m1) => unescape(escape(m1).replace(/u(..)/g, '$1%')));\n\t\t\t\tthis.func = new Function(...params, 't', `return 0,\\n${ codeText || 0 };`)\n\t\t\t\t\t.bind(globalThis, ...values);\n\t\t\t}\n\t\t\tisCompiled = true;\n\t\t\tif(this.isFuncbeat) {\n\t\t\t\tthis.func = this.func();\n\t\t\t\tthis.func(0, this.sampleRate);\n\t\t\t} else {\n\t\t\t\tthis.func(0);\n\t\t\t}\n\t\t} catch(err) {\n\t\t\tif(!isCompiled) {\n\t\t\t\tthis.func = oldFunc;\n\t\t\t}\n\t\t\tthis.errorDisplayed = false;\n\t\t\tthis.sendData({\n\t\t\t\terror: { message: audioProcessor.getErrorMessage(err, isCompiled ? 0 : null), isCompiled },\n\t\t\t\tupdateUrl: isCompiled\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tthis.errorDisplayed = false;\n\t\tthis.sendData({ error: { message: '', isCompiled }, updateUrl: true });\n\t}\n\tsetSampleRatio(sampleRatio) {\n\t\tconst timeOffset = Math.floor(this.sampleRatio * this.audioSample) - this.lastTime;\n\t\tthis.sampleRatio = sampleRatio * this.playbackSpeed;\n\t\tthis.lastTime = Math.floor(this.sampleRatio * this.audioSample) - timeOffset;\n\t}\n}\n\nregisterProcessor('audioProcessor', audioProcessor);\n"],"names":["audioProcessor","AudioWorkletProcessor","constructor","args","super","this","audioSample","byteSample","drawMode","errorDisplayed","func","getValues","isFuncbeat","isPlaying","lastByteValue","lastFuncValue","lastTime","outValue","playbackSpeed","sampleRate","sampleRatio","pitchRatio","srDivisor","pcmBuf","Float32Array","pcmHead","Object","seal","deleteGlobals","freezeGlobals","port","addEventListener","e","receiveData","data","start","i","globalThis","String","fromCharCode","name","prototype","hasOwnProperty","call","getOwnPropertyNames","forEach","prop","type","freeze","defineProperty","writable","configurable","getErrorMessage","err","time","when","Error","JSON","stringify","message","lineNumber","columnNumber","process","inputs","chData","chDataLen","length","drawBuffer","isDiagram","currentTime","Math","floor","funcValue","currentSample","sendData","error","isRuntime","NaN","Array","isArray","hasValue","ch","isNaN","push","t","value","h","abs","Number","MAX_SAFE_INTEGER","resetTime","isSend","pcm","slice","undefined","resetValues","setSampleRatio","mode","max","min","round","setFunction","postMessage","codeText","params","values","map","k","isCompiled","oldFunc","Function","bind","trim","replace","match","m1","unescape","escape","updateUrl","timeOffset","registerProcessor"],"mappings":"AAAA,MAAMA,UAAuBC,sBAC5B,WAAAC,IAAeC,GACdC,SAASD,GACTE,KAAKC,YAAc,EACnBD,KAAKE,WAAa,EAClBF,KAAKG,SAAW,SAChBH,KAAKI,gBAAiB,EACtBJ,KAAKK,KAAO,KACZL,KAAKM,UAAY,KACjBN,KAAKO,YAAa,EAClBP,KAAKQ,WAAY,EACjBR,KAAKS,cAAgB,CAAC,KAAM,MAC5BT,KAAKU,cAAgB,CAAC,KAAM,MAC5BV,KAAKW,UAAY,EACjBX,KAAKY,SAAW,CAAC,EAAG,GACpBZ,KAAKa,cAAgB,EACrBb,KAAKc,WAAa,IAClBd,KAAKe,YAAc,EACnBf,KAAKgB,WAAa,EAClBhB,KAAKiB,UAAY,EACjBjB,KAAKkB,OAAS,IAAIC,aAAa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