From b7c65e1b2ae9e5c0005067de37bb63d58a40cceb Mon Sep 17 00:00:00 2001 From: Ian Lavery Date: Thu, 1 Feb 2024 16:03:04 -0800 Subject: [PATCH] Node rpi5 support (#1218) --- .github/workflows/nodejs-demos.yml | 8 +------- .github/workflows/nodejs-perf.yml | 5 ++++- .github/workflows/nodejs.yml | 2 +- binding/nodejs/README.md | 4 ++-- binding/nodejs/package.json | 2 +- binding/nodejs/src/platforms.ts | 15 +++++++++++++-- demo/nodejs/README.md | 6 +++--- demo/nodejs/package.json | 6 +++--- demo/nodejs/yarn.lock | 16 ++++++++-------- 9 files changed, 36 insertions(+), 28 deletions(-) diff --git a/.github/workflows/nodejs-demos.yml b/.github/workflows/nodejs-demos.yml index 0f601b341a..7242126971 100644 --- a/.github/workflows/nodejs-demos.yml +++ b/.github/workflows/nodejs-demos.yml @@ -39,9 +39,6 @@ jobs: with: node-version: ${{ matrix.node-version }} - - name: Pre-build dependencies - run: npm install yarn - - name: Install dependencies run: yarn install @@ -53,14 +50,11 @@ jobs: strategy: matrix: - machine: [rpi2, rpi3-32, rpi3-64, rpi4-32, rpi4-64, jetson, beaglebone] + machine: [rpi2, rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, jetson, beaglebone] steps: - uses: actions/checkout@v3 - - name: Pre-build dependencies - run: npm install --global yarn - - name: Install dependencies run: yarn install diff --git a/.github/workflows/nodejs-perf.yml b/.github/workflows/nodejs-perf.yml index 2539f73d2f..0e45eba513 100644 --- a/.github/workflows/nodejs-perf.yml +++ b/.github/workflows/nodejs-perf.yml @@ -70,7 +70,7 @@ jobs: strategy: fail-fast: false matrix: - machine: [rpi2, rpi3-32, rpi3-64, rpi4-32, rpi4-64, jetson, beaglebone] + machine: [rpi2, rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, jetson, beaglebone] include: - machine: rpi2 num_test_iterations: 20 @@ -87,6 +87,9 @@ jobs: - machine: rpi4-64 num_test_iterations: 50 performance_threshold_sec: 1.5 + - machine: rpi5-64 + num_test_iterations: 50 + performance_threshold_sec: 0.5 - machine: jetson num_test_iterations: 50 performance_threshold_sec: 2.0 diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 45da9b983d..644c41fde2 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -70,7 +70,7 @@ jobs: strategy: matrix: - machine: [rpi2, rpi3-32, rpi3-64, rpi4-32, rpi4-64, jetson, beaglebone] + machine: [rpi2, rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, jetson, beaglebone] steps: - uses: actions/checkout@v3 diff --git a/binding/nodejs/README.md b/binding/nodejs/README.md index 249033eccc..f18dbbb821 100644 --- a/binding/nodejs/README.md +++ b/binding/nodejs/README.md @@ -23,12 +23,12 @@ Unlike the built-in keywords, custom PPN files generated with the Picovoice Cons ## Compatibility -This binding is for running Porcupine on **Node.js 12+** on the following platforms: +This binding is for running Porcupine on **Node.js 16+** on the following platforms: - Windows (x86_64) - Linux (x86_64) - macOS (x86_64, arm64) -- Raspberry Pi (2,3,4) +- Raspberry Pi (2, 3, 4, 5) - NVIDIA Jetson (Nano) - BeagleBone diff --git a/binding/nodejs/package.json b/binding/nodejs/package.json index 28441d7749..c6cae032f8 100644 --- a/binding/nodejs/package.json +++ b/binding/nodejs/package.json @@ -1,6 +1,6 @@ { "name": "@picovoice/porcupine-node", - "version": "3.0.1", + "version": "3.0.2", "description": "Picovoice Porcupine Node.js binding", "main": "dist/index.js", "types": "dist/types/index.d.ts", diff --git a/binding/nodejs/src/platforms.ts b/binding/nodejs/src/platforms.ts index ba836297b6..f821d9c4f0 100644 --- a/binding/nodejs/src/platforms.ts +++ b/binding/nodejs/src/platforms.ts @@ -1,5 +1,5 @@ // -// Copyright 2020-2022 Picovoice Inc. +// Copyright 2020-2024 Picovoice Inc. // // You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE" // file accompanying this source. @@ -36,6 +36,7 @@ const ARM_CPU_CORTEX_A7 = "cortex-a7"; const ARM_CPU_CORTEX_A53 = "cortex-a53"; const ARM_CPU_CORTEX_A57 = "cortex-a57"; const ARM_CPU_CORTEX_A72 = "cortex-a72"; +const ARM_CPU_CORTEX_A76 = "cortex-a72"; const LIBRARY_PATH_PREFIX = "../lib/"; const SYSTEM_TO_LIBRARY_PATH = new Map(); @@ -71,6 +72,14 @@ SYSTEM_TO_LIBRARY_PATH.set( `${SYSTEM_LINUX}/${ARM_CPU_CORTEX_A72}${ARM_CPU_64}`, `${PLATFORM_RASPBERRY_PI}/${ARM_CPU_CORTEX_A72}${ARM_CPU_64}/pv_porcupine.node` ); +SYSTEM_TO_LIBRARY_PATH.set( + `${SYSTEM_LINUX}/${ARM_CPU_CORTEX_A76}`, + `${PLATFORM_RASPBERRY_PI}/${ARM_CPU_CORTEX_A76}/pv_porcupine.node` +); +SYSTEM_TO_LIBRARY_PATH.set( + `${SYSTEM_LINUX}/${ARM_CPU_CORTEX_A76}${ARM_CPU_64}`, + `${PLATFORM_RASPBERRY_PI}/${ARM_CPU_CORTEX_A76}${ARM_CPU_64}/pv_porcupine.node` +); SYSTEM_TO_LIBRARY_PATH.set( `${SYSTEM_LINUX}/${ARM_CPU_CORTEX_A57}${ARM_CPU_64}`, `${PLATFORM_JETSON}/${ARM_CPU_CORTEX_A57}${ARM_CPU_64}/pv_porcupine.node` @@ -104,7 +113,8 @@ function getLinuxPlatform(): string { switch (cpuPart) { case "0xc07": case "0xd03": - case "0xd08": return PLATFORM_RASPBERRY_PI; + case "0xd08": + case "0xd0b": return PLATFORM_RASPBERRY_PI; case "0xd07": return PLATFORM_JETSON; case "0xc08": return PLATFORM_BEAGLEBONE; default: @@ -124,6 +134,7 @@ function getLinuxMachine(arch: string): string { case "0xd03": return ARM_CPU_CORTEX_A53 + archInfo; case "0xd07": return ARM_CPU_CORTEX_A57 + archInfo; case "0xd08": return ARM_CPU_CORTEX_A72 + archInfo; + case "0xd0b": return ARM_CPU_CORTEX_A76 + archInfo; case "0xc08": return PLATFORM_BEAGLEBONE; default: throw new PorcupineRuntimeError(`Unsupported CPU: '${cpuPart}'`); diff --git a/demo/nodejs/README.md b/demo/nodejs/README.md index d23c2b1b35..dda2fc529b 100644 --- a/demo/nodejs/README.md +++ b/demo/nodejs/README.md @@ -24,7 +24,7 @@ These demos run Porcupine on **Node.js 12+** on the following platforms: - Windows (x86_64) - Linux (x86_64) - macOS (x86_64, arm64) -- Raspberry Pi (2,3,4) +- Raspberry Pi (2, 3, 4, 5) - NVIDIA Jetson (Nano) - BeagleBone @@ -40,7 +40,7 @@ Signup or Login to [Picovoice Console](https://console.picovoice.ai/) to get you ### Microphone demo -The microphone demo allows you monitor microphone input for keywords using Porcupine. +The microphone demo allows you monitor microphone input for keywords using Porcupine. ## Install NPM package @@ -71,7 +71,7 @@ index: 0, device name: USB Audio Device index: 1, device name: MacBook Air Microphone ``` -Specify the input audio device with `--audio_device_index` and either built-in +Specify the input audio device with `--audio_device_index` and either built-in keywords with `--keywords` or paths to Porcupine `.ppn` files with `--keyword_file_paths`. Provide your Picovoice AccessKey with `--access_key`. diff --git a/demo/nodejs/package.json b/demo/nodejs/package.json index 5870f6fbbd..332ec2a9e1 100644 --- a/demo/nodejs/package.json +++ b/demo/nodejs/package.json @@ -1,6 +1,6 @@ { "name": "@picovoice/porcupine-node-demo", - "version": "3.0.1", + "version": "3.0.2", "description": "Picovoice Porcupine Node.js file-based and microphone demos", "scripts": { "file": "node file.js", @@ -16,8 +16,8 @@ "author": "Picovoice, Inc.", "license": "Apache-2.0", "dependencies": { - "@picovoice/porcupine-node": "~3.0.1", - "@picovoice/pvrecorder-node": "~1.2.1", + "@picovoice/porcupine-node": "~3.0.2", + "@picovoice/pvrecorder-node": "~1.2.2", "commander": "^6.1.0", "wavefile": "^11.0.0" }, diff --git a/demo/nodejs/yarn.lock b/demo/nodejs/yarn.lock index 0862f9381d..2dc051d5d2 100644 --- a/demo/nodejs/yarn.lock +++ b/demo/nodejs/yarn.lock @@ -2,15 +2,15 @@ # yarn lockfile v1 -"@picovoice/porcupine-node@~3.0.1": - version "3.0.1" - resolved "https://registry.yarnpkg.com/@picovoice/porcupine-node/-/porcupine-node-3.0.1.tgz#331a55b7f5c45f5f3e62c88f3ce2604feebd82ff" - integrity sha512-Vzg1fGAXwSJ6tio6uz5AOqWKODbb4+TpTYNNGdNatSpSkdn01nQNoDlWZB3Ut3oT5cccKWWfMlZcXRXrVpZzkQ== +"@picovoice/porcupine-node@~3.0.2": + version "3.0.2" + resolved "https://registry.yarnpkg.com/@picovoice/porcupine-node/-/porcupine-node-3.0.2.tgz#9084c61b12531a406ecab3fab20d159a48b5ac19" + integrity sha512-Fkl/UwUT5y8tZ4a53N/grYcP2mftJAsjySucHRqPmVM6zSszYdAB71NggNZ13wZwAZ/2qhNVr7Q73gdQTE4/jQ== -"@picovoice/pvrecorder-node@~1.2.1": - version "1.2.1" - resolved "https://registry.yarnpkg.com/@picovoice/pvrecorder-node/-/pvrecorder-node-1.2.1.tgz#8e112ecc7a4836aa4fa92d62ac7942d8a2366db8" - integrity sha512-7TtRMh04PSVn542Oq1v/MGLFuNPdUrrv+f7qbCGOWRc8y6ox+FATigdQqLRbRey4kZWf40dNHQFdVPCk5ZcXnQ== +"@picovoice/pvrecorder-node@~1.2.2": + version "1.2.2" + resolved "https://registry.yarnpkg.com/@picovoice/pvrecorder-node/-/pvrecorder-node-1.2.2.tgz#41c39719b408e29c581b3094a9ff4c59f282b026" + integrity sha512-GuzZhWslbR4TLE3VxTiqjax8Mc8f1nB69bY5jag4ETlCxo7q/KpeUbWRvojhtNVPvpFLbospZAb6vfgxkEqgJQ== commander@^6.1.0: version "6.2.1"