Skip to content

About

Processing/p5.js-style creative coding for C# — write a Sketch, override Setup()/Draw(), and run it in a purpose-built desktop IDE with live diagnostics, 2D + real 3D rendering, and one-click NuGet packages.

Topics

Resources

Stars

9 stars

Watchers

0 watching

Forks

Repository files navigation

DanaProcessing logo

DanaProcessing

Creative coding in C#, the Processing way.
2D, real 3D and a live-coding audio engine, with a desktop IDE built just for sketching.

Build and Release .NET 10 Platforms License: MIT Documentation

Documentation · Download · Sound · Support

DanaProcessing: a live loop and a Draw() that reacts to the sound

✨ Why it exists

I started programming with Java and JavaScript following The Coding Train, sketching in Processing and p5.js. When I moved to C#, I wanted that same experience and couldn't find it, so I built it.

DanaProcessing borrows Processing's vocabulary on purpose: Setup(), Draw(), Fill(), Rect(), Translate(), PVector, Noise(). If you've written a Processing sketch, you can already read one of these. Then it adds what C# and .NET make possible: a real IDE, any NuGet package as a library, real 3D, and its own sound engine.

🎨 A sketch is this small

public class MySketch : Sketch
{
    private float angle;

    public override void Setup() => Size(800, 600);

    public override void Draw()
    {
        Background(20, 20, 30);
        Translate(Width / 2f, Height / 2f);
        Rotate(angle += 1f);
        Fill(255, 150, 90);
        NoStroke();
        Rect(-100, -100, 200, 200);
    }
}
Same idea in 3D: change one word
public class MySketch : Sketch
{
    private float angle;

    public override void Setup() => Size(800, 600, RendererKind.Renderer3D);

    public override void Draw()
    {
        Background(20, 20, 30);
        Lights();
        Translate(Width / 2f, Height / 2f, 0);
        RotateY(angle += 0.02f);
        Fill(255, 150, 90);
        Box(200);
    }
}

Real geometry, real lighting, no separate engine to learn.

🎵 Live-coded sound

A music engine inspired by Sonic Pi, written from scratch in C# and running inside the sketch, so what you hear and what you draw share one clock. Mark a method as a [LiveLoop] and it repeats in time with the others. Edit it and press Run: the music doesn't stop, and each loop picks up the new code on its next pass.

[LiveLoop]
async Task Drums()
{
    Sample("kick");
    await Sleep(1);
    Sample("kick");
    Sample("snare");
    await Sleep(1);
}

[LiveLoop]
async Task Bass()
{
    UseSynth(Synth.Saw);
    Play("E2", release: 0.3, cutoff: 80);
    await Sleep(0.5);
}

public override void OnNote(NoteEvent e)
{
    if (e.Sample == "kick") flash = 1;   // fires the moment the kick is heard
}

Synths, drums, .wav samples, envelopes, filters, and Amplitude / Spectrum() to drive your visuals — of the sketch's own sound, or of the room with ListenTo(AudioSource.Microphone). Beat(), Phase(), Pulse(), OnBeat() and BeatTween(..., Ease.OutBack) tie animation to the music's clock with no arithmetic, and MIDI controllers come in with OnMidi() / MidiCC() — or by MIDI learn, straight onto [Tweak] sliders. Sound plays through WinMM on Windows, CoreAudio on macOS and ALSA on Linux, all without extra packages.

🧰 What you get

🖥️ An IDE that knows your sketch Live Roslyn diagnostics (listed in the Live errors tab once you pause typing), autocomplete for the whole API, go-to-definition, and a Run that compiles in memory in well under a second.
🔥 Hot reload that keeps state Tweak a value in a particle system you've been tuning for ten minutes and it keeps running, instead of starting over from Setup().
🧊 One API, two renderers 2D on SkiaSharp, real 3D on OpenGL (Silk.NET) with lights, cameras, materials, custom shaders and 200,000 GPU particles.
📦 Any NuGet package as a library Put // nuget: PackageName, 1.2.3 at the top of a sketch and it's downloaded and linked. No .csproj to touch.
🌍 Data from the web, maps and globes LoadJSONObject("https://...") like Processing, or RequestGeoJSON(url, cacheFor: ...) to keep drawing while it downloads (with progress and a disk cache). GeoJSON countries, distances and circles on the Earth, image pixels you can read, and a point cloud that draws tens of thousands of dots at once: enough for a live earthquake globe in one sketch.
🔊 Live-coded sound Live loops, synths, drums and samples, with visuals that react on the beat.
🎛️ Made to play live [Tweak] sliders you can MIDI-learn onto your controller's knobs, a performance mode with the code floating over the full-screen visuals (on the projector), and visuals locked to the beat.
🎲 Seeds you can keep Every Run has a seed; the PNGs a sketch saves carry it (and the slider values), a variations sheet draws 9 or 16 alternatives side by side, and print export redraws any of them as vectors — a 16x poster or a pen-plotter SVG.
⏪ A time machine Rewind the running sketch and continue from an earlier frame with its real state; every Run keeps its code and a picture, one click from coming back.
📊 F3 A performance panel (fps, Draw() time, memory per frame, GCs) in the IDE and in exported apps.
🗂️ 60+ examples, searchable From a minimal sketch to orbit cameras, ML.NET models that learn while you click, a TensorSharp neural network that paints, MIDI/OSC and a live-coded beat. Search by name, topic or a function in the code.
🚀 Ship it as an app Export any sketch as a single, self-contained, double-clickable executable.
🌎 English and Spanish The whole interface is localized and switchable from Settings.

🚀 Getting started

Just want to draw something? Grab the installer for your system from the latest release: Setup.exe for Windows, the .pkg for macOS (Apple Silicon or Intel) or the .AppImage for Linux. It includes everything it needs and updates itself when a new version is out.

The installers aren't code-signed yet (that costs real money on every platform), so your OS will ask if you're sure the first time. That's expected:

Windows: SmartScreen

When Windows says "Windows protected your PC", click More info → Run anyway.

macOS: Gatekeeper

Open the installer or the app once; macOS will say it can't verify the developer. Go to System Settings → Privacy & Security, click Open Anyway, then confirm Open. macOS remembers this afterwards.

Linux: execute bit
chmod +x DanaProcessingIde-*.AppImage
./DanaProcessingIde-*.AppImage

Sound on macOS and Linux is new in 1.0 and still experimental: if you hear nothing, please open an issue.

Building from source? You'll need the .NET 10 SDK:

git clone https://github.com/BuddhaCodes/DanaProcessing.git
cd DanaProcessing
dotnet run --project DanaProcessing.Ide

📚 Documentation

The full reference, method by method, lives at buddhacodes.github.io/DanaProcessing: one page per topic (2D, 3D, sound, live, the IDE...), a search box (press /) and an A–Z index. Open index.html to read it locally.

The pages are generated: edit a topic in site/content/ (or the home page in site/home.html), then run python site/build.py. The look lives in assets/site.css and assets/site.js. Old links to the one-page site (index.html#fill) still land on the right page.

🏗️ What's in the repository

DanaProcessing/                The core library: Sketch, Setup()/Draw(), 2D (SkiaSharp) and
                               3D (Silk.NET/OpenGL) rendering, the audio engine, PVector,
                               PImage, PGraphics, PShader, collections, math.

DanaProcessing.AvaloniaHost/   A cross-platform Avalonia control that hosts a running Sketch,
                               the canvas both the IDE and exported apps are built on.

DanaProcessing.Ide/            The desktop IDE: editor, live diagnostics, hot reload, NuGet
                               management, example gallery, exporter, settings, localization.
Under the hood
Language / runtime C# 14 on .NET 10
UI framework Avalonia UI
2D rendering SkiaSharp
3D rendering Silk.NET over OpenGL
Audio Own engine in C#: logical-time scheduler, allocation-free audio thread, winmm output on Windows
In-IDE compilation Roslyn (Microsoft.CodeAnalysis), in memory, no disk round-trip
Package resolution NuGet.Protocol, straight from // nuget: comments

🗺️ Roadmap

Where it's headed is in ROADMAP.md: hot reload on save, cross-platform builds, GPU particle systems and more.

💛 Support the project

DanaProcessing is free, open source, and built in spare time. If it's useful to you, for your art, your classes or your installations, you can help it keep growing with a donation via PayPal. Every contribution turns into more time for new features, examples and fixes.

A note on where donations go: PayPal isn't available where I live, so donations are received on my behalf by a trusted collaborator, Carlos Fernandez. That's the name you'll see on the PayPal page.

¿Hablás español? DanaProcessing es gratis y de código abierto; si te sirve, podés apoyarlo con una donación por PayPal. Como PayPal no está disponible donde vivo, las donaciones las recibe en mi nombre un colaborador de confianza, Carlos Fernandez.

You'll also find the link inside the IDE under Help → Support the project.

🤝 Contributing

Issues and pull requests are welcome: a bug, a new example sketch, or an idea for the API. If you build something with DanaProcessing, open an issue and show it off. I'd love to see it.

🙏 Inspiration

This project stands on the shoulders of Processing and p5.js, whose API it deliberately mirrors (some examples are adaptations of p5.js classics); The Coding Train, where I learned to sketch; and Sonic Pi, whose way of live coding music shaped the audio engine.

📄 License

MIT. Do pretty much anything with it, just keep the notice.

About

Processing/p5.js-style creative coding for C# — write a Sketch, override Setup()/Draw(), and run it in a purpose-built desktop IDE with live diagnostics, 2D + real 3D rendering, and one-click NuGet packages.

Topics

Resources

Stars

9 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages