{"version":3,"sources":["webpack:///webpack/bootstrap c61dad805b4c34495429","webpack:///./src/common/transcode.worker.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","self","onmessage","e","transAudioData","transcode","data","[object Object]","audioData","output","to16kHz","to16BitPCM","Array","from","Uint8Array","buffer","postMessage","Float32Array","fitCount","Math","round","length","newData","springFactor","tmp","before","floor","toFixed","after","ceil","atPoint","input","dataLength","dataBuffer","ArrayBuffer","dataView","DataView","offset","max","min","setInt16"],"mappings":"aACA,IAAAA,KAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,IACAG,EAAAH,EACAI,GAAA,EACAH,YAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAF,GAGAG,EAAAE,GAAA,EAGAF,EAAAD,QAKAF,EAAAQ,EAAAF,EAGAN,EAAAS,EAAAV,EAGAC,EAAAU,EAAA,SAAAR,EAAAS,EAAAC,GACAZ,EAAAa,EAAAX,EAAAS,IACAG,OAAAC,eAAAb,EAAAS,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAZ,EAAAmB,EAAA,SAAAhB,GACA,IAAAS,EAAAT,KAAAiB,WACA,WAA2B,OAAAjB,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAH,EAAAU,EAAAE,EAAA,IAAAA,GACAA,GAIAZ,EAAAa,EAAA,SAAAQ,EAAAC,GAAsD,OAAAR,OAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDtB,EAAAyB,EAAA,IAGAzB,IAAA0B,EAAA,6BC5DAC,KAAAC,UAAA,SAAAC,GACAC,EAAAC,UAAAF,EAAAG,OAEA,IAAAF,GACAG,UAAAC,GACA,IAAAC,EAAAL,EAAAM,QAAAF,GACAC,EAAAL,EAAAO,WAAAF,GACAA,EAAAG,MAAAC,KAAA,IAAAC,WAAAL,EAAAM,SACAd,KAAAe,YAAAP,IAGAF,QAAAC,GACA,IAAAF,EAAA,IAAAW,aAAAT,GACAU,EAAAC,KAAAC,MAAAd,EAAAe,QAAA,aACAC,EAAA,IAAAL,aAAAC,GACAK,GAAAjB,EAAAe,OAAA,IAAAH,EAAA,GACAI,EAAA,GAAAhB,EAAA,GACA,QAAA5B,EAAA,EAAyBA,EAAAwC,EAAA,EAAkBxC,IAAA,CAC3C,IAAA8C,EAAA9C,EAAA6C,EACAE,EAAAN,KAAAO,MAAAF,GAAAG,UACAC,EAAAT,KAAAU,KAAAL,GAAAG,UACAG,EAAAN,EAAAC,EACAH,EAAA5C,GAAA4B,EAAAmB,IAAAnB,EAAAsB,GAAAtB,EAAAmB,IAAAK,EAGA,OADAR,EAAAJ,EAAA,GAAAZ,IAAAe,OAAA,GACAC,GAEAf,WAAAwB,GAKA,IAJA,IAAAC,EAAA,EAAAD,EAAAV,OACAY,EAAA,IAAAC,YAAAF,GACAG,EAAA,IAAAC,SAAAH,GACAI,EAAA,EACA3D,EAAA,EAAyBA,EAAAqD,EAAAV,OAAkB3C,IAAA2D,GAAA,GAC3C,IAAArC,EAAAmB,KAAAmB,KAAA,EAAAnB,KAAAoB,IAAA,EAAAR,EAAArD,KACAyD,EAAAK,SAAAH,EAAArC,EAAA,QAAAA,EAAA,MAAAA,GAAA,GAEA,OAAAmC","file":"workerName.c61dad805b4c34495429.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"ePNF\");\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap c61dad805b4c34495429","// (function(){\r\n self.onmessage = function(e){\r\n transAudioData.transcode(e.data)\r\n }\r\n let transAudioData = {\r\n transcode(audioData) {\r\n let output = transAudioData.to16kHz(audioData)\r\n output = transAudioData.to16BitPCM(output)\r\n output = Array.from(new Uint8Array(output.buffer))\r\n self.postMessage(output)\r\n // return output\r\n },\r\n to16kHz(audioData) {\r\n var data = new Float32Array(audioData)\r\n var fitCount = Math.round(data.length * (16000 / 44100))\r\n var newData = new Float32Array(fitCount)\r\n var springFactor = (data.length - 1) / (fitCount - 1)\r\n newData[0] = data[0]\r\n for (let i = 1; i < fitCount - 1; i++) {\r\n var tmp = i * springFactor\r\n var before = Math.floor(tmp).toFixed()\r\n var after = Math.ceil(tmp).toFixed()\r\n var atPoint = tmp - before\r\n newData[i] = data[before] + (data[after] - data[before]) * atPoint\r\n }\r\n newData[fitCount - 1] = data[data.length - 1]\r\n return newData\r\n },\r\n to16BitPCM(input) {\r\n var dataLength = input.length * (16 / 8)\r\n var dataBuffer = new ArrayBuffer(dataLength)\r\n var dataView = new DataView(dataBuffer)\r\n var offset = 0\r\n for (var i = 0; i < input.length; i++, offset += 2) {\r\n var s = Math.max(-1, Math.min(1, input[i]))\r\n dataView.setInt16(offset, s < 0 ? s * 0x8000 : s * 0x7fff, true)\r\n }\r\n return dataView\r\n },\r\n }\r\n // })()\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/common/transcode.worker.js\n// module id = ePNF\n// module chunks = 0"],"sourceRoot":""}