DspFiltersNet 1.1.0

dotnet add package DspFiltersNet --version 1.1.0
                    
NuGet\Install-Package DspFiltersNet -Version 1.1.0
                    
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="DspFiltersNet" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DspFiltersNet" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="DspFiltersNet" />
                    
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 DspFiltersNet --version 1.1.0
                    
#r "nuget: DspFiltersNet, 1.1.0"
                    
#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.
#addin nuget:?package=DspFiltersNet&version=1.1.0
                    
Install DspFiltersNet as a Cake Addin
#tool nuget:?package=DspFiltersNet&version=1.1.0
                    
Install DspFiltersNet as a Cake Tool

DspFiltersNet

Continuous Integration alternate text is missing from this package README image GitHub

DspFiltersNet is a digital signal processing library for .NET 8.0.

It allows the creation of the following FilterTypes:

  1. MovingAverage
  2. FrequencyFilters

For FrequencyFilters it allows the creation of the following filter design types:

  1. Butterworth
  2. Bessel
  3. Chebyshev Type I
  4. Chebyshev Type II
  5. Elliptic

The package supports the creation of Lowpass, Highpass, Bandpass and Bandstop filters up to order 16.

The package only supports Filters and does not have other features. For more DSP features in C# you may want to check out <img src="https://raw.githubusercontent.com/ar1st0crat/NWaves/master/assets/logo/logo_draft.bmp" alt="NWaves" height="18"/> NWaves

Example Usage

using DspFiltersNet;

class Program
{
    static void Main()
    {
        // Define a butterworth lowpass of second order with a cutoff frequency of 10Hz and a sampling frequency of 1kHz.
        var filterData = new ButterworthFilterDefinition(FrequencyFilterType.LowPass, 10, 0, 2, 1000);
        // Create your filter instance
        var filterInstance = new FrequencyFilterInstance(filterData);
        // Use the filter instance to process your samples (single sample mode also available)
        var result = filterInstance.ProcessSamples([0.0000000000000000D, 0.5941312281110626D, 0.9637482198843191D, 0.9700934515686609D, 0.6131666751454520D]);
    }
}

Remarks

The frequency filters provided by this implementation use the transfer functions to filter your data. According to multiple documentations this can cause some stability problems and using SOS (second order sections) would be better but is currently not implemented

This library just creates filters based on the users input parameters. The user is still responsible to select plausible filter settings that work nice with the provided data.

Internal function

The package first creates an analog lowpass prototype of the selected settings similar to the matlab functions besselap, butterap, cheb1ap and cheb2ap. After that the lowpass prototype is converted to the selected filter (Lowpass, Highpass, Bandpass, Bandstop). This all works on the Zeros, Poles and Gain notation. After that the filter is transformed to a digital filter using the bilinear transform. In the end the Zeros, Poles and Gain returned from the bilinear transform are converted to a transfer function which is then used to in the filter instance to filter user data.

Validation

The code is validated with UnitTests against testdata generated with Matlab and with SciPy and should match these implementations pretty much perfectly (1e-14).

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 was computed.  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.
  • net8.0

    • No dependencies.

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
1.1.0 150 4/27/2025
1.0.1 153 4/24/2025
0.0.1 151 4/24/2025