@100mslive/hms-rnnoise-wasm 中文文档教程

发布于 3年前 浏览 26 项目主页 更新于 3年前

rnnoise-wasm

rnnoise 噪声抑制库作为 WASM 模块。

此存储库包含使用带有 Emscripten 的 Docker 构建环境构建库所需的实用程序。

Build

Prerequisites

  • node - tested version v10.16.3
  • npm - tested version v6.9.0
  • docker - tested version 19.03.1

Building the module

构建很简单,运行:

npm run build

存储库在dist文件夹下已经有一个预编译版本,运行上面的命令将分别替换为新编译的二进制文件和glue wasm .js文件。

为了便于使用 docker 进行构建,使用了以下预构建图像 trzeci/emscripten/ 但是,它稍微通过安装构建 rnnoise 所需的 autotools 组件进行更改。

总而言之,构建过程包括两个步骤:

  1. build:dockerfile - pulls in trzeci/emscripten/ which is then altered and saved. Any suqsequent build is going to check if the images was already installed and use that, so if one wants to make changes to the Dockerfile be sure to first delete the build image from your local docker repo.
  2. build:emscripten - mounts the repo to the docker image from step one and runs build.sh on it. The bash script contains all the steps necessary for building rnnoise as a wasm module.

Usage

构建之后,在 dist 下生成两个文件,实际的 webassembly 二进制文件 rnnoise.wasm 和生成的名为 < code>index.js 其中包含胶水代码和必要的 libc 运行时 javascript 绑定。

repo 是结构化的,因此它可以用作 npm 依赖项,入口点在 dist/index.js 中,请注意使用 index.js 自动暗示 rnnoise.wasm 也需要存在,因此对于正常的 npm 构建系统,必须明确地将 rnnoise.wasm 复制到项目结构中。

rnnoise-wasm

rnnoise noise suppression library as a WASM module.

This repository contains the necessary utilities to build the library using a Docker build environment with Emscripten.

Build

Prerequisites

  • node - tested version v10.16.3
  • npm - tested version v6.9.0
  • docker - tested version 19.03.1

Building the module

Building is straightforward, run:

npm run build

The repository already has a pre-compiled version under the dist folder, running the above command will replace it with the newly compiled binaries and glue wasm .js file respectively.

In order to facilitate the build with docker the following prebuilt image is used trzeci/emscripten/ however, it is slightly altered by installing autotools components necessary for building rnnoise.

In summary the build process consists of two steps:

  1. build:dockerfile - pulls in trzeci/emscripten/ which is then altered and saved. Any suqsequent build is going to check if the images was already installed and use that, so if one wants to make changes to the Dockerfile be sure to first delete the build image from your local docker repo.
  2. build:emscripten - mounts the repo to the docker image from step one and runs build.sh on it. The bash script contains all the steps necessary for building rnnoise as a wasm module.

Usage

Following a build two files are generated under dist, the actual webassembly binary rnnoise.wasm and the generated emscriten .js file named index.js which contains glue code and the necessary libc runtime javascript bindings.

The repo is structured so it can be used as a npm dependency, with the entry point in dist/index.js, be mindful as using index.js automatically implies that rnnoise.wasm needs to be present as well, thus for a normal npm build system one must explicitly copy rnnoise.wasm to the project structure.

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文