diff --git a/native_client/dotnet/DeepSpeechClient/DeepSpeech.cs b/native_client/dotnet/DeepSpeechClient/DeepSpeech.cs index 19247507..84a7fa2b 100644 --- a/native_client/dotnet/DeepSpeechClient/DeepSpeech.cs +++ b/native_client/dotnet/DeepSpeechClient/DeepSpeech.cs @@ -193,11 +193,10 @@ namespace DeepSpeechClient /// /// Creates a new streaming inference state. /// - /// The sample-rate of the audio signal /// Thrown when the native binary failed to initialize the streaming mode. - public unsafe void CreateStream(uint aSampleRate) + public unsafe void CreateStream() { - var resultCode = NativeImp.DS_CreateStream(_modelStatePP, aSampleRate, ref _streamingStatePP); + var resultCode = NativeImp.DS_CreateStream(_modelStatePP, ref _streamingStatePP); EvaluateResultCode(resultCode); } @@ -232,11 +231,10 @@ namespace DeepSpeechClient /// /// A 16-bit, mono raw audio signal at the appropriate sample rate. /// The number of samples in the audio signal. - /// The sample-rate of the audio signal. /// The STT result. The user is responsible for freeing the string. Returns NULL on error. - public unsafe string SpeechToText(short[] aBuffer, uint aBufferSize, uint aSampleRate) + public unsafe string SpeechToText(short[] aBuffer, uint aBufferSize) { - return NativeImp.DS_SpeechToText(_modelStatePP, aBuffer, aBufferSize, aSampleRate).PtrToString(); + return NativeImp.DS_SpeechToText(_modelStatePP, aBuffer, aBufferSize).PtrToString(); } /// @@ -244,11 +242,10 @@ namespace DeepSpeechClient /// /// A 16-bit, mono raw audio signal at the appropriate sample rate. /// The number of samples in the audio signal. - /// The sample-rate of the audio signal. /// The extended metadata. The user is responsible for freeing the struct. Returns NULL on error. - public unsafe Models.Metadata SpeechToTextWithMetadata(short[] aBuffer, uint aBufferSize, uint aSampleRate) + public unsafe Models.Metadata SpeechToTextWithMetadata(short[] aBuffer, uint aBufferSize) { - return NativeImp.DS_SpeechToTextWithMetadata(_modelStatePP, aBuffer, aBufferSize, aSampleRate).PtrToMetadata(); + return NativeImp.DS_SpeechToTextWithMetadata(_modelStatePP, aBuffer, aBufferSize).PtrToMetadata(); } #endregion diff --git a/native_client/dotnet/DeepSpeechClient/Interfaces/IDeepSpeech.cs b/native_client/dotnet/DeepSpeechClient/Interfaces/IDeepSpeech.cs index 04ad086c..da18a8ba 100644 --- a/native_client/dotnet/DeepSpeechClient/Interfaces/IDeepSpeech.cs +++ b/native_client/dotnet/DeepSpeechClient/Interfaces/IDeepSpeech.cs @@ -42,22 +42,18 @@ namespace DeepSpeechClient.Interfaces /// /// A 16-bit, mono raw audio signal at the appropriate sample rate. /// The number of samples in the audio signal. - /// The sample-rate of the audio signal. /// The STT result. The user is responsible for freeing the string. Returns NULL on error. unsafe string SpeechToText(short[] aBuffer, - uint aBufferSize, - uint aSampleRate); + uint aBufferSize); /// /// Use the DeepSpeech model to perform Speech-To-Text. /// /// A 16-bit, mono raw audio signal at the appropriate sample rate. /// The number of samples in the audio signal. - /// The sample-rate of the audio signal. /// The extended metadata result. The user is responsible for freeing the struct. Returns NULL on error. unsafe Metadata SpeechToTextWithMetadata(short[] aBuffer, - uint aBufferSize, - uint aSampleRate); + uint aBufferSize); /// /// Destroy a streaming state without decoding the computed logits. @@ -79,9 +75,8 @@ namespace DeepSpeechClient.Interfaces /// /// Creates a new streaming inference state. /// - /// The sample-rate of the audio signal /// Thrown when the native binary failed to initialize the streaming mode. - unsafe void CreateStream(uint aSampleRate); + unsafe void CreateStream(); /// /// Feeds audio samples to an ongoing streaming inference. diff --git a/native_client/dotnet/DeepSpeechClient/NativeImp.cs b/native_client/dotnet/DeepSpeechClient/NativeImp.cs index 3f126acc..74de9197 100644 --- a/native_client/dotnet/DeepSpeechClient/NativeImp.cs +++ b/native_client/dotnet/DeepSpeechClient/NativeImp.cs @@ -31,21 +31,19 @@ namespace DeepSpeechClient CharSet = CharSet.Ansi, SetLastError = true)] internal static unsafe extern IntPtr DS_SpeechToText(IntPtr** aCtx, short[] aBuffer, - uint aBufferSize, - uint aSampleRate); + uint aBufferSize); [DllImport("libdeepspeech.so", CallingConvention = CallingConvention.Cdecl, SetLastError = true)] internal static unsafe extern IntPtr DS_SpeechToTextWithMetadata(IntPtr** aCtx, short[] aBuffer, - uint aBufferSize, - uint aSampleRate); + uint aBufferSize); [DllImport("libdeepspeech.so", CallingConvention = CallingConvention.Cdecl)] internal static unsafe extern void DS_FreeModel(IntPtr** aCtx); [DllImport("libdeepspeech.so", CallingConvention = CallingConvention.Cdecl)] internal static unsafe extern ErrorCodes DS_CreateStream(IntPtr** aCtx, - uint aSampleRate, ref IntPtr** retval); + ref IntPtr** retval); [DllImport("libdeepspeech.so", CallingConvention = CallingConvention.Cdecl)] internal static unsafe extern void DS_FreeStream(ref IntPtr** aSctx); diff --git a/native_client/dotnet/DeepSpeechConsole/Program.cs b/native_client/dotnet/DeepSpeechConsole/Program.cs index 0940e63c..5085fd21 100644 --- a/native_client/dotnet/DeepSpeechConsole/Program.cs +++ b/native_client/dotnet/DeepSpeechConsole/Program.cs @@ -91,12 +91,12 @@ namespace CSharpExamples string speechResult; if (extended) { - Metadata metaResult = sttClient.SpeechToTextWithMetadata(waveBuffer.ShortBuffer, Convert.ToUInt32(waveBuffer.MaxSize / 2), 16000); + Metadata metaResult = sttClient.SpeechToTextWithMetadata(waveBuffer.ShortBuffer, Convert.ToUInt32(waveBuffer.MaxSize / 2)); speechResult = MetadataToString(metaResult); } else { - speechResult = sttClient.SpeechToText(waveBuffer.ShortBuffer, Convert.ToUInt32(waveBuffer.MaxSize / 2), 16000); + speechResult = sttClient.SpeechToText(waveBuffer.ShortBuffer, Convert.ToUInt32(waveBuffer.MaxSize / 2)); } stopwatch.Stop();