Skip to content

Commit

Permalink
v2.0 (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
laves authored Nov 25, 2023
1 parent fe93122 commit 2c04f0f
Show file tree
Hide file tree
Showing 90 changed files with 1,732 additions and 585 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/link-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: Check Markdown links
on:
workflow_dispatch:
push:
branches: [main]
branches: [ main ]
pull_request:
branches: [main, 'v[0-9]+.[0-9]+']
branches: [ main, 'v[0-9]+.[0-9]+' ]

jobs:
markdown-link-check:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-codestyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: Python Codestyle
on:
workflow_dispatch:
push:
branches: [main]
branches: [ main ]
paths:
- '**/*.py'
pull_request:
branches: [main, 'v[0-9]+.[0-9]+']
branches: [ main, 'v[0-9]+.[0-9]+' ]
paths:
- '**/*.py'

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ name: Python Demos
on:
workflow_dispatch:
push:
branches: [main]
branches: [ main ]
paths:
- '.github/workflows/python-demos.yml'
- 'demo/python/**'
- '!demo/python/README.md'
- 'resources/audio_samples/test.wav'
pull_request:
branches: [main, 'v[0-9]+.[0-9]+']
branches: [ main, 'v[0-9]+.[0-9]+' ]
paths:
- '.github/workflows/python-demos.yml'
- 'demo/python/**'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Python Performance
on:
workflow_dispatch:
push:
branches: [main]
branches: [ main ]
paths:
- '.github/workflows/python-perf.yml'
- 'binding/python/__init__.py'
Expand All @@ -18,7 +18,7 @@ on:
- 'lib/windows/**'
- 'resources/audio_samples/test.wav'
pull_request:
branches: [main, 'v[0-9]+.[0-9]+']
branches: [ main, 'v[0-9]+.[0-9]+' ]
paths:
- '.github/workflows/python-perf.yml'
- 'binding/python/__init__.py'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Python
on:
workflow_dispatch:
push:
branches: [main]
branches: [ main ]
paths:
- '.github/workflows/python.yml'
- 'binding/python/**'
Expand All @@ -17,7 +17,7 @@ on:
- 'resources/audio_samples/noise.wav'
- 'resources/audio_samples/test.wav'
pull_request:
branches: [main, 'v[0-9]+.[0-9]+']
branches: [ main, 'v[0-9]+.[0-9]+' ]
paths:
- '.github/workflows/python.yml'
- 'binding/python/**'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/spell-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: SpellCheck
on:
workflow_dispatch:
push:
branches: [main]
branches: [ main ]
pull_request:
branches: [main, 'v[0-9]+.[0-9]+']
branches: [ main, 'v[0-9]+.[0-9]+' ]

jobs:
spellcheck:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/web-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

strategy:
matrix:
node-version: [14.x, 16.x, 18.x, 20.x]
node-version: [16.x, 18.x, 20.x]

steps:
- uses: actions/checkout@v3
Expand All @@ -35,6 +35,10 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- name: Build Web SDK
run: yarn && yarn copywasm && yarn build
working-directory: binding/web

- name: Pre-build dependencies
run: npm install yarn

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/web-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ jobs:
run: yarn setup-test

- name: Test
run: yarn test-perf --env ACCESS_KEY=${{secrets.PV_VALID_ACCESS_KEY}},NUM_TEST_ITERATIONS=20,PROC_PERFORMANCE_THRESHOLD_SEC=0.8
run: yarn test-perf --env ACCESS_KEY=${{secrets.PV_VALID_ACCESS_KEY}},NUM_TEST_ITERATIONS=15,PROC_PERFORMANCE_THRESHOLD_SEC=${{ matrix.procPerformanceThresholdSec }}
2 changes: 1 addition & 1 deletion .github/workflows/web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

strategy:
matrix:
node-version: [14.x, 16.x, 18.x, 20.x]
node-version: [16.x, 18.x, 20.x]

steps:
- uses: actions/checkout@v3
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,14 @@ Replace `${ACCESS_KEY}` with yours obtained from [Picovoice Console](https://con

## Releases

### v1.0.0 February 7th, 2023
### v2.0.0 - November 24th, 2023

- Initial release.
- Improvements to error reporting
- Upgrades to authorization and authentication system
- Various bug fixes and improvements
- Web min support bumped to Node 16
- iOS support bumped to iOS 13

### v1.0.0 - February 7th, 2023

- Initial release
6 changes: 3 additions & 3 deletions binding/android/Koala/koala/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.library'

ext {
PUBLISH_GROUP_ID = 'ai.picovoice'
PUBLISH_VERSION = '1.0.0'
PUBLISH_VERSION = '2.0.0'
PUBLISH_ARTIFACT_ID = 'koala-android'
}

Expand Down Expand Up @@ -40,12 +40,12 @@ dependencies {
}

task copyLibs(type: Copy) {
from("${rootDir}/../../lib/android")
from("${rootDir}/../../../lib/android")
into("${rootDir}/koala/src/main/jniLibs")
}

task copyParams(type: Copy) {
from("${rootDir}/../../lib/common")
from("${rootDir}/../../../lib/common")
into("${rootDir}/koala/src/main/res/raw")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,18 @@
public class Koala {

private static String defaultModelPath;
private static String _sdk = "android";

static {
System.loadLibrary("pv_koala");
}

private long handle;

public static void setSdk(String sdk) {
Koala._sdk = sdk;
}

/**
* Constructor.
*
Expand All @@ -43,6 +48,7 @@ public class Koala {
* @throws KoalaException if there is an error while initializing Koala.
*/
private Koala(String accessKey, String modelPath) throws KoalaException {
KoalaNative.setSdk(Koala._sdk);
handle = KoalaNative.init(accessKey, modelPath);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@

class KoalaNative {

static native int getSampleRate();

static native String getVersion();

static native int getFrameLength();

static native int getSampleRate();

static native void setSdk(String sdk);

static native long init(String accessKey, String modelPath) throws KoalaException;

static native void delete(long object);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/*
Copyright 2023 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 an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the specific language governing permissions and
Expand All @@ -18,5 +20,8 @@ public KoalaActivationException(Throwable cause) {
public KoalaActivationException(String message) {
super(message);
}
}

public KoalaActivationException(String message, String[] messageStack) {
super(message, messageStack);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/*
Copyright 2023 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 an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the specific language governing permissions and
Expand All @@ -18,5 +20,8 @@ public KoalaActivationLimitException(Throwable cause) {
public KoalaActivationLimitException(String message) {
super(message);
}
}

public KoalaActivationLimitException(String message, String[] messageStack) {
super(message, messageStack);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/*
Copyright 2023 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 an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the specific language governing permissions and
Expand All @@ -18,5 +20,8 @@ public KoalaActivationRefusedException(Throwable cause) {
public KoalaActivationRefusedException(String message) {
super(message);
}
}

public KoalaActivationRefusedException(String message, String[] messageStack) {
super(message, messageStack);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/*
Copyright 2023 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 an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the specific language governing permissions and
Expand All @@ -18,5 +20,8 @@ public KoalaActivationThrottledException(Throwable cause) {
public KoalaActivationThrottledException(String message) {
super(message);
}
}

public KoalaActivationThrottledException(String message, String[] messageStack) {
super(message, messageStack);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/*
Copyright 2023 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 an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the specific language governing permissions and
Expand All @@ -11,12 +13,42 @@
package ai.picovoice.koala;

public class KoalaException extends Exception {
private final String message;
private final String[] messageStack;

public KoalaException(Throwable cause) {
super(cause);
this.message = cause.getMessage();
this.messageStack = null;
}

public KoalaException(String message) {
super(message);
this.message = message;
this.messageStack = null;
}
}

public KoalaException(String message, String[] messageStack) {
super(message);
this.message = message;
this.messageStack = messageStack;
}

public String[] getMessageStack() {
return this.messageStack;
}

@Override
public String getMessage() {
StringBuilder sb = new StringBuilder(message);
if (messageStack != null) {
if (messageStack.length > 0) {
sb.append(":");
for (int i = 0; i < messageStack.length; i++) {
sb.append(String.format("\n [%d] %s", i, messageStack[i]));
}
}
}
return sb.toString();
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/*
Copyright 2023 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 an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the specific language governing permissions and
Expand All @@ -18,5 +20,8 @@ public KoalaIOException(Throwable cause) {
public KoalaIOException(String message) {
super(message);
}
}

public KoalaIOException(String message, String[] messageStack) {
super(message, messageStack);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/*
Copyright 2023 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 an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the specific language governing permissions and
Expand All @@ -18,5 +20,8 @@ public KoalaInvalidArgumentException(Throwable cause) {
public KoalaInvalidArgumentException(String message) {
super(message);
}
}

public KoalaInvalidArgumentException(String message, String[] messageStack) {
super(message, messageStack);
}
}
Loading

0 comments on commit 2c04f0f

Please sign in to comment.