forked from genewildish/Mainline
feat(examples): Add default visualization script
Add script that renders the standard Mainline visualization using the graph-based DSL. This demonstrates the default behavior with: - Headlines source data - Scroll camera mode - Terminal display - Classic effects: noise, fade, glitch, firehose Files added: - examples/default_visualization.py - Main script - examples/default_visualization.toml - TOML configuration - examples/README.md - Documentation for all examples Usage: python examples/default_visualization.py
This commit is contained in:
87
examples/README.md
Normal file
87
examples/README.md
Normal file
@@ -0,0 +1,87 @@
|
||||
# Examples
|
||||
|
||||
This directory contains example scripts demonstrating how to use Mainline's features.
|
||||
|
||||
## Default Visualization
|
||||
|
||||
**`default_visualization.py`** - Renders the standard Mainline visualization using the graph-based DSL.
|
||||
|
||||
```bash
|
||||
python examples/default_visualization.py
|
||||
```
|
||||
|
||||
This script demonstrates:
|
||||
- Graph-based pipeline configuration using TOML
|
||||
- Default Mainline behavior: headlines source, scroll camera, terminal display
|
||||
- Classic effects: noise, fade, glitch, firehose
|
||||
- One-shot rendering (prints to stdout)
|
||||
|
||||
### Configuration
|
||||
|
||||
The visualization is defined in `default_visualization.toml`:
|
||||
|
||||
```toml
|
||||
[nodes.source]
|
||||
type = "source"
|
||||
source = "headlines"
|
||||
|
||||
[nodes.camera]
|
||||
type = "camera"
|
||||
mode = "scroll"
|
||||
speed = 1.0
|
||||
|
||||
[nodes.noise]
|
||||
type = "effect"
|
||||
effect = "noise"
|
||||
intensity = 0.3
|
||||
|
||||
[nodes.fade]
|
||||
type = "effect"
|
||||
effect = "fade"
|
||||
intensity = 0.5
|
||||
|
||||
[nodes.display]
|
||||
type = "display"
|
||||
backend = "terminal"
|
||||
|
||||
[connections]
|
||||
list = ["source -> camera -> noise -> fade -> display"]
|
||||
```
|
||||
|
||||
## Graph DSL Demonstration
|
||||
|
||||
**`graph_dsl_demo.py`** - Demonstrates the graph-based DSL in multiple ways:
|
||||
|
||||
```bash
|
||||
python examples/graph_dsl_demo.py
|
||||
```
|
||||
|
||||
Shows:
|
||||
- Imperative Python API for building graphs
|
||||
- Dictionary-based API
|
||||
- Graph validation (cycles, disconnected nodes)
|
||||
- Different node types and configurations
|
||||
|
||||
## Integration Test
|
||||
|
||||
**`test_graph_integration.py`** - Tests the graph system with actual pipeline execution:
|
||||
|
||||
```bash
|
||||
python examples/test_graph_integration.py
|
||||
```
|
||||
|
||||
Verifies:
|
||||
- Graph loading from TOML
|
||||
- Pipeline execution
|
||||
- Output rendering
|
||||
- Comparison with preset-based pipelines
|
||||
|
||||
## Other Demos
|
||||
|
||||
- **`demo-lfo-effects.py`** - LFO modulation of effect intensities (Pygame display)
|
||||
- **`demo_oscilloscope.py`** - Oscilloscope visualization
|
||||
- **`demo_image_oscilloscope.py`** - Image-based oscilloscope
|
||||
|
||||
## Graph DSL Reference
|
||||
|
||||
See `docs/graph-dsl.md` for complete documentation on the graph-based DSL syntax.
|
||||
Reference in New Issue
Block a user