Files
sideline/examples/README.md
David Gwilliam 38bc9a2c13 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
2026-03-21 19:43:52 -07:00

1.9 KiB

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.

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:

[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:

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:

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.