deepfilternet3-assets
v1.0.4
Published
DeepFilterNet3 WASM and model assets for noise suppression
Maintainers
Readme
deepfilternet3-assets
DeepFilterNet3 WASM and model assets for noise suppression.
Installation
npm install deepfilternet3-assets
# or
yarn add deepfilternet3-assetsContents
This package includes:
pkg/df_bg.wasm- DeepFilterNet3 WebAssembly binarymodels/DeepFilterNet3_onnx.tar.gz- DeepFilterNet3 ONNX model
Usage
Getting Asset Paths (Node.js)
const { getWasmPath, getModelPath, getAssetPaths } = require('deepfilternet3-assets');
// Get individual paths
const wasmPath = getWasmPath();
const modelPath = getModelPath();
// Or get both at once
const { wasm, model } = getAssetPaths();Using with Web Bundlers
For web applications, you can use the relative paths:
const { WASM_RELATIVE_PATH, MODEL_RELATIVE_PATH } = require('deepfilternet3-assets');
// Then use with your bundler's asset handling
// For example, with Webpack or ViteServing Assets via CDN or Static Server
You can copy these files to your static assets directory or CDN:
const fs = require('fs');
const { getAssetPaths } = require('deepfilternet3-assets');
const assets = getAssetPaths();
// Copy to your public directory
fs.copyFileSync(assets.wasm, './public/wasm/df_bg.wasm');
fs.copyFileSync(assets.model, './public/models/DeepFilterNet3_onnx.tar.gz');TypeScript Support
This package includes TypeScript type definitions:
import { getAssetPaths, WASM_RELATIVE_PATH, MODEL_RELATIVE_PATH } from 'deepfilternet3-assets';
const { wasm, model } = getAssetPaths();
// Use relative paths for URLs
console.log(WASM_RELATIVE_PATH); // 'pkg/df_bg.wasm'
console.log(MODEL_RELATIVE_PATH); // 'models/DeepFilterNet3_onnx.tar.gz'File Sizes
- WASM file: 8.8 MB
- Model file: 7.7 MB
- Total package size: ~10.4 MB (compressed), ~17.1 MB (unpacked)
Make sure your CDN or server can handle these file sizes efficiently.
API Reference
Functions
getWasmPath()- Returns absolute path to the WASM filegetModelPath()- Returns absolute path to the model filegetAssetPaths()- Returns object with both asset paths:{ wasm: string, model: string }
Constants
WASM_RELATIVE_PATH- Relative path to WASM file:'pkg/df_bg.wasm'MODEL_RELATIVE_PATH- Relative path to model file:'models/DeepFilterNet3_onnx.tar.gz'
Example
See example.js for a complete working example.
License
(Apache-2.0 OR MIT)
Credits
DeepFilterNet3 is developed by Rikorose. This package only distributes the compiled assets.
