FieldCure.DocumentParsers.Audio 0.2.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package FieldCure.DocumentParsers.Audio --version 0.2.2
                    
NuGet\Install-Package FieldCure.DocumentParsers.Audio -Version 0.2.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FieldCure.DocumentParsers.Audio" Version="0.2.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FieldCure.DocumentParsers.Audio" Version="0.2.2" />
                    
Directory.Packages.props
<PackageReference Include="FieldCure.DocumentParsers.Audio" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FieldCure.DocumentParsers.Audio --version 0.2.2
                    
#r "nuget: FieldCure.DocumentParsers.Audio, 0.2.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package FieldCure.DocumentParsers.Audio@0.2.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=FieldCure.DocumentParsers.Audio&version=0.2.2
                    
Install as a Cake Addin
#tool nuget:?package=FieldCure.DocumentParsers.Audio&version=0.2.2
                    
Install as a Cake Tool

FieldCure.DocumentParsers.Audio

Audio transcription support for FieldCure.DocumentParsers.

This package adds an IDocumentParser for .mp3, .wav, .m4a, .ogg, .flac, and .webm files. Audio is converted to 16 kHz mono PCM WAV with NAudio, then transcribed with Whisper.net into timestamped Markdown for RAG pipelines.

Install

dotnet add package FieldCure.DocumentParsers.Audio

Usage

using FieldCure.DocumentParsers;
using FieldCure.DocumentParsers.Audio;

await using var transcriber = DocumentParserFactoryAudioExtensions.AddAudioSupport();

var parser = DocumentParserFactory.GetParser(".mp3")!;
var markdown = parser.ExtractText(File.ReadAllBytes("meeting.mp3"));

For explicit options, instantiate AudioDocumentParser directly:

var parser = new AudioDocumentParser();
var markdown = parser.ExtractText(
    File.ReadAllBytes("meeting.m4a"),
    new AudioExtractionOptions
    {
        SourceExtension = ".m4a",
        Language = "ko",
        ModelSize = WhisperModelSize.Base,
        IncludeTimestamps = true
    });

Set ModelPath to use a pre-downloaded ggml model. Otherwise the default model provider downloads the selected model from Hugging Face on first use and caches it under {UserProfile}/.fieldcure/whisper-models/.

WhisperModelSize.Large resolves to ggml-large-v2 (≈ 3 GB) — large-v3 hallucinates repetition loops on long-form audio, so v2 is the safer default. See RELEASENOTES.DocumentParsers.Audio.md for the v0.2.1 entry behind this choice.

Environment-aware model selection

Instead of hard-coding a ModelSize, let the library pick one based on the detected GPU / RAM / cores of the host:

using FieldCure.DocumentParsers.Audio;

var recommended = WhisperEnvironment.RecommendModelSize(); // QualityBias.Accuracy default
var options = AudioExtractionOptions.Default.WithModelSize(recommended);

// Diagnostic snapshot (CUDA/Vulkan flags, RAM, cores)
var probe = WhisperEnvironment.Probe();
Console.Error.WriteLine(
    $"[Audio] CUDA={probe.CudaAvailable} Vulkan={probe.VulkanAvailable} " +
    $"RAM={probe.SystemRamBytes / (1024L * 1024 * 1024)}GB → {recommended}");

The balanced matrix (used directly by QualityBias.Balanced):

Environment Recommended model
GPU available, RAM ≥ 16 GB Large
GPU available, RAM ≥ 8 GB Medium
CPU only, RAM ≥ 16 GB, cores ≥ 8 Small
CPU only, RAM ≥ 8 GB Base
Otherwise Tiny

QualityBias.Accuracy (default) shifts the recommendation one tier up — fits batch indexing where transcription latency is acceptable. QualityBias.Speed shifts one tier down for interactive flows.

AudioExtractionOptions.WithModelSize(WhisperModelSize) is a class-friendly substitute for the with expression syntax (the type is a class, not a record), useful when downstream layers want to override only the model size while preserving the rest of the options.

Lifecycle

WhisperTranscriber caches the underlying WhisperFactory for the model path in use, so it holds native resources for as long as it lives. Dispose it once at application shutdown:

// Startup
var transcriber = DocumentParserFactoryAudioExtensions.AddAudioSupport();

// Shutdown
await transcriber.DisposeAsync();

When you construct AudioDocumentParser() with no arguments it owns its transcriber, and await using on the parser disposes it for you.

Runtime selection (CUDA / Vulkan / CPU)

Whisper.net resolves the native runtime through process-global state (Whisper.net.LibraryLoader.RuntimeOptions.RuntimeLibraryOrder). To override the default CUDA → Vulkan → CPU order, set it once at startup rather than per call:

using Whisper.net.LibraryLoader;

// App startup
RuntimeOptions.RuntimeLibraryOrder = [RuntimeLibrary.Cpu];

AudioExtractionOptions.RuntimeLibraryOrder writes to the same global, which is convenient for one-off configuration but is last-writer-wins under concurrent calls.

Notes

  • The package is Windows-only because audio decoding uses NAudio's Media Foundation path for several containers. The assembly carries [SupportedOSPlatform("windows")].
  • The ggml model is downloaded at runtime; it is not included in the NuGet package.
  • For tests or cloud transcription, inject a custom IAudioTranscriber.
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.4.0 112 4/29/2026
0.3.1 107 4/28/2026
0.3.0 99 4/28/2026
0.2.2 100 4/27/2026
0.2.1 98 4/27/2026
0.2.0 95 4/27/2026
0.1.0 103 4/26/2026

v0.2.2 - Whisper model cache directory on Windows moves from %USERPROFILE%\.fieldcure\whisper-models to %LOCALAPPDATA%\FieldCure\WhisperModels to match the rest of the FieldCure ecosystem (Mcp.Rag, AssistStudio). Unix path (~/.fieldcure/whisper-models) is unchanged. No automatic migration: existing models are re-downloaded on first use unless the user copies the cache manually (see RELEASENOTES.md).