Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpi5 nodejs #304

Merged
merged 6 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/nodejs-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

# ************** REMOVE AFTER RELEASE ********************
- name: Build Node.js SDK
run: yarn && yarn build
working-directory: binding/nodejs
# ********************************************************

- name: Install dependencies
run: yarn install

Expand All @@ -50,11 +56,17 @@ jobs:

strategy:
matrix:
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, jetson]
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, jetson]

steps:
- uses: actions/checkout@v3

# ************** REMOVE AFTER RELEASE ********************
- name: Build Node.js SDK
run: yarn && yarn build
working-directory: binding/nodejs
# ********************************************************

- 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 @@ -61,7 +61,7 @@ jobs:
strategy:
fail-fast: false
matrix:
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, jetson]
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, jetson]
include:
- machine: rpi3-32
init_performance_threshold_sec: 9.0
Expand All @@ -75,6 +75,9 @@ jobs:
- machine: rpi4-64
init_performance_threshold_sec: 5.5
proc_performance_threshold_sec: 3.5
- machine: rpi5-64
init_performance_threshold_sec: 3.0
proc_performance_threshold_sec: 2.0
- machine: jetson
init_performance_threshold_sec: 5.5
proc_performance_threshold_sec: 4.3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:

strategy:
matrix:
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, jetson]
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, jetson]

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 @@ -13,12 +13,12 @@ Cheetah is an on-device streaming speech-to-text engine. Cheetah is:
- Linux (x86_64), macOS (x86_64, arm64), and Windows (x86_64)
- Android and iOS
- Chrome, Safari, Firefox, and Edge
- Raspberry Pi (4, 3) and NVIDIA Jetson Nano
- Raspberry Pi (5, 4, 3) and NVIDIA Jetson Nano

## Compatibility

- Node.js 16+
- Runs on Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64), Raspberry Pi (4, 3), and NVIDIA Jetson Nano.
- Runs on Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64), Raspberry Pi (5, 4, 3), and NVIDIA Jetson Nano.

## Installation

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/cheetah-node",
"version": "2.0.0",
"version": "2.0.1",
"description": "Picovoice Cheetah Node.js binding",
"main": "dist/index.js",
"types": "dist/types/index.d.ts",
Expand Down
6 changes: 3 additions & 3 deletions binding/nodejs/src/cheetah.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2022-2023 Picovoice Inc.
// Copyright 2022-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 @@ -101,7 +101,7 @@ export default class Cheetah {

let cheetahHandleAndStatus: CheetahHandleAndStatus | null = null;
try {
pvCheetah.set_sdk("nodejs");
pvCheetah.set_sdk('nodejs');

cheetahHandleAndStatus = pvCheetah.init(
accessKey,
Expand Down Expand Up @@ -248,7 +248,7 @@ export default class Cheetah {
if (errorObject.status === PvStatus.SUCCESS) {
pvStatusToException(status, message, errorObject.message_stack);
} else {
pvStatusToException(status, "Unable to get Cheetah error state");
pvStatusToException(status, 'Unable to get Cheetah error state');
}
}
}
8 changes: 5 additions & 3 deletions binding/nodejs/src/errors.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2022-2023 Picovoice Inc.
// Copyright 2022-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 @@ -37,8 +37,10 @@ export class CheetahError extends Error {
let msg = initial;

if (messageStack.length > 0) {
msg += `: ${messageStack.reduce((acc, value, index) =>
acc + '\n [' + index + '] ' + value, '')}`;
msg += `: ${messageStack.reduce(
(acc, value, index) => acc + '\n [' + index + '] ' + value,
''
)}`;
}

return msg;
Expand Down
4 changes: 2 additions & 2 deletions binding/nodejs/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2022-2023 Picovoice Inc.
// Copyright 2022-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 All @@ -20,7 +20,7 @@ import {
CheetahOptions,
} from './types';

import * as CheetahErrors from "./errors";
import * as CheetahErrors from './errors';

export {
Cheetah,
Expand Down
14 changes: 13 additions & 1 deletion binding/nodejs/src/platforms.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2022-2023 Picovoice Inc.
// Copyright 2022-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 @@ -34,6 +34,7 @@ const ARM_CPU_64 = '-aarch64';
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';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

76


const SUPPORTED_NODEJS_SYSTEMS = new Set([
SYSTEM_LINUX,
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_cheetah.node`
);
SYSTEM_TO_LIBRARY_PATH.set(
`${SYSTEM_LINUX}/${ARM_CPU_CORTEX_A76}`,
`${PLATFORM_RASPBERRY_PI}/${ARM_CPU_CORTEX_A76}/pv_cheetah.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_cheetah.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_cheetah.node`
Expand Down Expand Up @@ -100,6 +109,7 @@ function getLinuxPlatform(): string {
switch (cpuPart) {
case '0xd03':
case '0xd08':
case '0xd0b':
return PLATFORM_RASPBERRY_PI;
case '0xd07':
return PLATFORM_JETSON;
Expand All @@ -122,6 +132,8 @@ function getLinuxMachine(arch: string): string {
return ARM_CPU_CORTEX_A57 + archInfo;
case '0xd08':
return ARM_CPU_CORTEX_A72 + archInfo;
case '0xd0b':
return ARM_CPU_CORTEX_A76 + archInfo;
default:
throw new CheetahRuntimeError(`Unsupported CPU: '${cpuPart}'`);
}
Expand Down
2 changes: 1 addition & 1 deletion binding/nodejs/src/pv_status_t.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2022-2023 Picovoice Inc.
// Copyright 2022-2024 Picovoice Inc.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we only update the copyright headers when we change something in the file

//
// 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
2 changes: 1 addition & 1 deletion binding/nodejs/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2022-2023 Picovoice Inc.
Copyright 2022-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.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
Expand Down
2 changes: 1 addition & 1 deletion binding/nodejs/src/wave_util.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2020-2023 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
8 changes: 4 additions & 4 deletions demo/nodejs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@picovoice/cheetah-node-demo",
"version": "2.0.0",
"version": "2.0.1",
"description": "Picovoice Cheetah Node.js file-based and microphone demos",
"scripts": {
"file": "node file.js",
Expand All @@ -16,14 +16,14 @@
"author": "Picovoice Inc.",
"license": "Apache-2.0",
"dependencies": {
"@picovoice/cheetah-node": "=2.0.0",
"@picovoice/pvrecorder-node": "^1.2.1",
"@picovoice/cheetah-node": "file:../../binding/nodejs",
"@picovoice/pvrecorder-node": "^1.2.2",
"commander": "^6.1.0",
"readline": "^1.3.0",
"wavefile": "^11.0.0"
},
"devDependencies": {},
"homepage": "https://picovoice.ai/products/cheetah/",
"homepage": "https://picovoice.ai/platform/cheetah/",
"repository": {
"type": "git",
"url": "https://github.com/Picovoice/cheetah.git",
Expand Down
14 changes: 6 additions & 8 deletions demo/nodejs/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
# yarn lockfile v1


"@picovoice/cheetah-node@=2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@picovoice/cheetah-node/-/cheetah-node-2.0.0.tgz#147b22f60f9c3f9c33d8703d07324be479be01d4"
integrity sha512-UrodmClxc2ImMjG3nBrZ/tHEt2hBDRbZQeYfGAWQVIKNRQkk0zqFMlJe/Fu5Wrpu/yc1T6PaCuesftBGl10Zfg==
"@picovoice/cheetah-node@file:../../binding/nodejs":
version "2.0.1"

"@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
Loading