Expose and use model sample rate in Java
This commit is contained in:
parent
4dc18dd8ee
commit
673d620a67
@ -77,7 +77,7 @@ public class DeepSpeechActivity extends AppCompatActivity {
|
||||
// tv_numChannels.setText("numChannels=" + (numChannels == 1 ? "MONO" : "!MONO"));
|
||||
|
||||
wave.seek(24); int sampleRate = this.readLEInt(wave);
|
||||
assert (sampleRate == 16000); // 16000 Hz
|
||||
assert (sampleRate == this._m.sampleRate()); // desired sample rate
|
||||
// tv_sampleRate.setText("sampleRate=" + (sampleRate == 16000 ? "16kHz" : "!16kHz"));
|
||||
|
||||
wave.seek(34); char bitsPerSample = this.readLEChar(wave);
|
||||
|
@ -32,6 +32,15 @@ public class DeepSpeechModel {
|
||||
this._msp = impl.modelstatep_value(this._mspp);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the sample rate expected by the model.
|
||||
*
|
||||
* @return Sample rate.
|
||||
*/
|
||||
public int sampleRate() {
|
||||
return impl.GetModelSampleRate(this._msp);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Frees associated resources and destroys model object.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user