@audio/neural-separate 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -277,6 +277,7 @@ let vocals = complex.vocals.map(ch => istft(ch, { length: left.length }))
277
277
  | `window` / `normalized` / `frames` | the preset's | `'complex'`: the model's STFT window (`'ones'`, torch.stft's window=None, or `'hann'`), its 1/√n scaling, its frames per segment when the graph does not declare them |
278
278
  | `targetRate` | the preset's rate, else the input rate | resample to the model's rate for inference; stems are resampled back to the input rate |
279
279
  | `device` | — | passed through to `@audio/neural-runtime`'s `load()` as `backend` |
280
+ | `wasmPaths` | — | where onnxruntime-web's `.wasm` files are served, passed through to `load()`: needed where ORT itself comes from a CDN that rebuilds it (esm.sh), e.g. `'https://cdn.jsdelivr.net/npm/onnxruntime-web@1.30.0/dist/'` |
280
281
  | `dtype` | `'float32'` | only `'float32'` tensor marshalling is implemented; anything else throws |
281
282
  | `progress` | — | `({ chunk, totalChunks }) => {}` |
282
283
  | `session` | — | overrides `@audio/neural-runtime`'s `load()` — for tests, or a custom ORT setup |
package/index.d.ts CHANGED
@@ -131,6 +131,9 @@ export interface SeparateOptions {
131
131
  hop?: number
132
132
  /** passed through to @audio/neural-runtime's load() as `backend` */
133
133
  device?: string
134
+ /** where onnxruntime-web's .wasm files are served (a URL prefix, or a file → URL map), passed through to
135
+ * @audio/neural-runtime's load(): for an ORT build loaded from a CDN that rebuilds it (esm.sh) */
136
+ wasmPaths?: string | Record<string, string>
134
137
  /** only 'float32' is implemented; anything else throws */
135
138
  dtype?: 'float32'
136
139
  progress?: (p: { chunk: number; totalChunks: number }) => void
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@audio/neural-separate",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Source separation (stems): a song's by SCNet (MIT weights), Hybrid Transformer Demucs, Open-Unmix with multichannel Wiener refinement; a soundtrack's dialogue, music and effects by MRX (MIT weights) and TIGER (Apache-2.0); model-agnostic ONNX",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -29,7 +29,7 @@
29
29
  "NOTICE"
30
30
  ],
31
31
  "dependencies": {
32
- "@audio/neural-runtime": "^0.1.1",
32
+ "@audio/neural-runtime": "^0.2.0",
33
33
  "@audio/resample-sinc": "^1.1.2",
34
34
  "fourier-transform": "^2.4.1"
35
35
  },
package/separate.js CHANGED
@@ -30,7 +30,7 @@ import resampleSinc from '@audio/resample-sinc'
30
30
  import { load as neuralLoad, tensor, fetchModel, fetchJson, backends } from '@audio/neural-runtime'
31
31
 
32
32
  const PI2 = Math.PI * 2
33
- const isNode = typeof process !== 'undefined' && !!process.versions?.node
33
+ const isNode = globalThis.process?.release?.name === 'node' // Node, Bun, Deno: not a process polyfill (esm.sh's, a bundler's), whose versions.node is set
34
34
 
35
35
  // ---------------------------------------------------------------- STFT/iSTFT
36
36
 
@@ -575,7 +575,7 @@ function loader(opts, preset) {
575
575
  let s = own && await own
576
576
  if (s) return s
577
577
  let spec = g.sha256 && !g.spec.startsWith('file:') ? await checked(g.spec, g.sha256) : g.spec
578
- return neuralLoad(spec, { backend: await device, sessionOptions })
578
+ return neuralLoad(spec, { backend: await device, sessionOptions, wasmPaths: opts.wasmPaths })
579
579
  }
580
580
  }
581
581