nannou Creative Coding Toolkit
repository·master·Indexed 27 days ago
https://github.com/nannou-org/nannouAn open-source creative-coding toolkit for Rust built on the Bevy game engine. nannou provides a suite of specialized crates for graphics (nannou_draw, nannou_wgpu), audio (nannou_audio), MIDI (nannou_midi), OSC (nannou_osc), video (nannou_video), webcam capture (nannou_webcam), and laser projection (nannou_laser). It includes nannou_core for headless or embedded applications and nannou_isf for Interactive Shader Format support.
What's inside nannou
- nannou_laser is a cross-platform API designed for laser DAC (Digital-to-Analog Converter) detection and data streaming. It provides a unified interface to interact with various laser protocols, allowing developers to stream 2D vector images or raw data streams to laser hardware.
Overview of nannou_webcam
masternannou_webcam is a webcam API designed for the nannou creative coding framework. It provides cross-platform webcam capture by using
nokhwaon native platforms andMediaStreamTrackProcessoron WebAssembly (WASM).Key features include:
- Automatic discovery of cameras as entities.
- Streaming of video frames as Bevy
Imageassets.
Overview of nannou_audio
masternannou_audio is the audio API for the nannou creative coding framework. It provides a high-level interface for handling audio tasks in nannou applications. It is built on top of
cpal, a pure-Rust, cross-platform audio library.Key features include:
- Access to available system audio devices.
- Ability to spawn multiple input and output audio streams.
- A simple builder API for establishing streams with sensible defaults.
- Consistent buffer sizes for input and output streams across different back-ends.
- A non-blocking API designed for ease of use.
Overview of nannou_osc
masternannou_osc provides a simple OSC (Open Sound Control) API for the nannou creative coding framework. It acts as a thin, zero-cost abstraction over
std::net::UdpSocketand uses therosccrate for low-level protocol encoding and decoding.Key features include:
- Simple
SenderandReceiverAPIs for UDP sockets. - Reasonable default UDP address bindings.
- Type-safe distinction between "connected" and "unconnected" senders and receivers.
- Both blocking and non-blocking
IteratorAPIs for theReceivertype.
- Simple
Overview of nannou_midi
masternannou_midi provides a MIDI API for the nannou creative coding framework. It usesmidirfor cross-platform MIDI I/O and is inspired bybevy_midi. MIDI ports are automatically discovered as entities, and connections are managed through the Entity Component System (ECS).Overview of nannou creative-coding toolkit
masternannou is an open-source creative-coding toolkit for Rust. It provides tools for creating graphics, user interfaces, and low-level GPU access. The library enables you to create windows, draw to them, and handle user interactions like mouse movement and keyboard presses.
Key features include:
- Window management and drawing APIs.
- Event handling (mouse, keyboard).
- User interface tools.
- Low-level GPU access.
nannou is built on the Bevy game engine and is exposed as a Bevy plugin. This allows you to use the nannou sketch/app API either as a standalone tool or integrated within the broader Bevy ecosystem.
Use nannou_wgpu for WebGPU integration
masterThe
nannou_wgpucrate provides integration for the WebGPU specification via thewgpucrate. It re-exports the entirewgpucrate, allowing you to use standard WebGPU APIs within nannou.When accessing this through
nannou::wgpu, the following features are enabled by default:image: Enables interoperation with theimagecrate, including functions for uploading textures from image files.capturer: Provides thewgpu::TextureCapturerAPI to simplify downloading textures from the GPU and saving them as image files (useful for recording window contents).
Use nannou_draw for 2D and 3D graphics
masterThenannou_drawcrate provides theDrawAPI, a simple and expressive way to draw 2D and 3D graphics. It is built on top of the Bevy game engine. TheNannouDrawPluginhandles the rendering of meshes, text, textures, and shaders generated by theDrawAPI using Bevy's renderer.Explore Nannou Tutorials
masterNannou provides a wide range of tutorials categorized by functional area to help you build creative coding projects. Depending on your experience level and project goals, you can follow paths for:
- Basics: Learning the anatomy of a Nannou app, drawing sketches, and understanding window coordinates.
- Drawing: Using the
DrawAPI for 2D shapes, animation, images, 3D shapes, and meshes. - Windowing: Managing custom windows, multiple windows, fullscreen modes, and window positioning.
- Audio: Setting up input/output, device selection, file playback, synthesis, and audio visualization.
- Video: Drawing, recording, and manipulating video playback.
- WGPU: Low-level graphics programming including pipelines, compute, fragment, and vertex shaders.
- Specialized Hardware: Projection mapping (quad-warping), LASER DACs (detection and interpolation), DMX (via sACN), and Serial over USB.
- Communication: OSC (Open Sound Control) for sending and receiving messages.
Use nannou_video for video playback in Bevy
masterThe
nannou_videocrate provides a Bevy plugin,NannouVideoPlugin, designed for decoding and playing back video within the Bevy engine.Key features:
- Native Platforms: Uses
video-rsfor decoding. - Web (WASM): Uses web media APIs.
- Integration: Streams decoded frames directly as Bevy
Imageassets.
- Native Platforms: Uses
Use nannou_derive procedural macros via the nannou crate
masterThe
nannou_derivecrate provides procedural macros for the nannou framework, such as the#[shader_model]attribute used to define custom shader models for theDrawAPI.Instead of depending on
nannou_derivedirectly, you should typically use the mainnannoucrate. The macros are re-exported via thenannoucrate's prelude, making them available for use in your creative coding projects automatically when you import the prelude.Access Nannou documentation and resources
masterNannou provides several resources for different stages of development:
- Getting Started: For beginners, covering Rust installation and starting your first project.
- Tutorials: Practical guides for specific tasks like sound output, drawing shapes, or laser connectivity.
- API Reference: The authoritative source-code documentation for all Nannou APIs, hosted on docs.rs/nannou.
- Developer Reference: Information on Nannou's architecture and how to contribute to the project.
- Showcases: Examples of projects built using the toolkit.