![]() |
VOOZH | about |
dotnet add package FieldCure.DocumentParsers.Audio --version 0.4.0
NuGet\Install-Package FieldCure.DocumentParsers.Audio -Version 0.4.0
<PackageReference Include="FieldCure.DocumentParsers.Audio" Version="0.4.0" />
<PackageVersion Include="FieldCure.DocumentParsers.Audio" Version="0.4.0" />Directory.Packages.props
<PackageReference Include="FieldCure.DocumentParsers.Audio" />Project file
paket add FieldCure.DocumentParsers.Audio --version 0.4.0
#r "nuget: FieldCure.DocumentParsers.Audio, 0.4.0"
#:package FieldCure.DocumentParsers.Audio@0.4.0
#addin nuget:?package=FieldCure.DocumentParsers.Audio&version=0.4.0Install as a Cake Addin
#tool nuget:?package=FieldCure.DocumentParsers.Audio&version=0.4.0Install as a Cake Tool
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.
dotnet add package FieldCure.DocumentParsers.Audio
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.
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.
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.
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.
[SupportedOSPlatform("windows")].IAudioTranscriber.| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. 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 is compatible. 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. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
v0.4.0 - Transcript metadata now reflects the model the transcriber actually used, not the model the caller asked for. Adds IModelSizeReporting, an opt-in capability interface that an IAudioTranscriber implementation (e.g. a lazy/wrapping transcriber that overrides the model internally) can implement to report its EffectiveModelSize. When present, AudioDocumentParser overrides both ModelSize and ModelPath in the formatting options so the rendered "| Model |" header reflects the effective model rather than the caller-supplied path. Also adds AudioExtractionOptions.WithEffectiveModel for callers building options manually. Existing transcribers and callers are unaffected; this is a purely additive change.