nodejs-server
Use Porcupine from Node.js server-side JavaScript or TypeScript for file and microphone wake-word detection.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- nodejs-server
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use Porcupine from Node.js server-side JavaScript or TypeScript for file and microphone wake-word detection.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/nodejs-api-reference.md8.7 KB
- 参考文档references/nodejs-workflows.md7.2 KB
- 参考文档references/troubleshooting.md9.0 KB
- 脚本scripts/porcupine_node_file_template.js10.1 KB
03 SKILL.md 正文
Porcupine Node.js Server Skill
Use this sub-skill when the task is to run Porcupine from Node.js 18+ in a server, CLI, Electron main-process, or other non-browser JavaScript/TypeScript runtime.
Route here for
- Installing and importing
@picovoice/porcupine-node. - Constructing
new Porcupine(accessKey, keywords, sensitivities, options). - Choosing built-in keyword enum values versus custom
.ppnkeyword file paths. - Processing 16 kHz, 16-bit, mono PCM frames with
process(frame)and callingrelease(). - Listing inference devices with
Porcupine.listAvailableDevices(). - Building file-based WAV scanning or microphone capture workflows in Node.js.
- Diagnosing native
.nodepackage loading, AccessKey, frame-shape, sensitivity, and lifecycle failures.
Route elsewhere
- Browser, WebAssembly, React hooks, or browser microphone work:
../web-and-react/SKILL.md. - Custom keyword training, language model
.pvselection, platform-specific.ppnassets, and Picovoice Console/API limits:../custom-keywords-and-assets/SKILL.md. - Python CLI/API workflows:
../python-and-cli/SKILL.md. - C, MCU, mobile, JVM, .NET, Flutter, or React Native SDKs: the relevant sibling sub-skill.
- Cross-cutting install/AccessKey/platform issues shared by every SDK:
../../references/troubleshooting.md.
First reads
references/nodejs-api-reference.mdfor API signatures, built-in keyword names, options, exported helpers, package/build facts, and validation rules.references/nodejs-workflows.mdfor file WAV and microphone workflow recipes.references/troubleshooting.mdbefore changing code around native loading, AccessKey, keyword arrays, PCM frames, or cleanup.scripts/porcupine_node_file_template.jswhen a safe starting point for a Node file-detection helper is useful.
Operating guardrails
- Treat
@picovoice/porcupine-nodeas a Node-only native package; do not use it in browser bundles. - Do not hard-code AccessKeys or require them for help, keyword listing, or device-listing tasks. An AccessKey is required only when constructing a Porcupine engine for detection.
- Prefer
BuiltinKeyword.<NAME>values for built-in English wake words. Use custom.ppnpaths only for trained or non-bundled keyword models, and route asset/training decisions tocustom-keywords-and-assets. - Keep every audio frame at
handle.frameLength,handle.sampleRate, mono, 16-bit linear PCM. UseInt16Arrayin new code. - Always release the Porcupine handle in a
finallyblock or shutdown handler; release microphone recorders separately.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).