# The Periodic Script

The periodic script is a hidden seventh view accessible with `F11`. It is a Forth script that runs continuously alongside your patterns, evaluated at every step like a pattern would be. Think of it as a free-running pattern with no grid — just code.

## What is it for?

The periodic script is useful for things that don't belong to any specific pattern:

- **Global effects**: apply a filter sweep or reverb tail across everything.
- **Drones**: run a sustained sound that keeps going regardless of which patterns are playing.
- **Control logic**: update variables, send MIDI clock, or modulate global parameters.
- **Experimentation**: sketch ideas without touching your pattern grid.

## Opening the Script

Press `F11` from any view. The script page appears with an editor on the left and visualizations on the right (scope, spectrum, prelude preview). The script is saved with your project.

## Editing

Press `Enter` to focus the editor. Write Forth code as you would in any step. Press `Esc` to unfocus and save. Press `Ctrl+E` to evaluate without unfocusing.

```forth
;; a simple drone
saw snd c2 note 0.3 gain 0.4 verb .
```

## Speed and Length

The periodic script has its own speed and length settings, independent of any pattern. Press `S` (unfocused) to set the speed and `L` to set the length (1-256 steps). Speed and length are displayed in the editor title bar.

The script loops over its length just like a pattern. Context words like `step`, `iter`, and `phase` work as expected, counting within the script's own cycle.

## Keybindings

| Key | Action |
|-----|--------|
| `F11` | Open periodic script view |
| `Enter` | Focus editor |
| `Esc` | Unfocus and save |
| `Ctrl+E` | Evaluate |
| `Ctrl+S` | Toggle stack display |
| `S` | Set speed (unfocused) |
| `L` | Set length (unfocused) |
