diff --git a/native_client/dotnet/DeepSpeechClient/DeepSpeech.cs b/native_client/dotnet/DeepSpeechClient/DeepSpeech.cs
index 25fcc109..9bbf5e3c 100644
--- a/native_client/dotnet/DeepSpeechClient/DeepSpeech.cs
+++ b/native_client/dotnet/DeepSpeechClient/DeepSpeech.cs
@@ -64,6 +64,15 @@ namespace DeepSpeechClient
EvaluateResultCode(resultCode);
}
+ ///
+ /// Return the sample rate expected by the model.
+ ///
+ /// Sample rate.
+ public unsafe int GetModelSampleRate()
+ {
+ return NativeImp.DS_GetModelSampleRate(_modelStatePP);
+ }
+
///
/// Evaluate the result code and will raise an exception if necessary.
///
diff --git a/native_client/dotnet/DeepSpeechClient/Interfaces/IDeepSpeech.cs b/native_client/dotnet/DeepSpeechClient/Interfaces/IDeepSpeech.cs
index 79af2964..f7bbee98 100644
--- a/native_client/dotnet/DeepSpeechClient/Interfaces/IDeepSpeech.cs
+++ b/native_client/dotnet/DeepSpeechClient/Interfaces/IDeepSpeech.cs
@@ -24,6 +24,12 @@ namespace DeepSpeechClient.Interfaces
string aAlphabetConfigPath,
uint aBeamWidth);
+ ///
+ /// Return the sample rate expected by the model.
+ ///
+ /// Sample rate.
+ unsafe int GetModelSampleRate();
+
///
/// Enable decoding using beam scoring with a KenLM language model.
///
diff --git a/native_client/dotnet/DeepSpeechClient/NativeImp.cs b/native_client/dotnet/DeepSpeechClient/NativeImp.cs
index 74de9197..92cdb150 100644
--- a/native_client/dotnet/DeepSpeechClient/NativeImp.cs
+++ b/native_client/dotnet/DeepSpeechClient/NativeImp.cs
@@ -20,6 +20,9 @@ namespace DeepSpeechClient
uint aBeamWidth,
ref IntPtr** pint);
+ [DllImport("libdeepspeech.so", CallingConvention = CallingConvention.Cdecl)]
+ internal unsafe static extern int DS_GetModelSampleRate(IntPtr** aCtx);
+
[DllImport("libdeepspeech.so", CallingConvention = CallingConvention.Cdecl)]
internal static unsafe extern ErrorCodes DS_EnableDecoderWithLM(IntPtr** aCtx,
string aLMPath,