# Package net.paulhertz.pixelaudio.example

package net.paulhertz.pixelaudio.example
Package `net.paulhertz.pixelaudio.example` provides example Processing sketches and demonstrations of PixelAudio library functionality. The sketches are available as .java files in the PixelAudio library `example` package and as Processing sketches in the library release. Both formats share data in the `/PixelAudio/examples/examples_data` directory. If PixelAudio is new to you, I recommend starting with the Basic PixelAudio Features, followed by the Intermediate to Advanced: Tutorial Series. After that, feel free to check out the other examples and the Performance and Production Examples.

Basic PixelAudio Features

- `LookupTables` demonstrates the creation and visualization of lookup tables for spatial indexing and mapping.
- `Starter` is a minimal example that demonstrates initializing PixelAudio with a PixelMapGen, mapping colors to the signal path, and displaying the result.
- `MultiGenDemo` demonstrates switching between multiple PixelMapGen implementations (Hilbert, Moore, DiagonalZigzag) to explore different spatial patterns.
- `MultiGenLookupTables` generates and displays lookup tables for different curve generators, useful for understanding spatial mapping.
- `SimpleWaveSynth` demonstrates setting up a WaveSynth as an animated visual display with gamma adjustment and multiple curve generators (Hilbert, Moore, DiagonalZigzag).
- `SimpleAnimation` demonstrates basic animation of a spectral display mapped to a geometric pattern.

Intermediate to Advanced: Tutorial Series

- `TutorialOne_01_FileIO` covers file I/O operations including loading and saving audio and image files with PixelAudio.
- `TutorialOne_02_Animation` demonstrates basic pixel-shifting animation techniques within a standard framework for shifted pixel and audio indexing. Introduces the Sampler audio synthesis instrument.
- `TutorialOne_03_Drawing` enables interactive gesture drawing and real-time synthesis, with curve modeling and display control. Introduces the Granular synthesis instrument.
- `TutorialOne_04_Network` demonstrates network communication capabilities using UDP for remote control and data exchange with external applications.
- `TutorialOne_05_GesturePlayground` provides an interactive playground for gesture-driven sampler and granular synthesis with full parameter control through a GUI.
- `TutorialOne_06_WindowBuffer` demonstrates window buffer management for streaming audio processing and sample-accurate control.

Audio and Image I/O

- `LoadImageToAudio` loads an image file and converts it to audio using a PixelAudioMapper, demonstrating image-to-signal conversion with playback: an early but still useful example.
- `LoadAudioToImage` loads an audio file and converts it to a visual representation using a PixelAudioMapper: an early but still useful example.

Introduction to WaveSynth Series

- `BigWaveSynth` demonstrates basic features of a color organ that uses additive sine wave synthesis.
- `BigWaveSynthAudio` extends BigWaveSynth with audio output capabilities, enabling real-time sonification of visual patterns.
- `JSONWaveSynth` demonstrates JSON-based serialization and loading of waveform parameters for configuration management.

Performance and Production Examples

- `Bagatelle` is a comprehensive interactive audio-visual performance tool supporting brush management, session saving/loading, gesture recording, and real-time granular synthesis with extensive preset library support and a graphical user interface.
- `DeadBodyWorkFlow` is a near duplicate of Bagatelle. This example will be dropped in a future edition. Available in Eclipse version only.
- `WaveSynthEditor` provides a GUI for editing WaveSynth color organ parameters. It can construct complex spectral and visual compositions that can be output to video. WaveSynth parameters can be saved to or retrieved from a JSON file.
- `WaveSynthSequencer` demonstrates sequencing with the WaveSynth color organ, with frequency, rhythmic timing, and image generation.
- `ArgosyMixer` is a specialized mixing and synthesis tool for rhythmic pattern making in images and audio. It also provides a GUI with 18 different MultiGen instances to try out, a menu of patterns, animation controls, and image, audio, and video export.

Utility and Demonstration Examples

- `TransformPImage` shows image transformation and manipulation techniques compatible with PixelAudio processing.
- `TutorialOne_06_WB_Retrofit` demonstrates retrofitting existing code to use the WindowBuffer pattern for improved audio handling. Available only in Eclipse version.
- `PANetworkClientINF` provides a network interface for remote communication with PixelAudio processes.

Companion Files

Some examples include Max/MSP support files for network integration:

- `UDP_Handler.maxpat` - Max/MSP patch for UDP message handling
- `simpleAudioIO.maxpat` - Max/MSP patch for basic audio I/O

Development Notes

Most examples extend Processing's PApplet and follow the standard setup/draw pattern. Many support interactive keyboard control for real-time parameter manipulation. The tutorial series (TutorialOne_*) provides progressive lessons in increasing complexity.

- Related Packages
  Package
  Description
  net.paulhertz.pixelaudio
  Core classes for PixelAudio, a Processing library that maps between sound and image data.
  net.paulhertz.pixelaudio.curves
  Gesture, path, and Bézier curve modeling classes for PixelAudio.
  net.paulhertz.pixelaudio.granular
  Granular synthesis classes for PixelAudio.
  net.paulhertz.pixelaudio.io
  Package `net.paulhertz.pixelaudio.io` provides JSON-based persistence for PixelAudio data structures.
  net.paulhertz.pixelaudio.sampler
  Digital audio sampling synthesis classes for PixelAudio, built on the Minim library for Processing.
  net.paulhertz.pixelaudio.schedule
  Package `net.paulhertz.pixelaudio.schedule` provides sample-accurate event scheduling, gesture-based time management, and audio utility functions for the PixelAudio library.
- Class
  Description
  ArgosyMixer
  ArgosyMixer demonstrates use of the Argosy class to create and animate patterns and save them to video.
  Bagatelle
  Experimental real time performance application based on PixelAudio, with an editing GUI, Presets, and saving and loading JSON-format files for brushstroke and granular configuration data.
  Bagatelle.ActiveDot
  Bagatelle.BrushHit
  Simple container for a brush hit-test result.
  Bagatelle.CueResult
  Bagatelle.DrawingMode
  Bagatelle.Happening
  Future Development: Barebones interface for "something that happens at a certain point", and then in AudioScheduler the time-when-something-happens gets connected to the-room-where-it-happens and the entire cast of Hamilton steps in, if you let them.
  Bagatelle.InstrumentLoop
  Bagatelle.PerformancePreset
  Presets are applied to each new brush at the moment drawing is completed by releasing the mouse button and calling makeBrush(), the bottleneck method for all brush creation.
  Bagatelle.SamplerPointHappening
  BigWaveSynth
  BigWaveSynth shows how you can load a WaveSynth into the pixel array of a MultiGen.
  BigWaveSynthAudio
  BigWaveSynthAudio shows how you can load the color output of WaveSynth into the pixel array of a MultiGen and play the WaveSynth's audio output with a PASamplerInstrument.
  DeadBodyWorkFlow
  DeadBodyWorkFlow.ActiveDot
  DeadBodyWorkFlow.BrushHit
  Simple container for a brush hit-test result.
  DeadBodyWorkFlow.CueResult
  DeadBodyWorkFlow.DrawingMode
  DeadBodyWorkFlow.Happening
  Future Development: Barebones interface for "something that happens at a certain point", and then in AudioScheduler the time-when-something-happens gets connected to the-room-where-it-happens and the entire cast of Hamilton steps in, if you let them.
  DeadBodyWorkFlow.InstrumentLoop
  DeadBodyWorkFlow.PerformancePreset
  Presets are applied to each new brush at the moment drawing is completed by releasing the mouse button and calling makeBrush(), the bottleneck method for all brush creation.
  DeadBodyWorkFlow.SamplerPointHappening
  JSONWaveSynth
  Demo of how to set and save WaveSynth parameters from JSON files.
  LoadAudioToImage
  LoadAudioToImage shows how you can open audio files and transcode their image data to an image.
  LoadImageToAudio
  LoadImageToAudio shows how to load an image and turn it into an audio file that can be played by clicking on the image.
  LookupTables
  PixelAudio Core Concept: Mapping The LookupTables example shows how to map a 1D audio signal onto a 2D bitmap, using lookup tables (LUTs) to create a one-to-one correspondence between audio samples and RGB pixels.
  MultiGenDemo
  MultiGenDemo: How to Combine Gens into a MultiGen
  MultiGenLookupTables
  The LookupTables example shows how a central element of PixelAudio, the lookup table, connects a 1D audio signal with a 2D bitmap, putting audio samples and RGB pixels in one-to-one correspondence within a single PixelMapGen instance such as a Hilbert, Moore, or DiagonalZigzag.
  PANetworkClientINF
  Interface for applications extending PApplet that use NetworkDelegate to send and receive UDP messages.
  SimpleAnimation
  This is the Starter example with animation added.
  SimpleWaveSynth
  Starter
  TransformPImage
  TransformPImage demonstrates some of the commands available in the BitmapTransform class.
  TutorialOne_01_FileIO
  The first tutorial opens audio or image files and loads either file type to both the image display and the audio buffer.
  TutorialOne_02_Animation
  This example sketch builds on TutorialOne_01_FileIO, which provided commands to open and display audio and image files, transcode image pixel data to audio samples, transcode audio samples to image pixel data, and save audio and image files.
  TutorialOne_03_Drawing
  NEW FEATURES
  TutorialOne_03_Drawing.AudioBrushLite
  A light-weight version of the `AudioBrush` class for combining gestures and audio synthesis.
  TutorialOne_03_Drawing.BrushConfig
  Defines the curve drawing model for a brush using PACurveMaker.
  TutorialOne_03_Drawing.BrushHit
  A class to store a hit-test result, recording an AudioBrushLite instance and its index in brush list.
  TutorialOne_03_Drawing.BrushOutput
  TutorialOne_03_Drawing.HopMode
  TutorialOne_03_Drawing.PathMode
  TutorialOne_04_Network
  NETWORKING WITH UDP
  TutorialOne_04_Network.AudioBrushLite
  A light-weight version of the AudioBrush class for combining gestures and audio synthesis.
  TutorialOne_04_Network.BrushConfig
  Defines the curve drawing model for a brush using PACurveMaker.
  TutorialOne_04_Network.BrushHit
  A class to store a hit-test result, recording an AudioBrushLite instance and its index in brush list.
  TutorialOne_04_Network.BrushOutput
  TutorialOne_04_Network.HopMode
  TutorialOne_04_Network.PathMode
  TutorialOne_05_GesturePlayground
  GesturePlayground uses a GUI to provide a tour of curve drawing with an interface to the two audio synthesis engines available in PixelAudio: the Sampler synth and the Granular synth.
  TutorialOne_05_GesturePlayground.ActiveDot
  TutorialOne_05_GesturePlayground.BrushHit
  Simple container for a brush hit-test result.
  TutorialOne_05_GesturePlayground.DrawingMode
  TutorialOne_05_GesturePlayground.Happening
  Future Development: Barebones interface for "something that happens at a certain point", and then in AudioScheduler the time-when-something-happens gets connected to the-room-where-it-happens and the entire cast of Hamilton steps in, if you let them.
  TutorialOne_05_GesturePlayground.SamplerPointHappening
  TutorialOne_06_WB_Retrofit
  TutorialOne_06_WB_Retrofit A continuation of TutorialOne_03_Drawing that keeps the drawing, brush, sampler, granular, bounds, and envelope code from TutorialOne_03_Drawing, but changes the audio source model: - anthemSignal / anthemBuffer hold the entire loaded audio file.
  TutorialOne_06_WindowBuffer
  TutorialOne_06_WindowBuffer
  TutorialOne_06_WindowBuffer.AudioBrushLite
  A light-weight version of the `AudioBrush` class for combining gestures and audio synthesis.
  TutorialOne_06_WindowBuffer.BrushConfig
  Defines the curve drawing model for a brush using PACurveMaker.
  TutorialOne_06_WindowBuffer.BrushHit
  A class to store a hit-test result, recording an AudioBrushLite instance and its index in brush list.
  TutorialOne_06_WindowBuffer.BrushOutput
  TutorialOne_06_WindowBuffer.HopMode
  TutorialOne_06_WindowBuffer.PathMode
  TutorialOneWindowBuffer
  Deprecated, for removal: This API element is subject to removal in a future version.
  WaveSynthEditor
  Additive audio synthesis engine produces colorful animated patterns and electronic synth sounds.
  WaveSynthSequencer
  Example sketch shows how to create an audio synth sequencer with the WaveSynth.