Expose dither for JNI (#2215)

This commit is contained in:
esavin
2025-05-14 18:38:25 +03:00
committed by GitHub
parent 2e9e0b4e9e
commit aeb311db50
5 changed files with 21 additions and 0 deletions

View File

@@ -6,10 +6,12 @@ package com.k2fsa.sherpa.onnx;
public class FeatureConfig {
private final int sampleRate;
private final int featureDim;
private final float dither;
private FeatureConfig(Builder builder) {
this.sampleRate = builder.sampleRate;
this.featureDim = builder.featureDim;
this.dither = builder.dither;
}
public static Builder builder() {
@@ -24,9 +26,14 @@ public class FeatureConfig {
return featureDim;
}
public float getDither() {
return dither;
}
public static class Builder {
private int sampleRate = 16000;
private int featureDim = 80;
private float dither = 0.0f;
public FeatureConfig build() {
return new FeatureConfig(this);
@@ -41,5 +48,9 @@ public class FeatureConfig {
this.featureDim = featureDim;
return this;
}
public Builder setDither(float dither) {
this.dither = dither;
return this;
}
}
}