Introduction
nannou is an open-source creative coding framework for Rust, inspired by Processing and openFrameworks. It provides a batteries-included environment for artists and designers who want the performance and safety of Rust with a friendly API for 2D/3D graphics, audio, and interaction.
What nannou Does
- Renders real-time 2D and 3D graphics via wgpu (WebGPU backend)
- Provides a sketch-style API with
model,update, andviewlifecycle functions - Integrates audio I/O through CPAL for generative sound and music visualization
- Supports GUI widgets, OSC communication, and laser output for installations
- Ships examples covering particle systems, noise fields, shaders, and more
Architecture Overview
nannou wraps wgpu for cross-platform GPU rendering, winit for windowing, and CPAL for audio. The framework uses an event-driven application loop where the user defines a model struct holding state, an update function for logic, and a view function for drawing. This design keeps creative sketches concise while giving full access to Rust's ecosystem.
Self-Hosting & Configuration
- Requires a stable Rust toolchain (1.65+); install via
rustup - GPU drivers must support Vulkan, Metal, or DX12 for wgpu rendering
- Add features in Cargo.toml:
nannou_audio,nannou_osc,nannou_laser - Export frames to PNG sequences for video production with
app.main_window().capture_frame() - Use
nannou_eguicrate for adding immediate-mode GUI panels to sketches
Key Features
- wgpu rendering: modern GPU pipeline without OpenGL legacy
- Audio-visual integration: synchronized sound and graphics in one framework
- Hot-reload friendly: fast compile times for iterative creative work
- Cross-platform: runs on macOS, Linux, and Windows
- Rich example gallery: 100+ sketches demonstrating techniques
Comparison with Similar Tools
- Processing — Java-based, larger community but slower runtime performance
- openFrameworks — C++ toolkit with broader addon ecosystem
- p5.js — browser-based, easier to share but limited by JS performance
- Cinder — C++ creative framework, similar scope but no Rust safety guarantees
- Bevy — Rust game engine with ECS; heavier architecture than nannou's sketch model
FAQ
Q: Do I need to know Rust to use nannou? A: Basic Rust knowledge is needed. The API is designed to be approachable, and the examples serve as learning material.
Q: Can I use nannou for live performances? A: Yes. It supports real-time audio input, OSC for MIDI controllers, and low-latency rendering suitable for live visuals.
Q: How does nannou compare to Bevy for creative coding? A: nannou is sketch-oriented with a simpler API. Bevy is a full game engine with an ECS architecture, better suited for complex interactive applications.
Q: Can I export video from nannou? A: nannou can save individual frames as images. Combine them into video with FFmpeg.