Skip to content

Commit 3b77317

Browse files
authored
v1.1 improvements (#78)
1 parent ee72620 commit 3b77317

File tree

87 files changed

+832
-251
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+832
-251
lines changed

binding/android/Orca/orca/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
22

33
ext {
44
PUBLISH_GROUP_ID = 'ai.picovoice'
5-
PUBLISH_VERSION = '1.1.0'
5+
PUBLISH_VERSION = '1.1.1'
66
PUBLISH_ARTIFACT_ID = 'orca-android'
77
}
88

binding/android/OrcaTestApp/orca-test-app/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ android {
7171

7272
tasks.register('copyParams', Copy) {
7373
from("$projectDir/../../../../lib/common/")
74-
include("orca_params_en_female.pv")
75-
include("orca_params_en_male.pv")
7674
into("$projectDir/src/main/assets/models")
7775
}
7876

@@ -113,20 +111,22 @@ dependencies {
113111
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
114112
implementation 'com.google.code.gson:gson:2.10'
115113
implementation 'com.google.errorprone:error_prone_annotations:2.36.0'
116-
implementation 'ai.picovoice:orca-android:1.1.0'
114+
implementation 'ai.picovoice:orca-android:1.1.1'
117115

118116
// Espresso UI Testing
119117
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
120118
androidTestImplementation('androidx.test.espresso:espresso-core:3.2.0', {
121119
exclude group: 'com.android.support', module: 'support-annotations'
122120
})
123121
androidTestImplementation('androidx.test.espresso:espresso-intents:3.5.1')
124-
androidTestImplementation('ai.picovoice:orca-android:1.0.0')
122+
androidTestImplementation('ai.picovoice:orca-android:1.1.1')
125123
}
126124

127125
afterEvaluate {
128126
tasks."mergeDebugAssets".dependsOn "copyParams"
129127
tasks."mergeReleaseAssets".dependsOn "copyParams"
128+
tasks."generateDebugLintReportModel".dependsOn "copyParams"
130129
tasks."generateReleaseLintVitalReportModel".dependsOn "copyParams"
130+
tasks."lintAnalyzeDebug".dependsOn "copyParams"
131131
tasks."lintVitalAnalyzeRelease".dependsOn "copyParams"
132132
}

binding/android/OrcaTestApp/orca-test-app/src/androidTest/java/ai/picovoice/orca/testapp/AlignmentTests.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@
1212

1313
package ai.picovoice.orca.testapp;
1414

15-
import static org.junit.Assert.assertNotEquals;
16-
import static org.junit.Assert.assertNotNull;
17-
import static org.junit.Assert.assertTrue;
18-
import static org.junit.Assert.fail;
19-
2015
import com.google.gson.JsonArray;
2116
import com.google.gson.JsonElement;
2217
import com.google.gson.JsonObject;
@@ -29,21 +24,17 @@
2924
import org.junit.runners.Parameterized;
3025

3126
import java.io.File;
32-
3327
import java.io.IOException;
3428
import java.util.ArrayList;
35-
import java.util.Arrays;
3629
import java.util.Collection;
3730
import java.util.List;
38-
import java.util.Objects;
3931

4032
import ai.picovoice.orca.Orca;
4133
import ai.picovoice.orca.OrcaAudio;
4234
import ai.picovoice.orca.OrcaException;
43-
import ai.picovoice.orca.OrcaInvalidArgumentException;
35+
import ai.picovoice.orca.OrcaPhoneme;
4436
import ai.picovoice.orca.OrcaSynthesizeParams;
4537
import ai.picovoice.orca.OrcaWord;
46-
import ai.picovoice.orca.OrcaPhoneme;
4738

4839
@RunWith(Parameterized.class)
4940
public class AlignmentTests extends BaseTest {
@@ -92,8 +83,6 @@ public static Collection<Object[]> initParameters() throws IOException {
9283

9384
@Before
9485
public void Setup() throws Exception {
95-
super.Setup();
96-
9786
orca = new Orca.Builder()
9887
.setAccessKey(accessKey)
9988
.setModelPath(getModelFilepath(modelFilename))

binding/android/OrcaTestApp/orca-test-app/src/androidTest/java/ai/picovoice/orca/testapp/BaseTest.java

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
package ai.picovoice.orca.testapp;
1414

15+
import static org.junit.Assert.assertEquals;
16+
1517
import android.content.Context;
1618
import android.content.res.AssetManager;
1719

@@ -20,7 +22,7 @@
2022
import com.google.gson.Gson;
2123
import com.google.gson.JsonObject;
2224

23-
import org.junit.Before;
25+
import org.junit.BeforeClass;
2426

2527
import java.io.BufferedInputStream;
2628
import java.io.BufferedOutputStream;
@@ -32,35 +34,37 @@
3234
import java.io.IOException;
3335
import java.io.InputStream;
3436
import java.io.OutputStream;
35-
36-
import static org.junit.Assert.assertEquals;
37-
3837
import java.nio.ByteBuffer;
3938
import java.nio.ByteOrder;
4039
import java.util.Arrays;
40+
import java.util.HashSet;
41+
import java.util.Set;
4142

42-
import ai.picovoice.orca.OrcaWord;
4343
import ai.picovoice.orca.OrcaPhoneme;
44+
import ai.picovoice.orca.OrcaWord;
4445

4546
public class BaseTest {
47+
static Set<String> extractedFiles;
48+
49+
static Context testContext;
50+
static Context appContext;
51+
static AssetManager assetManager;
52+
static String testResourcesPath;
53+
static JsonObject testJson;
54+
static String accessKey;
4655

47-
Context testContext;
48-
Context appContext;
49-
AssetManager assetManager;
50-
String testResourcesPath;
51-
JsonObject testJson;
52-
String accessKey;
56+
@BeforeClass
57+
public static void setup() throws Exception {
58+
extractedFiles = new HashSet<>();
5359

54-
@Before
55-
public void Setup() throws Exception {
5660
testContext = InstrumentationRegistry.getInstrumentation().getContext();
5761
appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
5862
assetManager = testContext.getAssets();
59-
extractAssetsRecursively("test_resources");
6063
testResourcesPath = new File(
6164
appContext.getFilesDir(),
6265
"test_resources").getAbsolutePath();
6366

67+
extractTestFile("test_resources/test_data.json");
6468
FileReader reader = new FileReader(
6569
new File(testResourcesPath, "test_data.json").getAbsolutePath()
6670
);
@@ -86,20 +90,23 @@ public static String getTestDataString() throws IOException {
8690
return result.toString("UTF-8");
8791
}
8892

89-
public static String getModelFilepath(String modelFilename) {
93+
public static String getModelFilepath(String modelFilename) throws IOException {
9094
Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
9195
String resPath = new File(
9296
context.getFilesDir(),
9397
"test_resources").getAbsolutePath();
94-
return new File(resPath, String.format("model_files/%s", modelFilename)).getAbsolutePath();
98+
String modelPath = String.format("model_files/%s", modelFilename);
99+
extractTestFile(String.format("test_resources/%s", modelPath));
100+
return new File(resPath, modelPath).getAbsolutePath();
95101
}
96102

97-
public static String getAudioFilepath(String modelFilename, String synthesisType) {
103+
public static String getAudioFilepath(String modelFilename, String synthesisType) throws IOException {
98104
Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
99105
String resPath = new File(
100106
context.getFilesDir(),
101107
"test_resources").getAbsolutePath();
102108
String audioFilename = modelFilename.replace(".pv", String.format("_%s.wav", synthesisType));
109+
extractTestFile(String.format("test_resources/wav/%s", audioFilename));
103110
return new File(resPath, String.format("wav/%s", audioFilename)).getAbsolutePath();
104111
}
105112

@@ -163,7 +170,7 @@ protected void validateMetadata(
163170
}
164171
}
165172

166-
private void extractAssetsRecursively(String path) throws IOException {
173+
private static void extractAssetsRecursively(String path) throws IOException {
167174
String[] dirList = assetManager.list(path);
168175
if (dirList != null && dirList.length > 0) {
169176
File outputFile = new File(appContext.getFilesDir(), path);
@@ -186,14 +193,25 @@ private void extractAssetsRecursively(String path) throws IOException {
186193
}
187194
}
188195

189-
private void extractTestFile(String filepath) throws IOException {
196+
private static void extractTestFile(String filepath) throws IOException {
197+
File absPath = new File(
198+
appContext.getFilesDir(),
199+
filepath);
200+
201+
if (extractedFiles.contains(filepath)) {
202+
return;
203+
}
204+
205+
if (!absPath.exists()) {
206+
if (absPath.getParentFile() != null) {
207+
absPath.getParentFile().mkdirs();
208+
}
209+
absPath.createNewFile();
210+
}
190211

191212
InputStream is = new BufferedInputStream(
192213
assetManager.open(filepath),
193214
256);
194-
File absPath = new File(
195-
appContext.getFilesDir(),
196-
filepath);
197215
OutputStream os = new BufferedOutputStream(
198216
new FileOutputStream(absPath),
199217
256);
@@ -206,5 +224,7 @@ private void extractTestFile(String filepath) throws IOException {
206224

207225
is.close();
208226
os.close();
227+
228+
extractedFiles.add(filepath);
209229
}
210230
}

binding/android/OrcaTestApp/orca-test-app/src/androidTest/java/ai/picovoice/orca/testapp/PerformanceTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ public static Collection<Object[]> initParameters() throws IOException {
6565

6666
@Before
6767
public void Setup() throws Exception {
68-
super.Setup();
6968
String iterationString = appContext.getString(R.string.numTestIterations);
7069

7170
try {

binding/android/OrcaTestApp/orca-test-app/src/androidTest/java/ai/picovoice/orca/testapp/SentenceTests.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,17 @@
2929
import org.junit.runners.Parameterized;
3030

3131
import java.io.File;
32-
3332
import java.io.IOException;
3433
import java.util.ArrayList;
3534
import java.util.Arrays;
3635
import java.util.Collection;
3736
import java.util.List;
38-
import java.util.Objects;
3937

4038
import ai.picovoice.orca.Orca;
4139
import ai.picovoice.orca.OrcaAudio;
4240
import ai.picovoice.orca.OrcaException;
4341
import ai.picovoice.orca.OrcaInvalidArgumentException;
4442
import ai.picovoice.orca.OrcaSynthesizeParams;
45-
import ai.picovoice.orca.OrcaWord;
46-
import ai.picovoice.orca.OrcaPhoneme;
4743

4844
@RunWith(Parameterized.class)
4945
public class SentenceTests extends BaseTest {
@@ -98,8 +94,6 @@ public static Collection<Object[]> initParameters() throws IOException {
9894

9995
@Before
10096
public void Setup() throws Exception {
101-
super.Setup();
102-
10397
orca = new Orca.Builder()
10498
.setAccessKey(accessKey)
10599
.setModelPath(getModelFilepath(modelFilename))

binding/android/OrcaTestApp/orca-test-app/src/androidTest/java/ai/picovoice/orca/testapp/StandardTests.java

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,18 @@
1515
import static org.junit.Assert.assertEquals;
1616
import static org.junit.Assert.assertTrue;
1717

18-
import org.junit.Before;
19-
import org.junit.Test;
20-
import org.junit.runner.RunWith;
21-
22-
import ai.picovoice.orca.Orca;
23-
import ai.picovoice.orca.OrcaException;
24-
2518
import androidx.test.ext.junit.runners.AndroidJUnit4;
2619

2720
import com.google.gson.JsonArray;
28-
import com.google.gson.JsonElement;
2921
import com.google.gson.JsonObject;
3022
import com.google.gson.JsonParser;
3123

32-
import java.util.ArrayList;
33-
import java.util.List;
24+
import org.junit.Before;
25+
import org.junit.Test;
26+
import org.junit.runner.RunWith;
27+
28+
import ai.picovoice.orca.Orca;
29+
import ai.picovoice.orca.OrcaException;
3430

3531
@RunWith(AndroidJUnit4.class)
3632
public class StandardTests extends BaseTest {
@@ -39,8 +35,6 @@ public class StandardTests extends BaseTest {
3935

4036
@Before
4137
public void Setup() throws Exception {
42-
super.Setup();
43-
4438
String testDataJsonString = getTestDataString();
4539

4640
JsonParser parser = new JsonParser();

binding/dotnet/Orca/Orca.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFrameworks>net8.0;net6.0;netcoreapp3.0;netstandard2.0</TargetFrameworks>
4-
<Version>1.1.1</Version>
4+
<Version>1.1.2</Version>
55
<Authors>Picovoice</Authors>
66
<Company />
77
<Product>Orca Streaming Text-to-Speech Engine</Product>

binding/ios/Orca-iOS.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22
s.name = 'Orca-iOS'
33
s.module_name = 'Orca'
4-
s.version = '1.1.0'
4+
s.version = '1.1.1'
55
s.license = {:type => 'Apache 2.0'}
66
s.summary = 'iOS binding for Picovoice\'s Orca Text-to-Speech Engine.'
77
s.description =

binding/ios/OrcaAppTest/OrcaAppTest.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@
236236
);
237237
mainGroup = 1E00643F27CEDF9B006FF6E9;
238238
packageReferences = (
239-
07F723562D6D57E90002D88F /* XCRemoteSwiftPackageReference "orca" */,
239+
1E7C0A402D84D9C700A5350A /* XCRemoteSwiftPackageReference "orca" */,
240240
);
241241
productRefGroup = 1E00644927CEDF9B006FF6E9 /* Products */;
242242
projectDirPath = "";
@@ -655,12 +655,12 @@
655655
/* End XCLocalSwiftPackageReference section */
656656

657657
/* Begin XCRemoteSwiftPackageReference section */
658-
07F723562D6D57E90002D88F /* XCRemoteSwiftPackageReference "orca" */ = {
658+
1E7C0A402D84D9C700A5350A /* XCRemoteSwiftPackageReference "orca" */ = {
659659
isa = XCRemoteSwiftPackageReference;
660660
repositoryURL = "https://github.com/Picovoice/orca";
661661
requirement = {
662-
kind = exactVersion;
663-
version = 1.1.0;
662+
kind = upToNextMajorVersion;
663+
minimumVersion = 1.1.1;
664664
};
665665
};
666666
/* End XCRemoteSwiftPackageReference section */

0 commit comments

Comments
 (0)