├── LICENSE ├── README.md ├── index.html ├── rnnoise-COPYING ├── rnnoise-LICENSE ├── rnnoise.js └── rnnoise.wasm /LICENSE: -------------------------------------------------------------------------------- 1 | Creative Commons Legal Code 2 | 3 | CC0 1.0 Universal 4 | 5 | CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE 6 | LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN 7 | ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS 8 | INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES 9 | REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS 10 | PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM 11 | THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED 12 | HEREUNDER. 13 | 14 | Statement of Purpose 15 | 16 | The laws of most jurisdictions throughout the world automatically confer 17 | exclusive Copyright and Related Rights (defined below) upon the creator 18 | and subsequent owner(s) (each and all, an "owner") of an original work of 19 | authorship and/or a database (each, a "Work"). 20 | 21 | Certain owners wish to permanently relinquish those rights to a Work for 22 | the purpose of contributing to a commons of creative, cultural and 23 | scientific works ("Commons") that the public can reliably and without fear 24 | of later claims of infringement build upon, modify, incorporate in other 25 | works, reuse and redistribute as freely as possible in any form whatsoever 26 | and for any purposes, including without limitation commercial purposes. 27 | These owners may contribute to the Commons to promote the ideal of a free 28 | culture and the further production of creative, cultural and scientific 29 | works, or to gain reputation or greater distribution for their Work in 30 | part through the use and efforts of others. 31 | 32 | For these and/or other purposes and motivations, and without any 33 | expectation of additional consideration or compensation, the person 34 | associating CC0 with a Work (the "Affirmer"), to the extent that he or she 35 | is an owner of Copyright and Related Rights in the Work, voluntarily 36 | elects to apply CC0 to the Work and publicly distribute the Work under its 37 | terms, with knowledge of his or her Copyright and Related Rights in the 38 | Work and the meaning and intended legal effect of CC0 on those rights. 39 | 40 | 1. Copyright and Related Rights. A Work made available under CC0 may be 41 | protected by copyright and related or neighboring rights ("Copyright and 42 | Related Rights"). Copyright and Related Rights include, but are not 43 | limited to, the following: 44 | 45 | i. the right to reproduce, adapt, distribute, perform, display, 46 | communicate, and translate a Work; 47 | ii. moral rights retained by the original author(s) and/or performer(s); 48 | iii. publicity and privacy rights pertaining to a person's image or 49 | likeness depicted in a Work; 50 | iv. rights protecting against unfair competition in regards to a Work, 51 | subject to the limitations in paragraph 4(a), below; 52 | v. rights protecting the extraction, dissemination, use and reuse of data 53 | in a Work; 54 | vi. database rights (such as those arising under Directive 96/9/EC of the 55 | European Parliament and of the Council of 11 March 1996 on the legal 56 | protection of databases, and under any national implementation 57 | thereof, including any amended or successor version of such 58 | directive); and 59 | vii. other similar, equivalent or corresponding rights throughout the 60 | world based on applicable law or treaty, and any national 61 | implementations thereof. 62 | 63 | 2. Waiver. To the greatest extent permitted by, but not in contravention 64 | of, applicable law, Affirmer hereby overtly, fully, permanently, 65 | irrevocably and unconditionally waives, abandons, and surrenders all of 66 | Affirmer's Copyright and Related Rights and associated claims and causes 67 | of action, whether now known or unknown (including existing as well as 68 | future claims and causes of action), in the Work (i) in all territories 69 | worldwide, (ii) for the maximum duration provided by applicable law or 70 | treaty (including future time extensions), (iii) in any current or future 71 | medium and for any number of copies, and (iv) for any purpose whatsoever, 72 | including without limitation commercial, advertising or promotional 73 | purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each 74 | member of the public at large and to the detriment of Affirmer's heirs and 75 | successors, fully intending that such Waiver shall not be subject to 76 | revocation, rescission, cancellation, termination, or any other legal or 77 | equitable action to disrupt the quiet enjoyment of the Work by the public 78 | as contemplated by Affirmer's express Statement of Purpose. 79 | 80 | 3. Public License Fallback. Should any part of the Waiver for any reason 81 | be judged legally invalid or ineffective under applicable law, then the 82 | Waiver shall be preserved to the maximum extent permitted taking into 83 | account Affirmer's express Statement of Purpose. In addition, to the 84 | extent the Waiver is so judged Affirmer hereby grants to each affected 85 | person a royalty-free, non transferable, non sublicensable, non exclusive, 86 | irrevocable and unconditional license to exercise Affirmer's Copyright and 87 | Related Rights in the Work (i) in all territories worldwide, (ii) for the 88 | maximum duration provided by applicable law or treaty (including future 89 | time extensions), (iii) in any current or future medium and for any number 90 | of copies, and (iv) for any purpose whatsoever, including without 91 | limitation commercial, advertising or promotional purposes (the 92 | "License"). The License shall be deemed effective as of the date CC0 was 93 | applied by Affirmer to the Work. Should any part of the License for any 94 | reason be judged legally invalid or ineffective under applicable law, such 95 | partial invalidity or ineffectiveness shall not invalidate the remainder 96 | of the License, and in such case Affirmer hereby affirms that he or she 97 | will not (i) exercise any of his or her remaining Copyright and Related 98 | Rights in the Work or (ii) assert any associated claims and causes of 99 | action with respect to the Work, in either case contrary to Affirmer's 100 | express Statement of Purpose. 101 | 102 | 4. Limitations and Disclaimers. 103 | 104 | a. No trademark or patent rights held by Affirmer are waived, abandoned, 105 | surrendered, licensed or otherwise affected by this document. 106 | b. Affirmer offers the Work as-is and makes no representations or 107 | warranties of any kind concerning the Work, express, implied, 108 | statutory or otherwise, including without limitation warranties of 109 | title, merchantability, fitness for a particular purpose, non 110 | infringement, or the absence of latent or other defects, accuracy, or 111 | the present or absence of errors, whether or not discoverable, all to 112 | the greatest extent permissible under applicable law. 113 | c. Affirmer disclaims responsibility for clearing rights of other persons 114 | that may apply to the Work or any use thereof, including without 115 | limitation any person's Copyright and Related Rights in the Work. 116 | Further, Affirmer disclaims responsibility for obtaining any necessary 117 | consents, permissions or other rights required for any use of the 118 | Work. 119 | d. Affirmer understands and acknowledges that Creative Commons is not a 120 | party to this document and has no duty or obligation with respect to 121 | this CC0 or use of the Work. 122 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [click here for demo](https://raw.githack.com/Meshiest/rnnoise-demo/master/index.html) 2 | 3 | ### rnnoise-wasm demo 4 | 5 | This is a demo using the not at all documented [rnnoise-wasm](https://github.com/jitsi/rnnoise-wasm) dist to determine if input audio is voice. This also demonstrates rendering a simple live frequency chart for audio. 6 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 141 | -------------------------------------------------------------------------------- /rnnoise-COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017, Mozilla 2 | Copyright (c) 2007-2017, Jean-Marc Valin 3 | Copyright (c) 2005-2017, Xiph.Org Foundation 4 | Copyright (c) 2003-2004, Mark Borgerding 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | - Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | 13 | - Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in the 15 | documentation and/or other materials provided with the distribution. 16 | 17 | - Neither the name of the Xiph.Org Foundation nor the names of its 18 | contributors may be used to endorse or promote products derived from 19 | this software without specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION 25 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /rnnoise-LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | 204 | 205 | 206 | Note: 207 | 208 | This project was originally contributed to the community under the MIT license and with the following notice: 209 | 210 | The MIT License (MIT) 211 | 212 | Copyright (c) 2013 ESTOS GmbH 213 | Copyright (c) 2013 BlueJimp SARL 214 | 215 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 216 | 217 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 218 | 219 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /rnnoise.js: -------------------------------------------------------------------------------- 1 | var Module = (function() { 2 | var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined; 3 | 4 | return ( 5 | function(Module) { 6 | Module = Module || {}; 7 | 8 | null; 9 | var Module = typeof Module !== "undefined" ? Module : {}; 10 | var readyPromiseResolve, readyPromiseReject; 11 | Module["ready"] = new Promise(function(resolve, reject) { 12 | readyPromiseResolve = resolve; 13 | readyPromiseReject = reject 14 | }); 15 | var moduleOverrides = {}; 16 | var key; 17 | for (key in Module) { 18 | if (Module.hasOwnProperty(key)) { 19 | moduleOverrides[key] = Module[key] 20 | } 21 | } 22 | var arguments_ = []; 23 | var thisProgram = "./this.program"; 24 | var quit_ = function(status, toThrow) { 25 | throw toThrow 26 | }; 27 | var ENVIRONMENT_IS_WEB = false; 28 | var ENVIRONMENT_IS_WORKER = false; 29 | var ENVIRONMENT_IS_NODE = false; 30 | var ENVIRONMENT_IS_SHELL = false; 31 | ENVIRONMENT_IS_WEB = typeof window === "object"; 32 | ENVIRONMENT_IS_WORKER = typeof importScripts === "function"; 33 | ENVIRONMENT_IS_NODE = typeof process === "object" && typeof process.versions === "object" && typeof process.versions.node === "string"; 34 | ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER; 35 | var scriptDirectory = ""; 36 | 37 | function locateFile(path) { 38 | if (Module["locateFile"]) { 39 | return Module["locateFile"](path, scriptDirectory) 40 | } 41 | return scriptDirectory + path 42 | } 43 | var read_, readAsync, readBinary, setWindowTitle; 44 | if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { 45 | if (ENVIRONMENT_IS_WORKER) { 46 | scriptDirectory = self.location.href 47 | } else if (document.currentScript) { 48 | scriptDirectory = document.currentScript.src 49 | } 50 | if (_scriptDir) { 51 | scriptDirectory = _scriptDir 52 | } 53 | if (scriptDirectory.indexOf("blob:") !== 0) { 54 | scriptDirectory = scriptDirectory.substr(0, scriptDirectory.lastIndexOf("/") + 1) 55 | } else { 56 | scriptDirectory = "" 57 | } { 58 | read_ = function shell_read(url) { 59 | var xhr = new XMLHttpRequest; 60 | xhr.open("GET", url, false); 61 | xhr.send(null); 62 | return xhr.responseText 63 | }; 64 | if (ENVIRONMENT_IS_WORKER) { 65 | readBinary = function readBinary(url) { 66 | var xhr = new XMLHttpRequest; 67 | xhr.open("GET", url, false); 68 | xhr.responseType = "arraybuffer"; 69 | xhr.send(null); 70 | return new Uint8Array(xhr.response) 71 | } 72 | } 73 | readAsync = function readAsync(url, onload, onerror) { 74 | var xhr = new XMLHttpRequest; 75 | xhr.open("GET", url, true); 76 | xhr.responseType = "arraybuffer"; 77 | xhr.onload = function xhr_onload() { 78 | if (xhr.status == 200 || xhr.status == 0 && xhr.response) { 79 | onload(xhr.response); 80 | return 81 | } 82 | onerror() 83 | }; 84 | xhr.onerror = onerror; 85 | xhr.send(null) 86 | } 87 | } 88 | setWindowTitle = function(title) { 89 | document.title = title 90 | } 91 | } else {} 92 | var out = Module["print"] || console.log.bind(console); 93 | var err = Module["printErr"] || console.warn.bind(console); 94 | for (key in moduleOverrides) { 95 | if (moduleOverrides.hasOwnProperty(key)) { 96 | Module[key] = moduleOverrides[key] 97 | } 98 | } 99 | moduleOverrides = null; 100 | if (Module["arguments"]) arguments_ = Module["arguments"]; 101 | if (Module["thisProgram"]) thisProgram = Module["thisProgram"]; 102 | if (Module["quit"]) quit_ = Module["quit"]; 103 | var wasmBinary; 104 | if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"]; 105 | var noExitRuntime; 106 | if (Module["noExitRuntime"]) noExitRuntime = Module["noExitRuntime"]; 107 | if (typeof WebAssembly !== "object") { 108 | err("no native wasm support detected") 109 | } 110 | var wasmMemory; 111 | var wasmTable = new WebAssembly.Table({ 112 | "initial": 1, 113 | "maximum": 1 + 0, 114 | "element": "anyfunc" 115 | }); 116 | var ABORT = false; 117 | var EXITSTATUS = 0; 118 | var WASM_PAGE_SIZE = 65536; 119 | 120 | function alignUp(x, multiple) { 121 | if (x % multiple > 0) { 122 | x += multiple - x % multiple 123 | } 124 | return x 125 | } 126 | var buffer, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64; 127 | 128 | function updateGlobalBufferAndViews(buf) { 129 | buffer = buf; 130 | Module["HEAP8"] = HEAP8 = new Int8Array(buf); 131 | Module["HEAP16"] = HEAP16 = new Int16Array(buf); 132 | Module["HEAP32"] = HEAP32 = new Int32Array(buf); 133 | Module["HEAPU8"] = HEAPU8 = new Uint8Array(buf); 134 | Module["HEAPU16"] = HEAPU16 = new Uint16Array(buf); 135 | Module["HEAPU32"] = HEAPU32 = new Uint32Array(buf); 136 | Module["HEAPF32"] = HEAPF32 = new Float32Array(buf); 137 | Module["HEAPF64"] = HEAPF64 = new Float64Array(buf) 138 | } 139 | var DYNAMIC_BASE = 5340496, 140 | DYNAMICTOP_PTR = 97456; 141 | var INITIAL_INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 16777216; 142 | if (Module["wasmMemory"]) { 143 | wasmMemory = Module["wasmMemory"] 144 | } else { 145 | wasmMemory = new WebAssembly.Memory({ 146 | "initial": INITIAL_INITIAL_MEMORY / WASM_PAGE_SIZE, 147 | "maximum": 2147483648 / WASM_PAGE_SIZE 148 | }) 149 | } 150 | if (wasmMemory) { 151 | buffer = wasmMemory.buffer 152 | } 153 | INITIAL_INITIAL_MEMORY = buffer.byteLength; 154 | updateGlobalBufferAndViews(buffer); 155 | HEAP32[DYNAMICTOP_PTR >> 2] = DYNAMIC_BASE; 156 | 157 | function callRuntimeCallbacks(callbacks) { 158 | while (callbacks.length > 0) { 159 | var callback = callbacks.shift(); 160 | if (typeof callback == "function") { 161 | callback(Module); 162 | continue 163 | } 164 | var func = callback.func; 165 | if (typeof func === "number") { 166 | if (callback.arg === undefined) { 167 | Module["dynCall_v"](func) 168 | } else { 169 | Module["dynCall_vi"](func, callback.arg) 170 | } 171 | } else { 172 | func(callback.arg === undefined ? null : callback.arg) 173 | } 174 | } 175 | } 176 | var __ATPRERUN__ = []; 177 | var __ATINIT__ = []; 178 | var __ATMAIN__ = []; 179 | var __ATPOSTRUN__ = []; 180 | var runtimeInitialized = false; 181 | 182 | function preRun() { 183 | if (Module["preRun"]) { 184 | if (typeof Module["preRun"] == "function") Module["preRun"] = [Module["preRun"]]; 185 | while (Module["preRun"].length) { 186 | addOnPreRun(Module["preRun"].shift()) 187 | } 188 | } 189 | callRuntimeCallbacks(__ATPRERUN__) 190 | } 191 | 192 | function initRuntime() { 193 | runtimeInitialized = true; 194 | callRuntimeCallbacks(__ATINIT__) 195 | } 196 | 197 | function preMain() { 198 | callRuntimeCallbacks(__ATMAIN__) 199 | } 200 | 201 | function postRun() { 202 | if (Module["postRun"]) { 203 | if (typeof Module["postRun"] == "function") Module["postRun"] = [Module["postRun"]]; 204 | while (Module["postRun"].length) { 205 | addOnPostRun(Module["postRun"].shift()) 206 | } 207 | } 208 | callRuntimeCallbacks(__ATPOSTRUN__) 209 | } 210 | 211 | function addOnPreRun(cb) { 212 | __ATPRERUN__.unshift(cb) 213 | } 214 | 215 | function addOnPostRun(cb) { 216 | __ATPOSTRUN__.unshift(cb) 217 | } 218 | var runDependencies = 0; 219 | var runDependencyWatcher = null; 220 | var dependenciesFulfilled = null; 221 | 222 | function addRunDependency(id) { 223 | runDependencies++; 224 | if (Module["monitorRunDependencies"]) { 225 | Module["monitorRunDependencies"](runDependencies) 226 | } 227 | } 228 | 229 | function removeRunDependency(id) { 230 | runDependencies--; 231 | if (Module["monitorRunDependencies"]) { 232 | Module["monitorRunDependencies"](runDependencies) 233 | } 234 | if (runDependencies == 0) { 235 | if (runDependencyWatcher !== null) { 236 | clearInterval(runDependencyWatcher); 237 | runDependencyWatcher = null 238 | } 239 | if (dependenciesFulfilled) { 240 | var callback = dependenciesFulfilled; 241 | dependenciesFulfilled = null; 242 | callback() 243 | } 244 | } 245 | } 246 | Module["preloadedImages"] = {}; 247 | Module["preloadedAudios"] = {}; 248 | 249 | function abort(what) { 250 | if (Module["onAbort"]) { 251 | Module["onAbort"](what) 252 | } 253 | what += ""; 254 | out(what); 255 | err(what); 256 | ABORT = true; 257 | EXITSTATUS = 1; 258 | what = "abort(" + what + "). Build with -s ASSERTIONS=1 for more info."; 259 | throw new WebAssembly.RuntimeError(what) 260 | } 261 | 262 | function hasPrefix(str, prefix) { 263 | return String.prototype.startsWith ? str.startsWith(prefix) : str.indexOf(prefix) === 0 264 | } 265 | var dataURIPrefix = "data:application/octet-stream;base64,"; 266 | 267 | function isDataURI(filename) { 268 | return hasPrefix(filename, dataURIPrefix) 269 | } 270 | var wasmBinaryFile = "rnnoise.wasm"; 271 | if (!isDataURI(wasmBinaryFile)) { 272 | wasmBinaryFile = locateFile(wasmBinaryFile) 273 | } 274 | 275 | function getBinary() { 276 | try { 277 | if (wasmBinary) { 278 | return new Uint8Array(wasmBinary) 279 | } 280 | if (readBinary) { 281 | return readBinary(wasmBinaryFile) 282 | } else { 283 | throw "both async and sync fetching of the wasm failed" 284 | } 285 | } catch (err) { 286 | abort(err) 287 | } 288 | } 289 | 290 | function getBinaryPromise() { 291 | if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) && typeof fetch === "function") { 292 | return fetch(wasmBinaryFile, { 293 | credentials: "same-origin" 294 | }).then(function(response) { 295 | if (!response["ok"]) { 296 | throw "failed to load wasm binary file at '" + wasmBinaryFile + "'" 297 | } 298 | return response["arrayBuffer"]() 299 | }).catch(function() { 300 | return getBinary() 301 | }) 302 | } 303 | return new Promise(function(resolve, reject) { 304 | resolve(getBinary()) 305 | }) 306 | } 307 | 308 | function createWasm() { 309 | var info = { 310 | "a": asmLibraryArg 311 | }; 312 | 313 | function receiveInstance(instance, module) { 314 | var exports = instance.exports; 315 | Module["asm"] = exports; 316 | removeRunDependency("wasm-instantiate") 317 | } 318 | addRunDependency("wasm-instantiate"); 319 | 320 | function receiveInstantiatedSource(output) { 321 | receiveInstance(output["instance"]) 322 | } 323 | 324 | function instantiateArrayBuffer(receiver) { 325 | return getBinaryPromise().then(function(binary) { 326 | return WebAssembly.instantiate(binary, info) 327 | }).then(receiver, function(reason) { 328 | err("failed to asynchronously prepare wasm: " + reason); 329 | abort(reason) 330 | }) 331 | } 332 | 333 | function instantiateAsync() { 334 | if (!wasmBinary && typeof WebAssembly.instantiateStreaming === "function" && !isDataURI(wasmBinaryFile) && typeof fetch === "function") { 335 | fetch(wasmBinaryFile, { 336 | credentials: "same-origin" 337 | }).then(function(response) { 338 | var result = WebAssembly.instantiateStreaming(response, info); 339 | return result.then(receiveInstantiatedSource, function(reason) { 340 | err("wasm streaming compile failed: " + reason); 341 | err("falling back to ArrayBuffer instantiation"); 342 | return instantiateArrayBuffer(receiveInstantiatedSource) 343 | }) 344 | }) 345 | } else { 346 | return instantiateArrayBuffer(receiveInstantiatedSource) 347 | } 348 | } 349 | if (Module["instantiateWasm"]) { 350 | try { 351 | var exports = Module["instantiateWasm"](info, receiveInstance); 352 | return exports 353 | } catch (e) { 354 | err("Module.instantiateWasm callback failed with error: " + e); 355 | return false 356 | } 357 | } 358 | instantiateAsync(); 359 | return {} 360 | } 361 | __ATINIT__.push({ 362 | func: function() { 363 | ___wasm_call_ctors() 364 | } 365 | }); 366 | 367 | function _emscripten_memcpy_big(dest, src, num) { 368 | HEAPU8.copyWithin(dest, src, src + num) 369 | } 370 | 371 | function _emscripten_get_heap_size() { 372 | return HEAPU8.length 373 | } 374 | 375 | function emscripten_realloc_buffer(size) { 376 | try { 377 | wasmMemory.grow(size - buffer.byteLength + 65535 >>> 16); 378 | updateGlobalBufferAndViews(wasmMemory.buffer); 379 | return 1 380 | } catch (e) {} 381 | } 382 | 383 | function _emscripten_resize_heap(requestedSize) { 384 | requestedSize = requestedSize >>> 0; 385 | var oldSize = _emscripten_get_heap_size(); 386 | var PAGE_MULTIPLE = 65536; 387 | var maxHeapSize = 2147483648; 388 | if (requestedSize > maxHeapSize) { 389 | return false 390 | } 391 | var minHeapSize = 16777216; 392 | for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { 393 | var overGrownHeapSize = oldSize * (1 + .2 / cutDown); 394 | overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296); 395 | var newSize = Math.min(maxHeapSize, alignUp(Math.max(minHeapSize, requestedSize, overGrownHeapSize), PAGE_MULTIPLE)); 396 | var replacement = emscripten_realloc_buffer(newSize); 397 | if (replacement) { 398 | return true 399 | } 400 | } 401 | return false 402 | } 403 | var asmLibraryArg = { 404 | "a": _emscripten_memcpy_big, 405 | "b": _emscripten_resize_heap, 406 | "memory": wasmMemory, 407 | "table": wasmTable 408 | }; 409 | var asm = createWasm(); 410 | var ___wasm_call_ctors = Module["___wasm_call_ctors"] = function() { 411 | return (___wasm_call_ctors = Module["___wasm_call_ctors"] = Module["asm"]["c"]).apply(null, arguments) 412 | }; 413 | var _rnnoise_init = Module["_rnnoise_init"] = function() { 414 | return (_rnnoise_init = Module["_rnnoise_init"] = Module["asm"]["d"]).apply(null, arguments) 415 | }; 416 | var _rnnoise_create = Module["_rnnoise_create"] = function() { 417 | return (_rnnoise_create = Module["_rnnoise_create"] = Module["asm"]["e"]).apply(null, arguments) 418 | }; 419 | var _malloc = Module["_malloc"] = function() { 420 | return (_malloc = Module["_malloc"] = Module["asm"]["f"]).apply(null, arguments) 421 | }; 422 | var _rnnoise_destroy = Module["_rnnoise_destroy"] = function() { 423 | return (_rnnoise_destroy = Module["_rnnoise_destroy"] = Module["asm"]["g"]).apply(null, arguments) 424 | }; 425 | var _free = Module["_free"] = function() { 426 | return (_free = Module["_free"] = Module["asm"]["h"]).apply(null, arguments) 427 | }; 428 | var _rnnoise_process_frame = Module["_rnnoise_process_frame"] = function() { 429 | return (_rnnoise_process_frame = Module["_rnnoise_process_frame"] = Module["asm"]["i"]).apply(null, arguments) 430 | }; 431 | var calledRun; 432 | dependenciesFulfilled = function runCaller() { 433 | if (!calledRun) run(); 434 | if (!calledRun) dependenciesFulfilled = runCaller 435 | }; 436 | 437 | function run(args) { 438 | args = args || arguments_; 439 | if (runDependencies > 0) { 440 | return 441 | } 442 | preRun(); 443 | if (runDependencies > 0) return; 444 | 445 | function doRun() { 446 | if (calledRun) return; 447 | calledRun = true; 448 | Module["calledRun"] = true; 449 | if (ABORT) return; 450 | initRuntime(); 451 | preMain(); 452 | readyPromiseResolve(Module); 453 | if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"](); 454 | postRun() 455 | } 456 | if (Module["setStatus"]) { 457 | Module["setStatus"]("Running..."); 458 | setTimeout(function() { 459 | setTimeout(function() { 460 | Module["setStatus"]("") 461 | }, 1); 462 | doRun() 463 | }, 1) 464 | } else { 465 | doRun() 466 | } 467 | } 468 | Module["run"] = run; 469 | if (Module["preInit"]) { 470 | if (typeof Module["preInit"] == "function") Module["preInit"] = [Module["preInit"]]; 471 | while (Module["preInit"].length > 0) { 472 | Module["preInit"].pop()() 473 | } 474 | } 475 | noExitRuntime = true; 476 | run(); 477 | 478 | 479 | return Module.ready 480 | } 481 | ); 482 | })(); 483 | export default Module; -------------------------------------------------------------------------------- /rnnoise.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meshiest/rnnoise-demo/2b88f81ba2ad602ab08a07013a55cdad8ccf0088/rnnoise.wasm --------------------------------------------------------------------------------