Skip to content

fix(node): expose CLAP with encodeAudio and encodeText - #38

Open
zhangzhenghao wants to merge 1 commit into
mainfrom
fix/node-clap-api
Open

zhangzhenghao wants to merge 1 commit into
mainfrom
fix/node-clap-api

Conversation

@zhangzhenghao

@zhangzhenghao zhangzhenghao commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Rename the public Node.js class from Model to CLAP.
  • Expose idiomatic camelCase encodeText() and encodeAudio() only for inference, retaining idempotent close() for early resource release.
  • Hide tokenizer, model metadata, frame/features APIs and standalone audio decoding/resampling utilities; remove old names rather than adding aliases.
  • Accept audio paths directly in encodeAudio(path, cropOffset?), as well as mono PCM in encodeAudio(pcm, sampleRate?, cropOffset?).
  • Update TypeScript declarations, documentation, runtime tests and npm packaged-file coverage.

Verification

  • Regression test observed failing against the old export surface and again against snake_case method names before the respective implementations.
  • Native CPU addon rebuilt successfully.
  • All 7 runtime/API tests pass, including real CLAP/MERT inference, independent NumPy text oracle, file/PCM equivalence and reentrant-close safety.
  • TypeScript checks and packaging-content test pass.
  • npm pack and a fresh standalone source-tarball installation succeed.
  • Installed binary passes checkout tests; installed package generates its own fixtures and passes all 7 tests.
  • Independent review passed the initial change; camelCase naming delta reviewed separately.

PR CI

  • Node.js CPU matrix passes on Linux x64, Linux ARM64, macOS and Windows, including standalone source-distribution installation and tests.
  • Python and Rust workflows pass.
  • General native CI passes on Linux x64/ARM64 and Windows x64/ARM64; its macOS job is still queued.
  • All results above are for commit d49cd9d8af976e5da9103ba34b20d235d757d886.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants