← Back to Rayon

Rayon

Audio Live Coding Documentation

Table of Contents

Getting Started

Rayon is a browser-based audio synthesis environment that uses shopping metaphors for live coding music. Products become synthesizers, shopping carts provide rhythm, and retail concepts control musical parameters.

Quick Start

  1. Open supermarket.html in a modern browser
  2. Click "Enable Sound" to start the audio context
  3. Type commands in the editor and press Ctrl+Enter to run
Tip
Type story mode to start a guided tutorial that teaches you the basics step by step.

Basic Example

[0] add beer              // Add a synth to slot 0
[1] add fresh salad       // Add a modified synth to slot 1
my cart has square wheels // Add drums

Keyboard Shortcuts

Shortcut Action
Ctrl+Enter Run the current line
Ctrl+Shift+Enter Run all lines in the editor
Esc Stop all sounds and clear products
Tab Accept autocomplete suggestion
/ Navigate autocomplete suggestions

Products (Synthesizers)

Products are synthesizers assigned to slots [0] through [9]. Each slot can hold one synth at a time.

Adding Products

[N] add [modifiers] product [parameters]

Available Products

ProductSound Description
beerMellow FM synth - smooth jazzy tones
saladCrisp pluck synth - fresh texture
hamRich fat sawtooth - savory depth
milkSoft pluck synth - liquid smooth
chipsCrispy sawtooth with filter sweep
pizzaTriangle wave FM synth - warm tones
oilLow frequency sine wave - liquid bass
wineDetuned poly synth - complex layers
cheeseWarm FM synth - smooth harmonics
sodaHigh pitched membrane synth - fizzy
breadWarm duo synth - soft and full
cerealCrunchy granular synth - textured
chocolateRich square wave AM synth - sweet
candyBright sawtooth mono synth - sugary
energy_drinkBuzzy FM synth - energetic
coffeeDark filtered sawtooth - caffeinated
butterCreamy detuned duo synth - smooth
eggsPlucked string with bright attack
pastaSoft poly synth - Italian warmth
riceShort noise bursts - grainy texture

Removing Products

[N] remove    // Remove product from slot N
remove all    // Clear all slots
Beat-Synced Transitions
When you replace a product in an occupied slot, the change happens on the next bar for smooth musical transitions. A progress indicator shows when the change will occur.

Modifiers (Effects)

Add modifiers before the product name to apply effects.

Pitch Modifiers

ModifierEffect
freshHigher pitch, brighter sound
oldLower pitch, darker sound

Filter Modifiers

ModifierEffect
strongLowpass filter, deeper tone
flavorlessHighpass filter, thin sound

Effect Modifiers

ModifierEffect
cheapBitcrusher effect, lo-fi digital
expensiveReverb effect, spacious sound
processedChorus effect, thick texture
industrialDistortion effect, harsh tone
overpricedPhaser effect, swirling motion
vomitChebyshev waveshaper, extreme distortion
artisanalTremolo effect, amplitude wobble
bargainFeedback delay, echoing repeats
luxuryLong reverb, premium space
artificialVibrato effect, pitch wobble
mass-producedHeavy bitcrusher, ultra lo-fi
addictivePing-pong delay, stereo bounce
packagedRhythmic tremolo with filter
glassShimmering echo effect

Examples

[0] add fresh expensive wine     // High pitch wine with reverb
[1] add old industrial ham       // Low pitch ham with distortion
[2] add cheap processed cheese   // Bitcrushed cheese with chorus

Parameters

Nutriscore (Key Change)

Change the musical key of a product.

[0] add beer nutriscore A    // Beer in key of A
[1] add salad nutriscore C   // Salad in key of C

Available keys: A, B, C, D, E

Shelf Life (Note Duration)

Control how long each note plays.

ValueDuration
shelflife todayVery short (32n)
shelflife weekShort (16n)
shelflife monthMedium (8n)
shelflife yearLong (4n)
shelflife foreverVery long (1n)

Escalator (Arpeggiator)

Create arpeggiated patterns.

[0] add beer escalator up fast
[1] add wine escalator bounce slow

Patterns: up, down, bounce, zigzag, express, checkout

Speeds: slow, normal, fast, rush, broken

Volume Control

[0] add beer volume loud
[1] add wine volume 50       // 0-100 scale
[2] add cheese volume mute

Presets: max, loud, soft, quiet, whisper, min, mute

Open Products

Products marked as "open" play unpredictably (~60% of the time).

[0] add open beer

Cart Wheels (Drums)

The shopping cart provides drum patterns. Different wheel types create different rhythms.

my cart has [type] wheels
Wheel TypeRhythm Style
squareSteady 4/4 beat
brokenGlitchy irregular rhythm
premiumSmooth swing rhythm
defectiveChaotic polyrhythm
bargainSimple minimal beat
luxuryComplex jazz rhythm
heavyKick-heavy techno pattern
chromeCrisp digital beats
turboFast breakbeat rhythm
plasticSynthetic artificial drums
wobblyDubstep wobble bass
squeakyHi-hat focused shuffle
rubberBouncy funk rhythm
smoothLiquid drum'n'bass flow
rustyIndustrial metallic
vintageClassic 808/909
stolenErratic unpredictable
goldenLuxurious trap hi-hats
noNo rhythm (stops drums)

Global Modes

Modes apply effects to all sounds globally.

[mode] mode on/off
ModeEffect
discountDetunes everything slightly - unstable, lo-fi feel
inflationPitch gradually shifts upward over time
consumerismAdds delays and echo to everything
black_fridayChaotic distortion and random volume changes

Store Features

Recording (Checkout)

checkout           // Start recording
finish checkout    // Stop and save recording

Seasons

Apply seasonal audio themes to all products.

season halloween   // Spooky effects
season christmas   // Festive holiday
season summer      // Bright vibes
season winter      // Cold crisp sounds
season easter      // Bouncy spring
season valentines  // Romantic ambience
season normal      // Reset to default

Announcements

Text-to-speech PA system announcements.

announcement cleanup    // "Cleanup on aisle 3"
announcement closing    // "Store closing soon"
announcement sale       // Special offer
announcement [text]     // Custom message

Rush Hour

rush hour on    // Tempo increases frantically
rush hour off   // Return to normal

Coupons

apply coupon BOGO       // Buy one get one - duplicates products
apply coupon 50OFF      // Half speed
apply coupon FREESHIP   // Spacious reverb
apply coupon VIP        // Luxury effects

Product Decay

decay on         // Products gradually expire
decay off        // Stop decay
preserve beer    // Protect specific product from decay
spoil all        // Instantly spoil all products

Tempo Control

it's closing time   // Speed up tempo
it's opening time   // Slow down tempo

Barcode Scanner

scan barcode 123456   // Generate products from digits

Store Layout / Map Compose

store layout   // Open spatial view
map compose    // Spatial sequencer mode

Breaks & Transitions

Breaks

CommandEffect
checkout lineFade to silence
lunch breakDrums stop, music softens
lunch break offResume full energy
store closingEverything fades away
cleanup timeOnly muzak remains
intermissionPause briefly
coffee breakQuick fade out/in
smoke breakStep outside briefly

Transitions

CommandEffect
conveyor beltProducts roll in sequence
conveyor belt fast/slowSpeed variants
sliding doorsStereo pan sweep
elevator musicMuffled distant sound
smooth transitionCrossfade between groups
fade to silenceGradual fade to quiet
fade to softFade to background level
fade to fullFade to full volume
morph to [product]Transform all products

Shoplifting System

A risk/reward game mechanic for stealing products.

Stealing

shoplift beer           // Attempt to steal
steal chips             // Alternative syntax
pocket candy            // Another alternative
five finger discount wine

Security Levels

security level low       // 30% catch rate
security level medium    // 50% catch rate
security level high      // 70% catch rate
security level paranoid  // 95% catch rate

Chase Mode

security chase on    // Activate pursuit mode
security chase off   // End the chase
shoplifting stats    // View theft statistics

Performance Settings

Performance Modes

performance mode performance   // Optimized for stability
performance mode quality       // Maximum audio fidelity
performance mode balanced      // Balance of both

Statistics

performance stats   // Show voice count and audio dropouts

Story Mode

A guided tutorial campaign that teaches you Rayon step by step.

story mode

Story mode takes you through progressive chapters that unlock features and teach the supermarket metaphor through narrative gameplay.

Tip
Your progress is automatically saved. You can continue where you left off by typing story mode again.

Product Combos

Certain product combinations trigger special effects:

ComboProductsEffect
Partybeer + chipsFriday night mode
Morningmilk + cerealMorning routine
Jazzwine + cheeseSophisticated jazz
Lunchbread + hamLunch break
Sugar Rushenergy_drink + candyHyperactive
Zenoil + saladHealth conscious