Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Commit

Permalink
breaking: Revert active-min/max config keys for RN
Browse files Browse the repository at this point in the history
This change reverts the names of the configuration parameters that
control the pipeline activation length so they are reachable from
the React Native library.
  • Loading branch information
space-pope committed Sep 10, 2020
1 parent 63ceb8a commit 989ed17
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 22 deletions.
12 changes: 6 additions & 6 deletions src/main/java/io/spokestack/spokestack/ActivationTimeout.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
*
* <ul>
* <li>
* <b>active-min</b> (integer): the minimum length of an
* <b>wake-active-min</b> (integer): the minimum length of an
* activation, in milliseconds, used to ignore a VAD deactivation after
* the manual activation
* </li>
* <li>
* <b>active-max</b> (integer): the maximum length of an
* <b>wake-active-max</b> (integer): the maximum length of an
* activation, in milliseconds, used to time out the activation
* </li>
* </ul>
Expand All @@ -48,10 +48,10 @@ public final class ActivationTimeout implements SpeechProcessor {
*/
public ActivationTimeout(SpeechConfig config) {
int frameWidth = config.getInteger("frame-width");
this.minActive = config.getInteger("active-min", DEFAULT_ACTIVE_MIN)
/ frameWidth;
this.maxActive = config.getInteger("active-max", DEFAULT_ACTIVE_MAX)
/ frameWidth;
this.minActive = config
.getInteger("wake-active-min", DEFAULT_ACTIVE_MIN) / frameWidth;
this.maxActive = config
.getInteger("wake-active-max", DEFAULT_ACTIVE_MAX) / frameWidth;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
* </p>
* <ul>
* <li>
* <b>active-min</b> (integer): the minimum length of time, in
* <b>wake-active-min</b> (integer): the minimum length of time, in
* milliseconds, that the recognizer will wait for speech before timing
* out.
* </li>
Expand All @@ -82,10 +82,9 @@ public class AndroidSpeechRecognizer implements SpeechProcessor {
*
* @param speechConfig Spokestack pipeline configuration
*/
@SuppressWarnings("unused")
public AndroidSpeechRecognizer(SpeechConfig speechConfig) {
this.streaming = false;
this.minActive = speechConfig.getInteger("active-min", 0);
this.minActive = speechConfig.getInteger("wake-active-min", 0);
this.taskHandler = new TaskHandler(true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public SpeechPipeline.Builder apply(SpeechPipeline.Builder builder) {
.setProperty("wake-threshold", 0.9)
.setProperty("pre-emphasis", 0.97)
.addStageClass("io.spokestack.spokestack.ActivationTimeout")
.setProperty("active-min", 2000)
.setProperty("wake-active-min", 2000)
.addStageClass(
"io.spokestack.spokestack.microsoft.AzureSpeechRecognizer");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public SpeechPipeline.Builder apply(SpeechPipeline.Builder builder) {
.setProperty("wake-threshold", 0.9)
.setProperty("pre-emphasis", 0.97)
.addStageClass("io.spokestack.spokestack.ActivationTimeout")
.setProperty("active-min", 2000)
.setProperty("wake-active-min", 2000)
.addStageClass(
"io.spokestack.spokestack.google.GoogleSpeechRecognizer");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public SpeechPipeline.Builder apply(SpeechPipeline.Builder builder) {
.setProperty("wake-threshold", 0.9)
.setProperty("pre-emphasis", 0.97)
.addStageClass("io.spokestack.spokestack.ActivationTimeout")
.setProperty("active-min", 2000)
.setProperty("wake-active-min", 2000)
.addStageClass(
"io.spokestack.spokestack.asr.SpokestackCloudRecognizer");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,6 @@
* [encode-length, encode-width], and its outputs [1]
* </li>
* <li>
* <b>wake-active-min</b> (integer): the minimum length of an activation,
* in milliseconds, used to ignore a VAD deactivation after the wakeword
* </li>
* <li>
* <b>wake-active-max</b> (integer): the maximum length of an activation,
* in milliseconds, used to time out the activation
* </li>
* <li>
* <b>rms-target</b> (double): the desired linear Root Mean Squared (RMS)
* signal energy, which is used for signal normalization and should be
* tuned to the RMS target used during training
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ private SpeechConfig testConfig() {
return new SpeechConfig()
.put("sample-rate", 16000)
.put("frame-width", 10)
.put("active-min", 20)
.put("active-max", 30);
.put("wake-active-min", 20)
.put("wake-active-max", 30);
}

public class TestEnv implements OnSpeechEventListener {
Expand Down

0 comments on commit 989ed17

Please sign in to comment.