Skip to content

Patterns and lighting

silantnode edited this page Jun 27, 2013 · 5 revisions

Sequences would be pretty boring if you had to write out each event. Luckily, echomesh has a neat little pattern generator that you can use for all sorts of sequential purposes, including lights and MIDI.

For the tutorial, we're going to concentrate on controlling lights. We're assuming that creators often won't have the actual hardware lights to develop on until fairly late in the lighting, so echomesh has a software lighting visualizer that lets you experiment without having hardware.

This visualizer is a separate C++ program which is automatically installed when you install echomesh, that allows quite high frame-rates to be achieved. Please bear in mind, however, that visualizer frame rates can only reach about 60 frames per second (fps) on a reasonably fast machine, but hardware lighting frame rates can be as high as 1300fps on the Raspberry Pi. echomesh will automatically compensate for lower frame rates by intelligently skipping frames, but of course using hardware lights will give the best results.

Start up your editor again and create a new score called light.yml containing the following text.

type: sequence

patterns:
  a simple one:
    type: spread
    colors: [red, white]
    steps: 32

elements:
  -
    type: pattern
    pattern: a simple one
    output: light

We're using the sequence element again, but this time we're using a new feature, patterns. This element has one pattern, named a simple one, which creates a color gradient from red to white in 32 small steps.

Try running it.

echomesh: start light

You should see the small lighting simulator window pop up, with that gradient from before.

Here's a slightly more fancy pattern - paste it into a file called light2.yml.

type: sequence

variables:
  switch:
    type: counter
    count:  2
    period: 1/2 second

patterns:
  one:
    type: choose
    choose: local.switch
    pattern:
      -
        type: insert
        begin: 32
        pattern:
          type: spread
          colors: [white, red]
          steps: 32
      -
        type: insert
        pattern:
          type: spread
          colors: [blue, white]
          steps: 32

elements:
  -
    end: infinite
    type: pattern
    pattern: one
    output: light

Now run it:

echomesh: unload *
Unload light.

echomesh: start light2

You should see two lighting scenes flashing back and forth.

Clone this wiki locally