![]() |
VOOZH | about |
dotnet add package KPB.VoskWrapper --version 1.1.0
NuGet\Install-Package KPB.VoskWrapper -Version 1.1.0
<PackageReference Include="KPB.VoskWrapper" Version="1.1.0" />
<PackageVersion Include="KPB.VoskWrapper" Version="1.1.0" />Directory.Packages.props
<PackageReference Include="KPB.VoskWrapper" />Project file
paket add KPB.VoskWrapper --version 1.1.0
#r "nuget: KPB.VoskWrapper, 1.1.0"
#:package KPB.VoskWrapper@1.1.0
#addin nuget:?package=KPB.VoskWrapper&version=1.1.0Install as a Cake Addin
#tool nuget:?package=KPB.VoskWrapper&version=1.1.0Install as a Cake Tool
👁 License
👁 NuGet version (KPB.VoskWrapper)
This library is intended for people that want to quickly get startet with the Vosk speech recognition toolkit in a .NET environment and find the official examples insufficient or too complicated for live processing workloads. It should be thread safe, but I don't want to advertise it as such since I am not completely certain that deadlocks and race conditions are impossible.
For live speech to text processing, NAudio is used. This means that although this is a .NET Standard 2.0 library, it depends on Windows specific features for this functionality.
I hope that the code itself and the documentation comments prove to be helpful in understanding and working with the Vosk library, since I find some behavior of it very unintuitive or badly documented and I have either addressed or explained these things in this library.
using KPB.VoskWrapper;
foreach (var device in VoskWrapper.InputDevices)
{
Console.WriteLine(device);
}
(0, Mikrofon (Realtek High Definiti, 2, 00000000-0000-0000-0000-000000000000, e36dc311-6d9a-11d1-a21a-00a0c9223196, d5a47fa8-6d98-11d1-a21a-00a0c9223196)
using var model = await VoskModel.CreateAsync(@"models\vosk-model-en-us-0.22-lgraph");
using var vw = await VoskWrapper.CreateAsync(model, sampleRate: 8000, maxAlternatives: 0, returnWords: false, grammar: new[] { "toast", "test", "[unk]" });
vw.ResultAvailable += res =>
{
foreach (var result in res)
{
Console.WriteLine(result.Text);
}
};
Console.WriteLine(vw.IsProcessing);
vw.StartLiveProcessing(inputDevice: 0);
Console.WriteLine(vw.IsProcessing);
False
True
[unk] toast test [unk] [unk]
var res = await vw.ProcessFileAsync(@"samples\male_8khz.wav");
Console.WriteLine(res[0].Text);
but what if somebody decides to break it be careful that you keep adequate coverage but look for places to save money ...
If you have any issues with this library or want to make a suggestion for an improvement, feel free to create an issue. If you want to take things into your own hands, feel free to create a merge request. Just try to keep the code style similar to mine.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
1.1.0 (2023-09-30)
Added
- Runtime checks for Windows specific methods
Changed
- IsProcessing now throws an ObjectDisposedException instead of returning false after disposal
- Sealed VoskResult, VoskWordResult and VoskAlternatives
- Improved efficiency of invalid result removal
1.0.1 (2023-09-30)
Fixed
- Vosk logs being displayed if VoskModel was used before VoskWrapper
1.0.0 (2022-08-05)
- Initial release