Skip to content

Commit 1017730

Browse files
authored
Added support for Windows ARM64 (#49)
1 parent e2faa01 commit 1017730

25 files changed

+147
-47
lines changed

Diff for: .github/ISSUE_TEMPLATE/bug_report.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ body:
5151
options:
5252
- Linux (x86_64)
5353
- macOS (x86_64, arm64)
54-
- Windows (x86_64)
54+
- Windows (x86_64, arm64)
5555
- Raspberry Pi
5656
validations:
5757
required: true

Diff for: .github/workflows/c-demos.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ jobs:
7777
strategy:
7878
matrix:
7979
machine: [ rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64 ]
80+
make_file: ["Unix Makefiles"]
8081
include:
8182
- machine: rpi3-32
8283
platform: raspberry-pi
@@ -93,14 +94,18 @@ jobs:
9394
- machine: rpi5-64
9495
platform: raspberry-pi
9596
arch: cortex-a76-aarch64
97+
- machine: pv-windows-arm64
98+
platform: windows
99+
arch: arm64
100+
make_file: "MinGW Makefiles"
96101

97102
steps:
98103
- uses: actions/checkout@v3
99104
with:
100105
submodules: recursive
101106

102107
- name: Create build directory
103-
run: cmake -B ./build
108+
run: cmake -G "${{ matrix.make_file }}" -B ./build
104109

105110
- name: Build demo
106111
run: |

Diff for: .github/workflows/nodejs-demos.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959

6060
strategy:
6161
matrix:
62-
machine: [ rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64 ]
62+
machine: [ rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, pv-windows-arm64 ]
6363

6464
steps:
6565
- uses: actions/checkout@v3

Diff for: .github/workflows/nodejs-perf.yml

+20
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,23 @@ jobs:
8787
- name: Machine state after
8888
working-directory: resources/.scripts
8989
run: bash machine-state.sh
90+
91+
perf-windows-arm64:
92+
runs-on: ${{ matrix.machine }}
93+
94+
strategy:
95+
fail-fast: false
96+
matrix:
97+
machine: [ pv-windows-arm64 ]
98+
include:
99+
- machine: pv-windows-arm64
100+
proc_performance_threshold_sec: 0.25
101+
102+
steps:
103+
- uses: actions/checkout@v3
104+
105+
- name: Install dependencies
106+
run: yarn install
107+
108+
- name: Test
109+
run: yarn test test/perf.test.ts --access_key=${{secrets.PV_VALID_ACCESS_KEY}} --num_test_iterations=50 --proc_performance_threshold_sec=${{matrix.proc_performance_threshold_sec}}

Diff for: .github/workflows/nodejs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454

5555
strategy:
5656
matrix:
57-
machine: [ rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64 ]
57+
machine: [ rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, pv-windows-arm64 ]
5858

5959
steps:
6060
- uses: actions/checkout@v3

Diff for: .github/workflows/python-demo.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767

6868
strategy:
6969
matrix:
70-
machine: [ rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64 ]
70+
machine: [ rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, pv-windows-arm64 ]
7171

7272
steps:
7373
- uses: actions/checkout@v3

Diff for: .github/workflows/python-perf.yml

+24
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,27 @@ jobs:
109109
- name: Machine state after
110110
working-directory: resources/.scripts
111111
run: bash machine-state.sh
112+
113+
perf-windows-arm64:
114+
runs-on: ${{ matrix.machine }}
115+
116+
strategy:
117+
fail-fast: false
118+
matrix:
119+
machine: [ pv-windows-arm64 ]
120+
include:
121+
- machine: pv-windows-arm64
122+
proc_performance_threshold_rtf: 3.0
123+
124+
steps:
125+
- uses: actions/checkout@v3
126+
127+
- name: Install dependencies
128+
run: pip install -r requirements.txt
129+
130+
- name: Test
131+
run: >
132+
python3 test_orca_perf.py
133+
--access-key ${{secrets.PV_VALID_ACCESS_KEY}}
134+
--num-test-iterations 10
135+
--proc-performance-threshold-rtf ${{matrix.proc_performance_threshold_rtf}}

Diff for: .github/workflows/python.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262

6363
strategy:
6464
matrix:
65-
machine: [ rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64 ]
65+
machine: [ rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, pv-windows-arm64 ]
6666

6767
steps:
6868
- uses: actions/checkout@v3

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ voice assistants. Orca is:
1818

1919
- Private; All speech synthesis runs locally.
2020
- Cross-Platform:
21-
- Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64)
21+
- Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64, arm64)
2222
- Android and iOS
2323
- Raspberry Pi (3, 4, 5)
2424
- Chrome, Safari, Firefox, and Edge

Diff for: binding/nodejs/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ voice assistants. Orca is:
99

1010
- Private; All speech synthesis runs locally.
1111
- Cross-Platform:
12-
- Linux (x86_64), macOS (x86_64, arm64), and Windows (x86_64)
12+
- Linux (x86_64), macOS (x86_64, arm64), and Windows (x86_64, arm64)
1313
- Android and iOS
1414
- Chrome, Safari, Firefox, and Edge
1515
- Raspberry Pi (3, 4, 5)
1616

1717
## Compatibility
1818

1919
- Node.js 16+
20-
- Runs on Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64), and Raspberry Pi (3, 4, 5).
20+
- Runs on Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64, arm64), and Raspberry Pi (3, 4, 5).
2121

2222
## Installation
2323

Diff for: binding/nodejs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@picovoice/orca-node",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Picovoice Orca Node.js binding",
55
"main": "dist/index.js",
66
"types": "dist/types/index.d.ts",

Diff for: binding/nodejs/src/platforms.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ SYSTEM_TO_LIBRARY_PATH.set(
8282
`${SYSTEM_WINDOWS}/${X86_64}`,
8383
`${PLATFORM_WINDOWS}/amd64/pv_orca.node`,
8484
);
85+
SYSTEM_TO_LIBRARY_PATH.set(
86+
`${SYSTEM_WINDOWS}/${ARM_64}`,
87+
`${PLATFORM_WINDOWS}/arm64/pv_orca.node`,
88+
);
8589

8690
function absoluteLibraryPath(libraryPath: string): string {
8791
return path.resolve(__dirname, LIBRARY_PATH_PREFIX, libraryPath);
@@ -137,7 +141,7 @@ export function getPlatform(): string {
137141
return PLATFORM_MAC;
138142
}
139143

140-
if (system === SYSTEM_WINDOWS && arch === X86_64) {
144+
if (system === SYSTEM_WINDOWS && (arch === X86_64 || arch === ARM_64)) {
141145
return PLATFORM_WINDOWS;
142146
}
143147

@@ -188,9 +192,9 @@ export function getSystemLibraryPath(): string {
188192
break;
189193
}
190194
case SYSTEM_WINDOWS: {
191-
if (arch === X86_64) {
195+
if (arch === X86_64 || arch === ARM_64) {
192196
return absoluteLibraryPath(
193-
SYSTEM_TO_LIBRARY_PATH.get(`${SYSTEM_WINDOWS}/${X86_64}`),
197+
SYSTEM_TO_LIBRARY_PATH.get(`${SYSTEM_WINDOWS}/${arch}`),
194198
);
195199
}
196200
break;

Diff for: binding/python/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ voice assistants. Orca is:
99

1010
- Private; All speech synthesis runs locally.
1111
- Cross-Platform:
12-
- Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64)
12+
- Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64, arm64)
1313
- Android and iOS
1414
- Chrome, Safari, Firefox, and Edge
1515
- Raspberry Pi (3, 4, 5)
1616

1717
## Compatibility
1818

1919
- Python 3.8+
20-
- Runs on Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64), and Raspberry Pi (3, 4, 5).
20+
- Runs on Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64, arm64), and Raspberry Pi (3, 4, 5).
2121

2222
## Installation
2323

Diff for: binding/python/_util.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ def default_library_path(relative: str = "") -> str:
6969
return os.path.join(
7070
os.path.dirname(__file__), relative, "lib/raspberry-pi/%s/libpv_orca.so" % linux_machine)
7171
elif platform.system() == "Windows":
72-
return os.path.join(os.path.dirname(__file__), relative, "lib", "windows", "amd64", "libpv_orca.dll")
72+
if platform.machine().lower() == 'amd64':
73+
return os.path.join(os.path.dirname(__file__), relative, "lib", "windows", "amd64", "libpv_orca.dll")
74+
elif platform.machine().lower() == 'arm64':
75+
return os.path.join(os.path.dirname(__file__), relative, "lib", "windows", "arm64", "libpv_orca.dll")
7376

7477
raise NotImplementedError("Unsupported platform.")
7578

Diff for: binding/python/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
setuptools.setup(
5151
name="pvorca",
52-
version="1.0.0",
52+
version="1.0.1",
5353
author="Picovoice",
5454
author_email="[email protected]",
5555
description="Orca Streaming Text-to-Speech Engine",

Diff for: demo/nodejs/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ voice assistants. Orca is:
99

1010
- Private; All speech synthesis runs locally.
1111
- Cross-Platform:
12-
- Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64)
12+
- Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64, arm64)
1313
- Android and iOS
1414
- Chrome, Safari, Firefox, and Edge
1515
- Raspberry Pi (3, 4, 5)
1616

1717
## Compatibility
1818

1919
- Node.js 16+
20-
- Runs on Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64), and Raspberry Pi (3, 4, 5).
20+
- Runs on Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64, arm64), and Raspberry Pi (3, 4, 5).
2121

2222
## Installation
2323

Diff for: demo/nodejs/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@picovoice/orca-node-demo",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "Picovoice Orca Node.js file-based and streaming demos",
55
"scripts": {
66
"file": "node file.js",
@@ -21,8 +21,8 @@
2121
"author": "Picovoice Inc.",
2222
"license": "Apache-2.0",
2323
"dependencies": {
24-
"@picovoice/orca-node": "=1.0.0",
25-
"@picovoice/pvspeaker-node": "^1.0.1",
24+
"@picovoice/orca-node": "=1.0.1",
25+
"@picovoice/pvspeaker-node": "^1.0.2",
2626
"commander": "^6.1.0",
2727
"prettier": "^2.6.2",
2828
"readline": "^1.3.0",

Diff for: demo/nodejs/streaming.js

+27-6
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,31 @@ if (process.argv.length < 2) {
6565
program.help();
6666
}
6767
program.parse(process.argv);
68+
69+
function splitText(text) {
70+
// TODO: Remove once tiktoken supports windows-arm64
71+
if (os.platform() === 'win32' && os.arch() === 'arm64') {
72+
const ALPHA_NUMERIC = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 '
73+
const PUNCTUATION = '!"#$%&\'()*+,-./:;<=>?@[\]^_`{|}~ '
74+
const tokensRaw = [ text[0] ]
75+
for (let i = 1; i < text.length; i++) {
76+
let ch = text[i];
77+
let token = tokensRaw[tokensRaw.length - 1];
78+
if ((ALPHA_NUMERIC.includes(ch) && !ALPHA_NUMERIC.includes(token[token.length - 1])) || PUNCTUATION.includes(ch)) {
79+
tokensRaw.push(ch);
80+
} else {
81+
tokensRaw[tokensRaw.length - 1] += ch;
82+
}
83+
}
84+
return tokensRaw;
85+
} else {
86+
const textDecoder = new TextDecoder();
87+
const encoder = tiktoken.encoding_for_model('gpt-4');
88+
const tokensRaw = Array.from(encoder.encode(text), e => textDecoder.decode(encoder.decode([e])));
89+
encoder.free();
90+
return tokensRaw;
91+
}
92+
}
6893

6994
function tokenizeText(text) {
7095
const CUSTOM_PRON_PATTERN = /\{(.*?\|.*?)}/g;
@@ -74,16 +99,12 @@ function tokenizeText(text) {
7499
let customPronunciations = text.match(CUSTOM_PRON_PATTERN) || [];
75100
customPronunciations = new Set(customPronunciations);
76101

77-
const encoder = tiktoken.encoding_for_model('gpt-4');
78-
const tokensRaw = Array.from(encoder.encode(text), e => encoder.decode([e]));
79-
encoder.free();
102+
const tokensRaw = splitText(text);
80103

81104
let customPron = '';
82105
const tokensWithCustomPronunciations = [];
83-
const textDecoder = new TextDecoder();
84106

85-
tokensRaw.forEach((t, i) => {
86-
const token = textDecoder.decode(t);
107+
tokensRaw.forEach((token, i) => {
87108
let inCustomPron = false;
88109
customPronunciations.forEach(pron => {
89110
const inCustomPronGlobal = customPron.length > 0;

Diff for: demo/nodejs/yarn.lock

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
# yarn lockfile v1
33

44

5-
"@picovoice/orca-node@=1.0.0":
6-
version "1.0.0"
7-
resolved "https://registry.yarnpkg.com/@picovoice/orca-node/-/orca-node-1.0.0.tgz#812728c3183a914eff6b3189dfa958ef4d44f2f7"
8-
integrity sha512-YDTqJ5KsueBC4Nj0Zo287VF+/y7SRjXbOyHy8h66joJYPF0QNsz8oDCzbQO7hzymNbkFXd0crMPK+gQElvd83w==
9-
10-
"@picovoice/pvspeaker-node@^1.0.1":
5+
"@picovoice/orca-node@=1.0.1":
116
version "1.0.1"
12-
resolved "https://registry.yarnpkg.com/@picovoice/pvspeaker-node/-/pvspeaker-node-1.0.1.tgz#0524c9509a88eb50f3975cbe3c5012058a54619b"
13-
integrity sha512-4/QBYcp3GZ+2ewq2QuyCn7pnqXdfwj90qbINecKtBsCXKLtl/XHLmXOqgfoy+RBSXmA5wjV/LuOHvqVibrxAuQ==
7+
resolved "https://registry.yarnpkg.com/@picovoice/orca-node/-/orca-node-1.0.1.tgz#455132dfc5f95c0a651e47a512d4018860b7286d"
8+
integrity sha512-IOinMTVrqsTXhwDvqPFnoi/phgr2w6tj5XJ/DFTp+jSuzbZQaMEAOIeKptSKERuGWYkbzXdXDPZb4WRLanFYtQ==
9+
10+
"@picovoice/pvspeaker-node@^1.0.2":
11+
version "1.0.2"
12+
resolved "https://registry.yarnpkg.com/@picovoice/pvspeaker-node/-/pvspeaker-node-1.0.2.tgz#5603864038ba7f2a8ce7f82507f68f4e3f1568b8"
13+
integrity sha512-x7MTp6pdon7Dce1lp0yiM8wQcKkYt9jyLqiK2hjUuq85vGlILBpUfKCspuEUVZnyG/5tMic6VsGfXgET7n+O7A==
1414

1515
commander@^6.1.0:
1616
version "6.2.1"

Diff for: demo/python/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ voice assistants. Orca is:
99

1010
- Private; All speech synthesis runs locally.
1111
- Cross-Platform:
12-
- Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64)
12+
- Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64, arm64)
1313
- Android and iOS
1414
- Chrome, Safari, Firefox, and Edge
1515
- Raspberry Pi (3, 4, 5)
1616

1717
## Compatibility
1818

1919
- Python 3.8+
20-
- Runs on Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64), and Raspberry Pi (3, 4, 5).
20+
- Runs on Linux (x86_64), macOS (x86_64, arm64), Windows (x86_64, arm64), and Raspberry Pi (3, 4, 5).
2121

2222
## Installation
2323

0 commit comments

Comments
 (0)