diff --git a/.github/workflows/nodejs-demos.yml b/.github/workflows/nodejs-demos.yml index 44a3d2a2..67373e28 100644 --- a/.github/workflows/nodejs-demos.yml +++ b/.github/workflows/nodejs-demos.yml @@ -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 diff --git a/.github/workflows/nodejs-perf.yml b/.github/workflows/nodejs-perf.yml index 19010b65..04281005 100644 --- a/.github/workflows/nodejs-perf.yml +++ b/.github/workflows/nodejs-perf.yml @@ -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 @@ -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 diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 8f4684c5..bbd5baed 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -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 diff --git a/binding/nodejs/README.md b/binding/nodejs/README.md index 0b7a5042..87be7e39 100644 --- a/binding/nodejs/README.md +++ b/binding/nodejs/README.md @@ -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 diff --git a/binding/nodejs/package.json b/binding/nodejs/package.json index 00096467..59079c77 100644 --- a/binding/nodejs/package.json +++ b/binding/nodejs/package.json @@ -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", @@ -36,7 +36,7 @@ "bugs": { "url": "https://github.com/Picovoice/cheetah/issues" }, - "homepage": "https://picovoice.ai/products/cheetah/", + "homepage": "https://picovoice.ai/platform/cheetah/", "devDependencies": { "@types/jest": "^27.4.1", "@types/node": "^18.11.9", diff --git a/binding/nodejs/src/cheetah.ts b/binding/nodejs/src/cheetah.ts index bd780903..b23b6d4d 100644 --- a/binding/nodejs/src/cheetah.ts +++ b/binding/nodejs/src/cheetah.ts @@ -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, @@ -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'); } } } diff --git a/binding/nodejs/src/errors.ts b/binding/nodejs/src/errors.ts index ea534c67..d231ea2f 100644 --- a/binding/nodejs/src/errors.ts +++ b/binding/nodejs/src/errors.ts @@ -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; diff --git a/binding/nodejs/src/index.ts b/binding/nodejs/src/index.ts index a635e706..1580f39e 100644 --- a/binding/nodejs/src/index.ts +++ b/binding/nodejs/src/index.ts @@ -20,7 +20,7 @@ import { CheetahOptions, } from './types'; -import * as CheetahErrors from "./errors"; +import * as CheetahErrors from './errors'; export { Cheetah, diff --git a/binding/nodejs/src/platforms.ts b/binding/nodejs/src/platforms.ts index 4725b7b8..172b4f39 100644 --- a/binding/nodejs/src/platforms.ts +++ b/binding/nodejs/src/platforms.ts @@ -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. @@ -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-a76'; const SUPPORTED_NODEJS_SYSTEMS = new Set([ SYSTEM_LINUX, @@ -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` @@ -100,6 +109,7 @@ function getLinuxPlatform(): string { switch (cpuPart) { case '0xd03': case '0xd08': + case '0xd0b': return PLATFORM_RASPBERRY_PI; case '0xd07': return PLATFORM_JETSON; @@ -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}'`); } diff --git a/binding/web/src/types.ts b/binding/web/src/types.ts index c4120325..b4acb5ee 100644 --- a/binding/web/src/types.ts +++ b/binding/web/src/types.ts @@ -9,8 +9,8 @@ specific language governing permissions and limitations under the License. */ -import { PvModel } from "@picovoice/web-utils"; -import { CheetahError } from "./cheetah_errors"; +import { PvModel } from '@picovoice/web-utils'; +import { CheetahError } from './cheetah_errors'; export enum PvStatus { SUCCESS = 10000, @@ -34,11 +34,11 @@ export type CheetahModel = PvModel; export type CheetahOptions = { /** @defaultValue 1.0 */ - endpointDurationSec?: number + endpointDurationSec?: number; /** @defaultValue false */ enableAutomaticPunctuation?: boolean; /** @defaultValue undefined */ - processErrorCallback?: (error: CheetahError) => void + processErrorCallback?: (error: CheetahError) => void; }; export type CheetahTranscript = { @@ -64,17 +64,17 @@ export type CheetahWorkerProcessRequest = { export type CheetahWorkerFlushRequest = { command: 'flush'; -} +}; export type CheetahWorkerReleaseRequest = { command: 'release'; }; export type CheetahWorkerRequest = - CheetahWorkerInitRequest | - CheetahWorkerProcessRequest | - CheetahWorkerFlushRequest | - CheetahWorkerReleaseRequest; + | CheetahWorkerInitRequest + | CheetahWorkerProcessRequest + | CheetahWorkerFlushRequest + | CheetahWorkerReleaseRequest; export type CheetahWorkerFailureResponse = { command: 'failed' | 'error'; @@ -83,29 +83,37 @@ export type CheetahWorkerFailureResponse = { messageStack: string[]; }; -export type CheetahWorkerInitResponse = CheetahWorkerFailureResponse | { - command: 'ok'; - frameLength: number; - sampleRate: number; - version: string; -}; - -export type CheetahWorkerProcessResponse = CheetahWorkerFailureResponse | { - command: 'ok'; - cheetahTranscript: CheetahTranscript; -}; - -export type CheetahWorkerFlushResponse = CheetahWorkerFailureResponse | { - command: 'ok'; - cheetahTranscript: CheetahTranscript; -}; - -export type CheetahWorkerReleaseResponse = CheetahWorkerFailureResponse | { - command: 'ok'; -}; +export type CheetahWorkerInitResponse = + | CheetahWorkerFailureResponse + | { + command: 'ok'; + frameLength: number; + sampleRate: number; + version: string; + }; + +export type CheetahWorkerProcessResponse = + | CheetahWorkerFailureResponse + | { + command: 'ok'; + cheetahTranscript: CheetahTranscript; + }; + +export type CheetahWorkerFlushResponse = + | CheetahWorkerFailureResponse + | { + command: 'ok'; + cheetahTranscript: CheetahTranscript; + }; + +export type CheetahWorkerReleaseResponse = + | CheetahWorkerFailureResponse + | { + command: 'ok'; + }; export type CheetahWorkerResponse = - CheetahWorkerInitResponse | - CheetahWorkerProcessResponse | - CheetahWorkerFlushResponse | - CheetahWorkerReleaseResponse; + | CheetahWorkerInitResponse + | CheetahWorkerProcessResponse + | CheetahWorkerFlushResponse + | CheetahWorkerReleaseResponse; diff --git a/demo/nodejs/package.json b/demo/nodejs/package.json index d3eacb41..05ed0494 100644 --- a/demo/nodejs/package.json +++ b/demo/nodejs/package.json @@ -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", @@ -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": "=2.0.1", + "@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", diff --git a/demo/nodejs/yarn.lock b/demo/nodejs/yarn.lock index e727b7c0..3557afb0 100644 --- a/demo/nodejs/yarn.lock +++ b/demo/nodejs/yarn.lock @@ -2,15 +2,15 @@ # 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@=2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@picovoice/cheetah-node/-/cheetah-node-2.0.1.tgz#bdefc651d85ca407172c0a488ff88296533378b5" + integrity sha512-aQeCZ1lDzswmE23eWnnUWiaYHCMjjlSI01iWEgpnNnYOQjUrWFrH3I3QhvbDwEcBwDj9sRJxRg0/1V+hYURXIg== -"@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"