Skip to content

Commit

Permalink
Node rpi5 support (#1218)
Browse files Browse the repository at this point in the history
  • Loading branch information
laves authored Feb 2, 2024
1 parent 050b87d commit b7c65e1
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 28 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/nodejs-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/nodejs-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions binding/nodejs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion binding/nodejs/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
15 changes: 13 additions & 2 deletions binding/nodejs/src/platforms.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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`
Expand Down Expand Up @@ -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:
Expand All @@ -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}'`);
Expand Down
6 changes: 3 additions & 3 deletions demo/nodejs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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`.

Expand Down
6 changes: 3 additions & 3 deletions demo/nodejs/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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"
},
Expand Down
16 changes: 8 additions & 8 deletions demo/nodejs/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit b7c65e1

Please sign in to comment.