How nannou-org/nannou works
Project Type and Purpose
• nannou is a creative coding framework targeting artists and designers using Rust. Its goal is to provide an ecosystem (a collection of libraries, examples, and tools) for graphics, drawing, windowing, audio, UI integration, shader pipelines, and more.
• The README and file structure indicate that the project isn’t a single monolithic application. Instead, it includes multiple libraries (each in its own directory) that cover different areas (graphics, audio, OSC messaging, laser output, etc.), along with a large set of examples and guides.
Analyzing the File Structure
• Top-level directories include a number of sub-projects and libraries: “nannou”, “nannou_audio”, “nannou_core”, “nannou_egui”, “nannou_isf”, “nannou_laser”, “nannou_mesh”, “nannou_osc”, “nannou_package”, “nannou_wgpu”, and “nannou_new”. This indicates a modular, multi-library setup.
• Separate “examples”, “generative_design”, “nature_of_code” directories show how the libraries are used in practice.
• The “guide” directory provides tutorials and documentation about creating and managing nannou-based projects.
• Additionally, assets (fonts, images, sounds, shaders, etc.) indicate that media resources are also integral to creative coding applications.
• Configuration files (Cargo.toml, GitHub workflows) suggest continuous integration and modular Cargo workspace management.
a. Main Components:
• Core Framework:
– nannou: Main application framework (windowing, drawing, sketch management)
• Specialized Libraries:
– nannou_audio: Handles audio device management, audio streaming and processing.
– nannou_wgpu: Provides helpers around WGPU for rendering and GPU operations.
– nannou_egui: Integrates the egui UI framework with nannou apps.
– nannou_isf: Manages the interactive shader pipeline (ISF) functionality.
– nannou_laser: Deals with laser device integration and path optimization.
– nannou_mesh: Provides APIs for managing meshes.
– nannou_osc: Provides OSC messaging for external communication.
• Tools:
– nannou_new: A project generator tool.
– nannou_package: Packaging tools for distributing nannou applications.
• Examples and Guides:
– Directories “examples”, “generative_design”, and “nature_of_code” are sample applications that use one or more of the libraries.
– “guide” provides user/developer documentation and onboarding.
b. Relationships and Interactions:
• The core (nannou_core) supports nannou’s higher-level functionality, which in turn forms the base for many examples.
• nannou acts as the central component and uses the core library and optionally integrates with specialized libraries—for instance:
– nannou_wgpu for modern GPU rendering.
– nannou_audio for audio processing.
– nannou_egui for UI overlays.
– nannou_isf for shader effects.
– nannou_osc for network messaging.
• Tools like nannou_new and nannou_package depend on the core libraries to scaffold and package applications.
c. Important Architectural Patterns/Principles:
• Modular Design: Each functional area is encapsulated in its own library.
• Separation of Concerns: There is a clear separation between the core engine, specialized domain libraries (audio, UI, lasers, shaders), and user-facing examples/guides.
• Extensibility: Example projects and tools illustrate how the libraries can be extended or incorporated into new creative coding sketches.
• Reusability: The design supports reuse of critical components across various applications in the ecosystem.
d. Relevant Technologies and Frameworks:
• Rust language (cargo workspace management, Cargo.toml for dependencies)
• WGPU for GPU-based rendering (nannou_wgpu)
• egui (via nannou_egui) for UI design
• OSC protocol (nannou_osc) for data communication
• Graphics shader pipelines (nannou_isf, and shader assets provided in asset directories)