Spek.NET
0.3.0-preview.1
dotnet add package Spek.NET --version 0.3.0-preview.1
NuGet\Install-Package Spek.NET -Version 0.3.0-preview.1
<PackageReference Include="Spek.NET" Version="0.3.0-preview.1" />
<PackageVersion Include="Spek.NET" Version="0.3.0-preview.1" />
<PackageReference Include="Spek.NET" />
paket add Spek.NET --version 0.3.0-preview.1
#r "nuget: Spek.NET, 0.3.0-preview.1"
#:package Spek.NET@0.3.0-preview.1
#addin nuget:?package=Spek.NET&version=0.3.0-preview.1&prerelease
#tool nuget:?package=Spek.NET&version=0.3.0-preview.1&prerelease
Spek.NET
Spek.NET turns an audio file into a spectrogram based on Spek, with its palettes, window functions, dB scale and rulers. Fast analysis preserves the existing overview behavior. Optional detailed analysis uses centred, file-anchored FFTs and linear-power pixel averages. It has no UI. For a WinUI 3 control, use Spek.NET.WinUI.
Spek.NET decodes with ffmpeg.exe, which it runs as a separate process. The package doesn't include ffmpeg.
using Spek.Net;
var ffmpeg = new Ffmpeg(Ffmpeg.Find([]) ?? throw new FileNotFoundException("ffmpeg isn't on PATH."));
var info = await ffmpeg.ProbeAsync(@"C:\Music\song.flac");
if (info.Error != AudioError.None) throw new InvalidOperationException(SpekDescription.ErrorText(info.Error));
var settings = new AnalysisSettings(Channel: 0, FftBits: 11, WindowFunction: WindowFunction.Hann);
var spectrogram = new Spectrogram(800, SpekDefaults.BinsFor(settings.FftBits), Palette.Spectrum, lowerDb: -120, upperDb: 0);
await SpekAnalyzer.AnalyzeAsync(ffmpeg, info, settings, spectrogram);
// spectrogram.Pixels holds 800 x 1025 BGRA pixels, with the highest frequency in the top row.
// spectrogram.GetValue(x, bin) is the level of one bin in dB.
Ffmpeg.ProbeAsyncreads the streams, sample rate, channels, bit depth, bitrate and duration from ffmpeg's output.SpekAnalyzer.AnalyzeAsyncdecodes one channel of one stream and fills theSpectrogramcolumn by column.AnalysisSettings.Qualitydefaults toAnalysisQuality.Fast; opt into the dense engine withsettings with { Quality = AnalysisQuality.Detailed }. Cancelling the token stops ffmpeg.Spectrogram.SetRangeAndPaletterecolours without analysing again.SpectrogramPipelineseparates fixed-grid FFT measurements from display columns, for samples from another decoder. Its existing constructor uses a hop of FFT size / 16. The extended constructor accepts the absolutestartFrameandhopSize;SpekDefaults.HopSizeForselects the same quality-first spacing used by the analyser. Feed PCM fromInputStartFramethroughInputEndFrame, clipped at the real file boundaries, then callComplete. Those input bounds include context on both sides of the visible interval.HopSizeandMeasurementsDoneexpose the actual cadence and work count. The cancellation-awarePushandCompleteoverloads can stop between FFTs.SpekDescriptionandRulergive Spek's description line and ruler ticks.Spectrogram.GetProfile(firstColumn, endColumn, sampleRate)measures a selected passage's spectrum.SpectrumProfile.FindDrop()returns an optional measured spectral drop, not an estimate of the original codec or bitrate. A deliberately low-pass-filtered master can produce the same result.FrequencyRangeandTimeRangehandle coordinates and anchored zoom.EncoderReferences.Mp3Lamelists nominal LAME stereo CBR low-pass targets as optional inspection guides, not universal MP3 boundaries.SpekAnalyzer.AnalyzeRangeAsyncfills a separate spectrogram for an absolute time interval. Fast mode retains the original trailing-window behavior. Detailed mode uses the same file-anchored grid as an explicitly detailed whole-file analysis and reads context on both sides. Only the requested interval contributes to its pixels.Ffmpeg.DecodeRangeAsyncexposes the bounded PCM decode. Cancellation stops the child process.
Detailed mode uses approximately 1 ms or smaller hops, with at least 16 windows per FFT length. Changing pixel width does not change that grid. Each pixel is the time-weighted mean of overlapping measurement cells in linear power, converted to dB once. Silence contributes zero power instead of forcing an entire average to negative infinity. Fast mode deliberately retains the original column-dependent dB average. Both use Spek's normalized FFT scale, not calibrated PSD. The dense grid does not remove the FFT time/frequency tradeoff. See the design and tradeoffs for this preview.
Licensed under GPL-3.0, like Spek. Source: https://github.com/DerekYang2/spek-z
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net10.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Spek.NET:
| Package | Downloads |
|---|---|
|
Spek.NET.WinUI
A WinUI 3 control that draws Spek's spectrogram of an audio file with Win2D as it decodes, and saves it as a PNG. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.3.0-preview.1 | 229 | 10/17/2026 |
| 0.2.0 | 139 | 10/17/2026 |
| 0.1.0 | 120 | 10/15/2026 |