JackSharpCore 1.1.1

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

JackSharpCore

.NET bindings for the JACK Audio Connection Kit: clients, ports, real-time-safe audio and MIDI processing, and patching, on Windows, Linux (JACK2, or PipeWire's JACK support) and macOS.

The original repository is residuum/JackSharp, by Thomas Mayer. This fork is based on h3ll5ur7er/JackSharp, which moved it to .NET Core.

NuGet package: JackSharpCore.

Why .NET Core and not .NET Standard?

.NET Standard doesn't provide NativeLibrary, which finds the native JACK library at run time.

Using it

using JackSharp;

// A client with ports and a process callback. Opening throws a JackException if no JACK server is running.
using var processor = new Processor("my-effect");
AudioPort input = processor.RegisterAudioPort("in", Direction.In);
AudioPort output = processor.RegisterAudioPort("out", Direction.Out);

// Runs once per cycle on JACK's real-time thread: buffers are spans on JACK's own memory, and nothing allocates.
processor.Process = context =>
{
    Span<float> from = input.GetBuffer(context), to = output.GetBuffer(context);
    for (int n = 0; n < context.Frames; n++)
        to[n] = from[n] * 0.5f;
};
processor.Activate();

// Every client can see and patch the graph, its own ports and other clients'.
foreach (PortInfo capture in processor.GetPorts(type: PortType.Audio, direction: Direction.Out, physicalOnly: true))
    Console.WriteLine($"{capture.FullName} {string.Join(", ", capture.Aliases)}");
input.ConnectTo("system:capture_1");
output.ConnectTo("system:playback_1");
  • Client is what every JACK client can do: the server's state (SampleRate, BufferSize, CpuLoad), the graph (GetPorts, GetConnections, Connect, Disconnect, GetLatency), and events for the server (rate and buffer size changes, xruns, shutdown) and the graph (clients and ports coming and going, renames, connections). Events arrive on JACK's notification thread.
  • Processor adds ports, registered and unregistered at any time, and the process callback. MIDI is read with MidiPort.GetEvents and written with MidiPort.GetWriter, in place. AddedLatency reports the latency it adds, through JACK's latency callback, so programs downstream can compensate.
  • Controller is a client without ports, for patchbays and monitors.
  • JackLibrary finds libjack: an explicit JackLibrary.Path or JACK_LIBRARY, else the system's (libjack64.dll, libjack.so.0, libjack.0.dylib), then the usual install folders (JACK2's, PipeWire's, Homebrew's and MacPorts'). JackLibrary.SetMessageHandlers routes JACK's error and information messages, which libjack otherwise prints.

Jack.NAudio adapts a Processor to NAudio's IWavePlayer and IWaveIn.

Tests

dotnet test JackSharpTest runs against a JACK server that's already running, or else starts jackd on JACK's dummy backend (a timer, with no sound card) and stops it afterwards. The tests only connect their own ports, never hardware ones. Without libjack or jackd they're skipped.

Known issues

  • JACK2 1.9.22 on Windows can stall in jack_client_close when a client closes within milliseconds of activating (see the unmerged jack2 PR #889). A client therefore stays active at least 100 ms before it deactivates or closes. Repeatedly starting a server, then opening and closing a client while a second client of the same process watches the graph, can still stall a close; the tests don't do that, and a program with one long-lived client won't meet it.
  • JACK2 1.9.22 on Windows ignores UseExactName and opens a second client with the same name. A client whose name JACK changes despite it is closed with a JackException.

Changes in this fork

Before 1.0 (h3ll5ur7er, then this fork):

  • Moved to .NET 8, and added the AudioTranscription sample.
  • Finds the native library with NativeLibrary at run time, rather than by how it was built; resolution moved to the base client, so a Controller created first no longer crashes.
  • Fixed reading MIDI input.
  • Controller.Connect by port name, and a port type Unknown for types other than audio and MIDI.
  • Published as the JackSharpCore NuGet package.

1.1.1:

  • A port without a buffer no longer crashes the process. PipeWire's JACK can answer jack_port_get_buffer with no buffer; that became a span over a null pointer, and clearing it in the cycle (after a callback that had thrown) threw out of the [UnmanagedCallersOnly] callback, which ends the process. AudioPort.GetBuffer now gives an empty span then (check its length before copying a cycle in or out), MIDI ports give no events and no writer, and nothing a cycle throws escapes to JACK: it's counted in ProcessExceptions like the callback's own.

1.1:

  • Processor.AddedLatency reports a processor's own latency through JACK's latency callback: its outputs' capture latency is its inputs' plus what it adds, and its inputs' playback latency its outputs' plus what it adds.

1.0 (breaking):

  • One client, layered as JACK's is. Patching and graph events moved into Client, so a Processor can patch without a second client, and Controller is a client without ports.
  • A process callback that allocates nothing. Buffers are spans on JACK's memory, and MIDI is read and written in place; before, every cycle allocated arrays, copies of each buffer, and objects per port.
  • Ports register and unregister while running. Unregistering waits for any cycle still using the port.
  • Errors say why. Opening throws JackException with JACK's status flags (NoServer, name taken, version mismatch) instead of returning false; a client never starts a server unless asked.
  • Lifecycle fixes. Disposing after the server shuts down, or from a client's own event handler, is safe, and no finalizer calls into libjack.
  • More of JACK: port aliases, latency ranges, CPU load, buffer size changes, and xrun delays.
  • Native loading tries each platform's usual names and folders, PipeWire's included, with an explicit override.
  • Modern interop: generated LibraryImport calls and [UnmanagedCallersOnly] callbacks, compatible with native AOT.
  • Removed the CSCore binding, whose library is no longer maintained, and the unused transport wrappers.
  • Tests rewritten for the new API, starting a dummy JACK server when none is running.

License

MIT, as the original: see LICENSE.

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 (1)

Showing the top 1 NuGet packages that depend on JackSharpCore:

Package Downloads
AudioPlugSharpJack

Jack Audio host for AudioPlugSharp plugins.

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on JackSharpCore:

Repository Stars
mikeoliphant/AudioPlugSharp
Easily create VST (VST3) audio plugins in C# .NET
mikeoliphant/ChartPlayer
Visual player for song charts synchronized to music recordings
Version Downloads Last Updated
1.1.1 48 11/22/2026
0.1.6 383 1/16/2026
0.1.5 140 1/16/2026
0.1.4 141 1/16/2026
0.1.3 142 1/15/2026
0.1.2 771 11/14/2024
0.1.1 218 11/13/2024