BlipBuf.Net 1.0.1

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

BlipBuf.Net

A .NET port of blip_buf by Shay Green (aka blargg). BlipBuf.Net enables easy high-quality resampling of PSG-like audio (the kind that was present in 1980s-era sound chips, featuring square and sawtooth waves). Simply set the input clock rate and output sample rate, add waveforms by specifying the clock times where their amplitude changes, then reads the resulting output samples. BlipBuf.Net uses band-limited synthesis to avoid the aliasing that would typically be present when resampling this kind of audio. For more information on the algorithm, see Shay Green's articles: Band-Limited Sound Synthesis.

Usage

Install NuGet Package
dotnet add package BlipBuf.Net
Install-Package BlipBuf.Net
Use BlipBuf.Net
using BlipBufDotNet;

double clockRate = 1000000.0; // Input clock rate
double sampleRate = 48000.0; // Output sample rate
int bufLength = 4800; // Number of samples the buffer can hold
var blipBuf = new BlipBuf(bufLength, clockRate, sampleRate); // Create a BlipBuf
blipBuf.SetRates(clockRate / 2, sampleRate); // Adjust clock/sample rates if needed.
blipBuf.AddDelta(30, -5000); // Add a delta of -5000 at clock offset 30. Deltas should be in the range of signed 16-bit samples.
blipBuf.AddDeltaFast(30, -5000); // Same as above, but using a faster and lower-quality synthesis.
int clocksNeeded = blipBuf.GetClocksNeeded(100); // Number of clocks needed to make 100 additional samples available.
blipBuf.EndFrame(200); // Makes input clocks before 200 available for reading as output samples, and restarts the frame at 0 clocks.
short[] outputBuffer = new short[200];
blipBuf.ReadSamples(outputBuffer, 200, stereo: false); // Read and remove 200 16-bit signed samples and write them to outputBuffer.
float[] floatBuffer = new float[200]
blipBuf.ReadFloatSamples(floatBuffer, 200, stereo: false); // Same as above, but produces 32-bit floating point samples.
blipBuf.Clear(); // Clear the buffer
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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.
  • net9.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.0.1 444 7/23/2025
1.0.0 495 7/22/2025