Remove sample rate parameter usage from Java binding

This commit is contained in:
Reuben Morais 2019-10-09 16:51:32 +02:00
parent 385279bc20
commit 1007d93da2
3 changed files with 9 additions and 12 deletions

View File

@ -100,7 +100,7 @@ public class DeepSpeechActivity extends AppCompatActivity {
long inferenceStartTime = System.currentTimeMillis(); long inferenceStartTime = System.currentTimeMillis();
String decoded = this._m.stt(shorts, shorts.length, sampleRate); String decoded = this._m.stt(shorts, shorts.length);
inferenceExecTime = System.currentTimeMillis() - inferenceStartTime; inferenceExecTime = System.currentTimeMillis() - inferenceStartTime;

View File

@ -104,9 +104,9 @@ public class BasicTest {
ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN).asShortBuffer().get(shorts); ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN).asShortBuffer().get(shorts);
if (extendedMetadata) { if (extendedMetadata) {
return metadataToString(m.sttWithMetadata(shorts, shorts.length, sampleRate)); return metadataToString(m.sttWithMetadata(shorts, shorts.length));
} else { } else {
return m.stt(shorts, shorts.length, sampleRate); return m.stt(shorts, shorts.length);
} }
} catch (FileNotFoundException ex) { } catch (FileNotFoundException ex) {

View File

@ -59,12 +59,11 @@ public class DeepSpeechModel {
* @param buffer A 16-bit, mono raw audio signal at the appropriate * @param buffer A 16-bit, mono raw audio signal at the appropriate
* sample rate. * sample rate.
* @param buffer_size The number of samples in the audio signal. * @param buffer_size The number of samples in the audio signal.
* @param sample_rate The sample-rate of the audio signal.
* *
* @return The STT result. * @return The STT result.
*/ */
public String stt(short[] buffer, int buffer_size, int sample_rate) { public String stt(short[] buffer, int buffer_size) {
return impl.SpeechToText(this._msp, buffer, buffer_size, sample_rate); return impl.SpeechToText(this._msp, buffer, buffer_size);
} }
/** /**
@ -74,12 +73,11 @@ public class DeepSpeechModel {
* @param buffer A 16-bit, mono raw audio signal at the appropriate * @param buffer A 16-bit, mono raw audio signal at the appropriate
* sample rate. * sample rate.
* @param buffer_size The number of samples in the audio signal. * @param buffer_size The number of samples in the audio signal.
* @param sample_rate The sample-rate of the audio signal.
* *
* @return Outputs a Metadata object of individual letters along with their timing information. * @return Outputs a Metadata object of individual letters along with their timing information.
*/ */
public Metadata sttWithMetadata(short[] buffer, int buffer_size, int sample_rate) { public Metadata sttWithMetadata(short[] buffer, int buffer_size) {
return impl.SpeechToTextWithMetadata(this._msp, buffer, buffer_size, sample_rate); return impl.SpeechToTextWithMetadata(this._msp, buffer, buffer_size);
} }
/** /**
@ -87,12 +85,11 @@ public class DeepSpeechModel {
* by this function can then be passed to feedAudioContent() * by this function can then be passed to feedAudioContent()
* and finishStream(). * and finishStream().
* *
* @param sample_rate The sample-rate of the audio signal.
* @return An opaque object that represents the streaming state. * @return An opaque object that represents the streaming state.
*/ */
public DeepSpeechStreamingState createStream(int sample_rate) { public DeepSpeechStreamingState createStream() {
SWIGTYPE_p_p_StreamingState ssp = impl.new_streamingstatep(); SWIGTYPE_p_p_StreamingState ssp = impl.new_streamingstatep();
impl.CreateStream(this._msp, sample_rate, ssp); impl.CreateStream(this._msp, ssp);
return new DeepSpeechStreamingState(impl.streamingstatep_value(ssp)); return new DeepSpeechStreamingState(impl.streamingstatep_value(ssp));
} }