# Editing a Step Each step in Cagire contains a Forth script. When the sequencer reaches that step, it runs the script to produce sound. This is where you write your music. Press `Enter` when hovering over any step to open the code editor. The editor appears as a modal overlay with the step number in the title bar. If the step is a mirrored step (shown with an arrow like `→05`), pressing `Enter` navigates to the source step instead. ## Writing Scripts Scripts are written in Forth. Type words and numbers separated by spaces. The simplest script that makes sound is: ```forth ;; a very simple sound sine sound . ``` Add parameters before words to modify them: ```forth ;; the same sound with more parameters c4 note 0.75 decay sine sound . ``` Writing long lines can become tedious. Instead, break your code into multiple lines for clarity: ```forth ;; the same sound on multiple lines c4 note 0.75 decay sine sound 0.4 verb . ``` Forth has no special rule about what a line should look like and space has no meaning. ## Adding comments to your code You can comment a line using `;;`. This is not very common for people that are used to Forth. There are no multiline comments. ## Saving - `Esc` — Save, compile, and close the editor. - `Ctrl+E` — Save and compile without closing (evaluate in place). When you save, the script is compiled and sent to the sequencer. If there's an error, a message flashes briefly at the bottom of the screen. `Esc` has layered behavior: if text is selected, it cancels the selection first. If completions are showing, it dismisses them. Otherwise it saves and closes. ## Completion As you type, the editor suggests matching Forth words. The completion popup appears once you've typed two or more characters of a word, showing candidates that match your input along with their stack signature and description. - `Tab` — Accept the selected suggestion. - `Ctrl+N` / `Ctrl+P` — Navigate between suggestions. - `Esc` — Dismiss the list. Completion helps you discover words without memorizing them all. Type a few letters and browse what's available. For example, typing `ver` will suggest `verb` (reverb), typing `chor` will show chorus-related words. ## Sample Finder Press `Ctrl+B` to open the sample finder. This provides fuzzy search over your loaded sample folders, making it easy to insert sample names without remembering their exact spelling. - Type to filter by name - `Tab` or `Enter` — Insert the selected sample name. - `Ctrl+N` / `Ctrl+P` — Navigate matches. - `Esc` — Dismiss. ## Search Press `Ctrl+F` to open the search bar. Type your query, then navigate matches: - `Ctrl+N` — Jump to next match. - `Ctrl+P` — Jump to previous match. - `Enter` — Confirm and close search. - `Esc` — Cancel search. ## Script preview Press `Ctrl+R` to execute the script immediately as a one-shot, without waiting for the sequencer to reach the step. A green flash indicates success, red indicates an error. This is super useful for sound design. It also works when hovering on a step with the editor closed.