Master Panel Guide¶
Learn to control global tempo and create shared parameters across all panels.
What is the Master Panel?¶
The master panel sits above all panels and provides controls that affect everything at once:
- TEMPO: Controls the speed of all patterns
- Global Sliders: Variables that any panel can reference
- Stop All: Stops all panels simultaneously
Think of the master panel as the conductor - it sets the tempo and overall tone, while each panel (musician) plays their own part.
TEMPO Control¶
What TEMPO Does¶
TEMPO controls how fast patterns play across all panels. When you adjust TEMPO, every playing pattern speeds up or slows down together.
Default Setup¶
The master panel includes a TEMPO slider:
| Parameter | Value | Meaning |
|---|---|---|
| Default | 30 | Starting speed |
| Min | 15 | Slowest setting |
| Max | 45 | Fastest setting |
How Speed Works¶
r0astr uses CPS (Cycles Per Second) internally. You don't need to understand the math - just know that:
- Higher TEMPO = faster patterns
- Lower TEMPO = slower patterns
- All cards follow the same tempo
Practical Use¶
- Start with the default tempo
- Use the slider to find a comfortable speed
- All patterns automatically adjust
Performance Tip
Subtle tempo changes during a performance can add dynamics. Try slowly increasing tempo to build energy.
Global Effect Sliders¶
Create sliders in the master panel that control parameters across all panels.
Why Use Global Sliders?¶
Instead of adding separate filter sliders to each panel, create one in the master panel:
- Single control affects everything
- Consistent effect across all instruments
- Great for sweeps and buildups
Creating a Global Slider¶
In the master panel code:
This creates:
- A slider named SLIDER_LPF
- Starting at 800 Hz
- Range from 100 Hz to 5000 Hz
Using in Panels¶
Reference the variable name in any panel:
// Panel 1
s("bd*4").lpf(SLIDER_LPF)
// Panel 2
note("c2 ~ c2 e2").s("sawtooth").lpf(SLIDER_LPF)
// Panel 3
n("0 2 4").scale("C4:minor").s("triangle").lpf(SLIDER_LPF)
Now one slider controls the filter on all three panels.
Multiple Global Sliders¶
Add as many as you need:
// Master Panel
let SLIDER_LPF = slider(800, 100, 5000);
let REVERB = slider(0.3, 0, 1);
let MASTER_GAIN = slider(0.8, 0, 1);
Use them in panels:
Variable Reference Workflow¶
Step 1: Define in Master Panel¶
Write your slider definitions in the master panel:
Step 2: Use in Panel Patterns¶
Reference the variable names (exactly as written) in any panel:
// This panel uses both global sliders
note("c2 e2 g2")
.s("sawtooth")
.lpf(FILTER)
.room(SPACE)
.gain(0.6)
Step 3: Control in Real-Time¶
Adjust the sliders while patterns play. All cards using those variables update instantly.
Naming Conventions¶
Use clear, descriptive names:
| Good | Why |
|---|---|
SLIDER_LPF |
Clear it's a slider, controls low-pass |
MASTER_GAIN |
Indicates global volume |
REVERB |
Simple and obvious |
TEMPO |
Special - controls global speed |
Creating Custom Sliders¶
Basic Syntax¶
| Part | Description |
|---|---|
let NAME |
Variable name to use in panels |
slider() |
Creates a slider control |
default |
Starting value |
min |
Minimum value |
max |
Maximum value |
Examples¶
Filter Control (Hz):
Volume Control (0-1):
Reverb Amount (0-1):
Speed Modifier:
Complete Example¶
Master Panel:
let TEMPO = slider(30, 15, 45);
let LPF = slider(1200, 100, 4000);
let REVERB = slider(0.3, 0, 0.9);
let MASTER = slider(0.8, 0, 1);
Panel using globals:
Stop All¶
What It Does¶
The Stop All button immediately stops every playing pattern across all panels.
When to Use¶
- End of performance: Clean stop
- Reset: Start fresh
- Emergency: Something sounds wrong
Behavior¶
When you click Stop All:
- All cards stop immediately
- Panels remain paused (not reset)
- Code in each panel is preserved
- Click Play on individual cards to restart
Advanced: How Master Panel Works¶
For Advanced Users
This section explains the technical implementation. You don't need to understand this to use r0astr effectively.
Parsing Differences¶
The master panel works differently from cards:
| Feature | Panels | Master Panel |
|---|---|---|
| Code evaluation | Strudel transpiler | Regex parsing |
| Pattern execution | Yes | No |
| Slider detection | Automatic | Manual parsing |
Why Regex?¶
The Strudel transpiler can block when used in the master panel context. To avoid this, r0astr parses master panel code with regex to extract slider definitions.
TEMPO Special Handling¶
TEMPO isn't just a variable - it controls the scheduler:
- Master panel code defines:
let TEMPO = slider(...); r0astrdetects the TEMPO variable- Changes are converted to CPS (cycles per second)
- The scheduler's speed is updated:
scheduler.setCps(value)
Slider Detection Pattern¶
Master panel sliders must follow this exact format:
The parser looks for:
- let keyword
- Variable name (letters, numbers, underscores)
- = slider(
- Three numeric values
For detailed technical information, see the Architecture documentation.
Global Variables and Functions¶
Beyond sliders, the master panel can define variables, constants, and functions that are accessible in all panels.
Defining Global Variables¶
Use let, const, or var to define values available everywhere:
Use them in any panel:
Defining Global Functions¶
Create functions in the master panel for complex orchestration:
// Master Panel
function WHICH_PHASE() {
return Math.floor(scheduler.now() / 4) % 4;
}
function activeWhen(phase) {
return ref(() => WHICH_PHASE() === phase ? 1 : 0);
}
Use in panels:
Example: Phase-Based Orchestration¶
Master Panel:
let SCALE = "E:minor:pentatonic"
function WHICH_PHASE() {
return Math.floor(scheduler.now() / 4) % 4;
}
function activeWhen(phase) {
return ref(() => WHICH_PHASE() === phase ? 1 : 0);
}
Panels can then create patterns that fade in/out based on the current phase:
stack(
n("0 2 4").scale(SCALE).s("piano").gain(activeWhen(0)),
n("0 3 5").scale(SCALE).s("strings").gain(activeWhen(1)),
s("bd sd bd sd").gain(activeWhen(2)),
n("0 7 12").scale(SCALE).s("pad").gain(activeWhen(3))
)
Quick Reference¶
Master Panel Syntax¶
// Required for tempo control
let TEMPO = slider(30, 15, 45);
// Optional global sliders
let SLIDER_LPF = slider(800, 100, 5000);
let REVERB = slider(0.3, 0, 1);
let GAIN = slider(0.7, 0, 1);
Panel Usage¶
Next Steps¶
-
Example Arrangements
Complete multi-panel tracks with sliders.
-
Architecture
Deep technical details for developers.