Creme

Documentation
Back to Editor

Quick Start

Creme is a browser-based live coding music environment. No installation required - just start typing code and making music!

Basic Controls

  • Play/Stop - Click the green button or press the button
  • Ctrl+Enter - Re-evaluate code while playing
  • Ctrl+/ - Comment/uncomment line

Your First Pattern

// A simple arpeggio
note("c3 e3 g3 c4").s("sine").slow(2)

Your First Sounds

Simple Melody

note("c3 e3 g3 c4")
  .s("sine")
  .slow(2)

Drum Beat with TR909

s("bd*4").bank("RolandTR909").gain(1)

Layered Pattern

stack(
  s("bd*4").gain(0.9),
  s("[~ sd]*2").gain(0.7),
  s("hh*8").gain(0.3)
).bank("RolandTR909")

Named Patterns (Comment to Mute)

Use d1() through d16() for patterns you can mute by commenting out single lines. Also available: bass(), drums(), melody(), pad(), lead(), arp(), fx(), perc(), kick(), snare(), hats(), clap().

// Comment any line to mute - changes apply immediately!
d1(s("bd*4").bank("RolandTR909").gain(1))
d2(s("[~ cp]*2").bank("RolandTR909").gain(0.7))
d3(s("hh*8").bank("RolandTR909").gain(0.4))
d4(note("c2 c2 g2 f2").s("bass").n(0))

Important: Keep patterns on single lines so // comments mute the whole pattern.

Control Functions

  • hush() - Stop all patterns
  • mute("d1") - Mute specific pattern
  • unmute("d1") - Unmute specific pattern
  • solo("d2") - Solo specific pattern
  • unsolo("d2") - Unsolo specific pattern
  • unsoloAll() - Unsolo all patterns

Pattern Creation

note(pattern)

Create a pattern of musical notes.

note("c3 e3 g3")           // C major arpeggio
note("c3 ~ e3 ~")          // With rests
note("[c3,e3,g3]")         // Chord (simultaneous)

s(sound)

Set the sound/sample for a pattern.

s("bd")                    // Bass drum sample
s("sine")                  // Sine wave synth
note("c3").s("saw")        // Note with saw wave

mini(pattern)

Parse mini-notation string into a pattern.

mini("0 1 2 3")            // Numeric sequence
mini("<0 1 2>")            // Alternating
mini("[0,2,4]")            // Chord/stack

Mini-Notation (Pattern Syntax)

Mini-notation is the pattern language used inside strings like s("bd*4") or note("c3 e3 g3"). It controls timing, rhythm, and structure.

Basic Timing

SyntaxMeaningExample
a b c dSpace = divide cycle equallys("bd sd bd sd") → 4 hits per cycle
a*nRepeat n timess("bd*4") → 4 kicks per cycle
a/nSlow down by ns("bd/2") → 1 kick every 2 cycles
~Rest (silence)s("bd ~ sd ~") → kick, rest, snare, rest

Grouping & Subdivision

SyntaxMeaningExample
[a b]Group into single steps("bd [hh hh] sd hh") → hh plays twice as fast
[a b c]*2Group and repeats("[bd sd]*2") → bd sd bd sd
[a,b,c]Play simultaneously (chord)note("[c3,e3,g3]") → C major chord

Alternation

SyntaxMeaningExample
<a b c>Alternate each cycles("bd <sd cp>") → bd+sd, then bd+cp

Sample Selection

SyntaxMeaningExample
sample:nSelect sample indexs("808:0 808:3 808:5") → different 808 sounds

Practical Examples

// Basic 4-on-the-floor kick
s("bd*4")

// Offbeat hi-hats (rest on beats, play between)
s("~ hh").fast(4)

// Snare on 2 and 4
s("~ sd").fast(2)

// Classic house pattern
d1(s("bd*4"))
d2(s("~ cp").fast(2))
d3(s("hh*8"))

// Breakbeat with subdivisions
s("bd [~ bd] sd [bd ~]")

// Varying sample each cycle
s("808:<0 3 5 7>")

// Chord progression
note("[c3,e3,g3] [f3,a3,c4] [g3,b3,d4] [c3,e3,g3]").s("pad")

Pattern Combinators

stack(...patterns)

Layer multiple patterns simultaneously.

stack(
  s("bd*4"),
  s("hh*8").gain(0.5)
)

sequence(...patterns)

Play patterns in sequence.

alternate(...patterns)

Cycle through patterns each cycle.

Pattern Constructors

Functions that create new patterns from values.

FunctionDescriptionExample
pure(value)Single repeating value per cyclepure(60).note()
silence()Empty/silent patternsilence()
once(pattern)Play once then silenceonce(s("rave"))
replicate(n, pat)Repeat n times per cyclereplicate(4, s("bd"))
euclid(n, k, value)Euclidean rhythmeuclid(3, 8, "bd")
weighted([vals], [weights])Custom time divisionsweighted(["bd","sd"], [3, 1])
choosePattern(...pats)Random pattern choicechoosePattern(s("bd"), s("sd"))

Euclidean Rhythms

Distribute n events across k steps evenly. Classic technique for creating interesting rhythms.

// 3 hits over 8 steps = X..X..X.
euclid(3, 8, "bd").s()

// 5 hits over 8 = X.XX.XX.
euclid(5, 8, "hh").s()

// Layered euclidean polyrhythm
stack(
  euclid(3, 8, "bd").s(),
  euclid(5, 8, "hh").s().gain(0.5)
)

Weighted Patterns

Create patterns with custom time divisions.

// 3 beats kick, 1 beat snare (3:1 ratio)
weighted(["bd", "sd"], [3, 1]).s()

Timing & Speed

.fast(n)

Speed up pattern by factor n.

s("bd").fast(4)

.slow(n)

Slow down pattern by factor n.

note("c3 e3").slow(2)

.cpm(tempo)

Set cycles per minute.

s("bd*4").cpm(120)

Pattern Transformations

MethodDescriptionExample
.rev()Reverse patternnote("c3 e3 g3").rev()
.rotate(n)Rotate by n cyclesnote("c3 e3 g3").rotate(1)
.every(n, fn)Apply fn every n cycless("bd*4").every(4, p => p.fast(2))
.jux(fn)Apply fn to right channelnote("c3 e3").jux(p => p.rev())
.iter(n)Shift start each cyclenote("c3 e3 g3").iter(4)
.palindrome()Forward then backwardnote("c3 e3 g3").palindrome()
.layer(...fns)Apply transforms, stack resultsnote("c3").layer(p => p.add(7))
.compress(begin, end)Squeeze pattern into part of cycles("bd*4").compress(0, 0.5)
.zoom(begin, end)Focus on part of patterns("bd sd hh cp").zoom(0.25, 0.75)
.ply(n)Repeat each event n timess("bd sd").ply(3)
.whenmod(div, rem, fn)Apply based on cycle number mods("bd*4").whenmod(4, 0, p => p.fast(2))
.onsets()Apply only at event start timess("bd*4").onsets()

Compression & Zooming

// Squeeze 4 kicks into first half of cycle
s("bd*4").compress(0, 0.5)

// Focus on middle portion of pattern
s("bd sd hh cp").zoom(0.25, 0.75)  // Only sd and hh

// Repeat each hit 3 times (triplet feel)
s("bd sd").ply(3)

// Apply transform every 4th cycle on cycle 0
s("bd*4").whenmod(4, 0, p => p.fast(2))

// Only trigger on attack (not sustain)
note("c3").s("pad").onsets()

Probability & Randomness

MethodProbabilityExample
.sometimes(p, fn)Custom (0-1)s("bd*4").sometimes(0.5, p => p.fast(2))
.often(fn)~75%s("hh*8").often(p => p.gain(0.5))
.rarely(fn)~25%s("cp*2").rarely(p => p.fast(2))
.always(fn)100%s("bd").always(p => p.gain(0.8))
.never(fn)0%s("bd").never(p => p.fast(2))
.someCycles(fn)~50% per cycles("bd").someCycles(p => p.stut(3,0.5,0.1))
.degrade(p)Remove eventss("hh*8").degrade(0.3)
.degradeBy(p)Remove with probs("hh*8").degradeBy(0.5)

Random Values

choose("c3", "e3", "g3")  // Random choice
rand()                      // Random 0-1
irand(4)                    // Random integer 0-3

Song Structure & Arrangement

Control when patterns play during your performance. Unlike a DAW, live coding is performed in real-time - you bring patterns in and out as you go.

Cycle-Based Conditionals

Apply transformations based on the current cycle number.

MethodDescriptionExample
.every(n, fn)Apply every n cycless("bd*4").every(4, p => p.fast(2))
.whenmod(div, rem, fn)Apply when cycle % div === rems("bd").whenmod(8, 0, p => p)
once(pattern)Play once then silenceonce(s("rave"))

Building Arrangements

// Kick plays always
d1(s("bd*4").bank("RolandTR909"))

// Hi-hats come in after 4 cycles
d2(s("hh*8").whenmod(8, 4, p => p).bank("RolandTR909"))

// Snare fill every 8 cycles
d3(s("~ cp").fast(2).every(8, p => p.fast(4)).bank("RolandTR909"))

// Build-up: get faster approaching drop
d4(s("hh*4")
  .whenmod(16, 12, p => p.fast(2))
  .whenmod(16, 14, p => p.fast(4)))

Pattern Muting

The easiest way to mute: comment out the line with //

d1(s("bd*4"))
// d2(s("hh*8"))  // Muted - uncomment to bring in
d3(s("cp").fast(2))

Programmatic Muting

FunctionDescription
mute("d1")Mute pattern without removing it
unmute("d1")Unmute pattern
solo("d1")Only hear this pattern
unsolo("d1")Remove solo
unsoloAll()Clear all solos
hush()Stop ALL patterns immediately

Drop/Breakdown Example

// Full beat for 12 cycles, then breakdown for 4
d1(s("bd*4").whenmod(16, 12, () => silence()))

// Or strip down to just kick
d1(s("bd*4"))
d2(s("hh*8").whenmod(16, 12, () => silence()))
d3(s("~ cp").fast(2).whenmod(16, 12, () => silence()))

Polyrhythms & Phase

Create complex rhythmic interactions and stereo effects.

Phase & Rotation

MethodDescriptionExample
.iter(n)Rotate through n positions over n cyclesnote("c e g b").iter(4)
.palindrome()Alternate forward/backward each cyclenote("c e g").palindrome()
.chunk(n, fn)Apply to alternating n-cycle chunkss("bd*4").chunk(4, p => p.fast(2))

Time Scaling

MethodDescriptionExample
.inside(n, fn)Speed up, apply fn, slow back downnote("c e g").inside(2, p => p.rev())
.outside(n, fn)Slow down, apply fn, speed back upnote("c e g").outside(2, p => p.fast(3))

Layering & Offset

MethodDescriptionExample
.off(offset, fn)Layer with time-offset copynote("c e g").off(0.25, p => p.add(7))
.jux(fn)Apply fn to right channel (stereo)note("c e g").jux(p => p.rev())
.juxBy(amt, fn)Jux with custom pan amountnote("c e g").juxBy(0.5, p => p.fast(2))
// Steve Reich-style phasing
d1(note("c e g b").s("triangle"))
d2(note("c e g b").s("triangle").slow(1.01).pan(0.7))

// Stereo ping-pong
note("c3 e3 g3 c4").s("saw").jux(p => p.rev())

// Harmonized offset
note("c3 e3 g3").s("sine").off(0.125, p => p.add(7))

Continuous Signals

Create smooth, continuous modulation sources that aren't triggered by events.

FunctionDescriptionExample
signal(fn)Create custom continuous signalsignal(t => Math.sin(t * Math.PI * 2))
sineSine wave signal (0-1)sine.range(200, 2000)
sawSawtooth signal (0-1)saw.range(0, 1)
triTriangle signal (0-1)tri.range(0.5, 1)
squareSquare signal (0 or 1)square.range(0.3, 0.7)
perlinSmooth Perlin noiseperlin.range(0, 1)

Signal Methods

MethodDescriptionExample
.range(min, max)Scale signal to rangesine.range(200, 2000)
.segment(n)Sample n times per cyclesine.segment(16)
.slow(n)Slow down signalsine.slow(4)
.fast(n)Speed up signalsine.fast(2)
// Sweeping filter with sine LFO
note("c2").s("saw")
  .lpf(sine.range(200, 2000).slow(4))

// Smooth random panning with Perlin noise
note("c3 e3 g3").s("triangle")
  .pan(perlin.range(-0.7, 0.7))

// Tremolo effect with triangle LFO
note("c3").s("pad")
  .gain(tri.range(0.3, 1).fast(8))

// Step-sequenced filter using segment
note("c2").s("saw")
  .lpf(saw.segment(8).range(400, 4000))

Synthesizers

Basic Oscillators

Waveforms

  • sine - Pure tone
  • saw - Bright, buzzy
  • square - Hollow, retro
  • triangle - Soft, flute-like
  • noise - White noise

Wavetable

  • pulse - Pulse (50%)
  • pulse25 - Pulse (25%)
  • pulse75 - Pulse (75%)
  • organ - Organ-like
  • strings - String-like
  • complex - Complex harmonic

FM Synthesis

note("c3").s("fm")
  .set({
    fmh: 2,        // Harmonicity ratio
    fmi: 5,        // Modulation index
    fmattack: 0.01, // FM envelope attack
    fmdecay: 0.2,   // FM envelope decay
    fmsustain: 0.5 // FM envelope sustain
  })

Sample Banks

Creme has access to the full TidalCycles Dirt-Samples library with 200+ sample banks loaded on-demand from CDN. Just use any sample name and it loads automatically!

How to Use Samples

// Basic sample playback
s("bd")                    // Play bass drum
s("arpy").n("0 1 2 3")    // Cycle through sample variants
s("808:5")                // Sample index with colon

TR909 Drum Machine

Classic Roland TR-909 kit. Use with .bank("RolandTR909")

SampleSound
bdBass drum
sdSnare drum
cpClap
hhClosed hi-hat
ohOpen hi-hat
crCrash cymbal
rdRide cymbal
ltLow tom
htHigh tom
rimRim shot
// TR909 beat
d1(s("bd*4").bank("RolandTR909"))
d2(s("[~ cp]*2").bank("RolandTR909"))
d3(s("hh*8").bank("RolandTR909"))

Complete Dirt-Samples Library (220+ Banks)

All banks load automatically on first use. Use .n() to select variants within each bank.

Drum Machines

BankDescription
808Roland TR-808 full kit
808bdTR-808 bass drums
808sdTR-808 snares
808hcTR-808 hi-hat closed
808ohTR-808 open hi-hat
808cyTR-808 cymbal
808htTR-808 high tom
808mtTR-808 mid tom
808ltTR-808 low tom
808lcTR-808 low conga
808mcTR-808 mid conga
909Roland TR-909 kit
drDrum machine hits
dr2More drum machine
dr55Boss DR-55
dr_fewDrum machine selection
drumtraksSequential DrumTraks
linnhatsLinnDrum hi-hats
kicklinnLinnDrum kicks
gretschGretsch acoustic kit

Kicks

BankDescription
bdBass drums (general)
clubkickClub/house kicks
hardkickHard techno kicks
popkickPop/soft kicks
reverbkickReverb kick

Snares & Claps

BankDescription
sdSnare drums
snSnare (alias)
cpClaps
realclapsReal recorded claps
rmRim shots
rsRim shot

Hi-Hats & Cymbals

BankDescription
hhHi-hats closed
hh27More hi-hats (27 samples)
ohOpen hi-hats
crCrash cymbals
cbCowbell
htHigh tom
ltLow tom
mtMid tom

Percussion

BankDescription
drumVarious drums
percGeneral percussion
periPeri sounds
handHand percussion
tablaIndian tabla
tabla2More tabla
tablexTabla extended
clickClick sounds
clakClack sounds
tinkTink sounds
tokTok sounds
hitHit sounds
stompStomp sounds

Breaks & Loops

BankDescription
breaks125Breakbeats at 125 BPM
breaks152Breakbeats at 152 BPM
breaks157Breakbeats at 157 BPM
breaks165Breakbeats at 165 BPM
amencutupAmen break slices
jungleJungle breaks

Bass

BankDescription
bassBass sounds
bass0Bass variant 0
bass1Bass variant 1
bass2Bass variant 2
bass3Bass variant 3
bassdmBass DM
bassfooBass foo
jungbassJungle bass
jvbassJV synth bass
wobbleWobble bass

Synths

BankDescription
junoRoland Juno synth
moogMoog synth
fmFM synthesis
padPad sounds
padlongLong pad sounds
leadLead synths
hooverHoover sounds
psrPSR keyboard
sidSID chip sounds
simplesineSimple sine waves

Stabs & Hits

BankDescription
stabChord stabs
raveRave stabs
rave2More rave stabs
ravemonoMono rave stabs
gabbaGabba sounds
gabbaloudLoud gabba
gabbalouderEven louder gabba
gabGab sounds
ulgabUL gabba
hardcoreHardcore sounds

Melodic & Musical

BankDescription
arpyArpeggio notes
arpArp sounds
pluckPlucked sounds
newnotesNew notes
notesMusical notes
gtrGuitar
saxSaxophone
sitarSitar
casioCasio keyboard

Electronic & FX

BankDescription
electro1Electro sounds
futureFuture sounds
glitchGlitch sounds
glitch2More glitch
bleepBleep sounds
blipBlip sounds
distDistorted sounds
noiseNoise
noise2More noise
bendPitch bend sounds
controlControl sounds
procProcessed sounds
procshortShort processed
speedupdownSpeed up/down FX

Vocal & Speech

BankDescription
mouthMouth sounds
speechSpeech samples
speechlessVocal textures
speakspellSpeak & Spell
numbersSpoken numbers
alphabetA-Z letters
yeah"Yeah" vocals
miniyeahMini "yeah"
hcHuman choir
breathBreath sounds
diphoneDiphone synth
diphone2More diphone
baaBaa sounds
baa2More baa
hmmHmm sounds

Nature & Environment

BankDescription
windWind sounds
birdsBird sounds
birds3More birds
insectInsect sounds
crowCrow sounds
fireFire sounds
outdoorOutdoor ambience
spaceSpace textures
worldWorld sounds

Objects & Foley

BankDescription
bottleBottle sounds
bubbleBubble sounds
canCan sounds
binBin sounds
metalMetal sounds
glasstapGlass tapping
pebblesPebble sounds
coinsCoin sounds
toysToy sounds
flickFlicking sounds
lighterLighter sounds
printPrinter sounds

Genre-Specific

BankDescription
houseHouse sounds
technoTechno sounds
jazzJazz drums
industrialIndustrial sounds
techTech sounds
eastEastern sounds
chinChinese sounds
koyKoy sounds
latibroLatin brother

Miscellaneous & Experimental

BankDescription
abAB sounds
adeAde sounds
ades2Ades 2
ades3Ades 3
ades4Ades 4
alexAlex sounds
armoraArmora sounds
autoAuto sounds
battlesBattle sounds
bevBev sounds
blueBlue sounds
ccCC sounds
circusCircus sounds
coCO sounds
cosmicgCosmic G
dD sounds
dbDB sounds
dork2Dork 2
dorkbotDorkbot sounds
eE sounds
em2EM2 sounds
erkErk sounds
fF sounds
feelFeel sounds
feelfxFeel FX
festFestival sounds
fooFoo sounds
hH sounds
hawHaw sounds
hoHo sounds
ifIf sounds
ifdrumsIF drums
incomingIncoming sounds
invadersSpace invaders
kurtKurt sounds
ledLED sounds
lessLess sounds
madeMade sounds
made2Made 2
mashMash sounds
mash2Mash 2
monsterbMonster bass
mp3MP3 artifacts
msgMSG sounds
muteMuted sounds
numNumber sounds
ocOC sounds
odxODX sounds
offOff sounds
sequentialSequential sounds
seawolfSea wolf
sfSF sounds
sheffieldSheffield sounds
shortShort sounds
subroc3dSubroc 3D
sugarSugar sounds
sundanceSundance sounds
tacscanTac scan
trumpTrumpet sounds
ulUL sounds
uxayUxay sounds
vV sounds
voodooVoodoo sounds
xmasChristmas sounds
// Examples using Dirt-Samples
d1(s("808*4"))                     // 808 drums
d2(s("arpy").n("0 2 4 6"))         // Arpeggio pattern
d3(s("tabla").n(irand(16)))        // Random tabla
d4(s("rave").n(0).slow(2))         // Rave stab
d5(s("jungbass").n("0 3").slow(2)) // Jungle bass

Note: Samples are loaded from the TidalCycles CDN on first use. There may be a brief delay the first time you use a new sample bank. Once loaded, samples play instantly.

Sample Playback Controls

Control how samples are played back - slice, loop, and manipulate.

MethodDescriptionRange
.speed(n)Playback speed (negative = reverse)-4 to 4
.begin(pos)Sample start position0-1
.end(pos)Sample end position0-1
.loop(on)Enable looping0 or 1
.loopBegin(pos)Loop start position0-1
.loopEnd(pos)Loop end position0-1
// Play only first half of sample
s("breaks125").begin(0).end(0.5)

// Reverse playback
s("rave").speed(-1)

// Half-speed (pitched down)
s("breaks125").speed(0.5)

// Slice a break into 8 parts and sequence
s("breaks125*8").begin("0 0.125 0.25 0.375 0.5 0.625 0.75 0.875").end("0.125 0.25 0.375 0.5 0.625 0.75 0.875 1")

// Loop a section of a sample
s("pad").loop(1).loopBegin(0.2).loopEnd(0.6)

Sample Library (UI)

Click the Samples button in the toolbar to open the Sample Library. Here you can:

  • Upload - Drag & drop .wav files to upload your own samples (requires login)
  • Browse - View and preview your uploaded samples

Choose a category when uploading, or use "Auto-detect" to categorize based on filename. Your samples sync across devices.

Loading Samples from URLs

Load samples directly from URLs in your code:

FunctionDescription
loadSample(name, url)Load single sample from URL
loadSamples({name: url, ...})Load multiple samples
loadSampleBank(bank)Load entire sample bank with progress
loadPack(packName)Load preset pack: 'essentials' or 'all'
// Load a single sample from URL
loadSample("mysound", "https://example.com/sound.wav")
s("mysound")  // Use it

// Load multiple samples
loadSamples({
  "kick1": "https://example.com/kick.wav",
  "snare1": "https://example.com/snare.wav"
})

// Preload essentials pack
loadPack("essentials")

Scales & Notes

.scale(scaleName)

Map pattern values to a musical scale.

mini("0 1 2 3 4 5 6 7").scale("c4:major")
mini("0 2 4").scale("a3:minor")

Available Scales

major, minor, dorian, phrygian, lydian, mixolydian, aeolian, locrian, chromatic, whole, harmonicMinor, melodicMinor

Filters

EffectDescriptionRange
.lpf(freq)Low-pass filter20-20000 Hz
.hpf(freq)High-pass filter20-20000 Hz
.bpf(freq)Band-pass filter20-20000 Hz
.lpq(q)Filter resonance0.1-30
.hpq(q)HP resonance0.1-30
.bpq(q)BP resonance0.1-30
.ftype(type)Filter type (0=12db, 1=ladder, 2=24db)0-2
note("c2").s("saw")
  .lpf(800)   // Cut highs
  .lpq(10)    // Add resonance

Envelopes

ADSR (Amplitude)

ParameterDescription
.attack(time)Attack time in seconds
.decay(time)Decay time in seconds
.sustain(level)Sustain level (0-1)
.release(time)Release time in seconds
// Plucky bass
note("c2").s("saw")
  .attack(0.001)
  .decay(0.1)
  .sustain(0)
  .release(0.05)

.adsr(envelope)

Shorthand: Set all ADSR values with colon-separated string.

note("c3").s("saw").adsr("0.01:0.1:0.7:0.3")

Filter Envelope (Lowpass)

ParameterAliasDescription
.lpattack(time).lpa()Filter attack
.lpdecay(time).lpd()Filter decay
.lpsustain(level)Filter sustain
.lprelease(time).lpr()Filter release
.lpenv(depth).lpe()Filter envelope depth (Hz)

Filter Envelope (Highpass/Bandpass)

ParameterDescription
.hpattack(), .hpdecay(), .hpsustain(), .hprelease(), .hpenv()Highpass filter envelope
.bpattack(), .bpdecay(), .bpsustain(), .bprelease(), .bpenv()Bandpass filter envelope
// Acid bass with filter sweep
note("c2").s("saw")
  .lpf(300).lpenv(1500)
  .lpa(0.01).lpd(0.2)
  .lpq(12)

Pitch Envelope

ParameterAliasDescription
.pattack(time).patt()Pitch attack time
.pdecay(time)Pitch decay time
.prelease(time)Pitch release time
.penv(semitones)Pitch envelope depth
// 808-style kick
s("bd")
  .pattack(0.001)
  .prelease(0.05)
  .penv(-12)   // Drop one octave

Delay & Reverb

Delay

ParameterDescription
.delay(amount)Delay send (0-1)
.dt(time)Delay time in seconds
.dfb(amount)Delay feedback (0-1)
note("c3 e3 g3")
  .delay(0.5)
  .dt(0.25)
  .dfb(0.6)

Reverb

ParameterDescription
.room(amount)Reverb send (0-1)
.roomsize(size)Room size
.roomfade(decay)Decay time
.roomlp(freq)Reverb lowpass filter
.roomdim(freq)Reverb damping

Modulation Effects

Vibrato & Tremolo

EffectParameters
.vibrato(depth).vibrate(rate)
.tremolo(depth).tremrate(rate), .tremshape(shape), .tremskew(skew), .tremphase(phase)

Chorus

EffectParameters
.chorus(mix).chorusrate(rate), .chorusdepth(depth)

Phaser

EffectParameters
.phaser(depth).phaserrate(rate), .phaserfb(feedback), .phasercenter(freq), .phasersweep(range), .phaserdepth(depth)

Other Modulation

EffectParameters
.autowah(depth).autowahrate(rate)
.ringmod(freq).ringmix(mix)

Dynamics & Gain

EffectDescription
.gain(level)Volume (0-1+)
.postgain(level)Post-effects gain
.velocity(vel)Velocity (0-1)
.pan(pos)Stereo pan (-1 to 1)
.distort(amt)Distortion
.crush(bits)Bit crusher (1-16)
.coarse(factor)Sample rate reduction
.shape(amt)Waveshaping
.clip(length)Note length (0-1)
.cut(group)Cut group (stops other samples in group)
.vowel(v)Vowel formant (a, e, i, o, u)

Compressor

ParameterDescriptionRange
.compressor(ratio)Compression ratio1-20
.compressorThreshold(db)Threshold in dB-60 to 0
.compressorAttack(time)Attack time (seconds)0.001-1
.compressorRelease(time)Release time (seconds)0.01-1
.compressorKnee(db)Knee softness0-40
// Heavy compression for punch
s("bd*4")
  .compressor(8)
  .compressorThreshold(-20)
  .compressorAttack(0.003)
  .compressorRelease(0.1)

Sidechain Ducking

ParameterDescriptionRange
.duckorbit(n)Duck when orbit n plays0+
.duckattack(time)Duck attack time0.001-1
.duckrelease(time)Duck release time0.01-2
.duckdepth(depth)Duck amount (0-1)0-1
// Kick on orbit 0
d1(s("bd*4").gain(1))

// Bass ducks on kick with pumping effect
d2(note("c2").s("saw")
  .duckorbit(0)
  .duckattack(0.01)
  .duckrelease(0.2)
  .duckdepth(0.8))

Mini-Notation Basics

Mini-notation is a compact syntax for rhythmic patterns.

mini("bd sd hh cp")      // Sequence
mini("bd ~ sd ~")        // With rests
mini("[bd sd] hh")       // Subdivided
mini("<bd sd hh>")       // Alternating

Mini-Notation Operators

OperatorDescriptionExample
*Multiply/repeat"bd*4" → 4 kicks
/Divide/slow"bd/2" → half speed
@Weight/duration"bd@4" → 4x duration
!Replicate"bd!3" → bd bd bd
~Rest/silence"bd ~ sd ~"
.Hold previous"bd . sd ."
[ ]Subdivision"[bd sd]"
< >Alternation""
,Stack/chord"[0,2,4]"
?Probability"bd?" → 50%
( )Euclidean"(3,8)" → 3 in 8

Arithmetic Operations

Modify pattern values mathematically.

MethodDescriptionExample
.add(n)Add to values (transpose)note("c3").add(7) (up a 5th)
.sub(n)Subtract from valuesnote("c3").sub(12) (down octave)
.mul(n)Multiply valuesnote("c3").mul(2)
.div(n)Divide valuesnote("c3").div(2)

Advanced Transformations

Complex pattern manipulations imported from @creme/core.

Structural Transforms

Function/MethodDescriptionExample
chunk(n, fn)Apply fn to 1/n of pattern each cyclechunk(8, p => p.slow(2))
inside(n, fn)Speed up, apply fn, slow downinside(4, p => p.rev())
outside(n, fn)Slow down, apply fn, speed upoutside(2, p => p.fast(4))

Timing Transforms

FunctionDescriptionExample
swing(amount)Add swing feelswing(0.1)
off(time, fn)Offset copy with transformoff(0.25, p => p.add(7))

Echo & Stutter

FunctionDescriptionExample
stut(n, time, fb)Stutter n timesstut(4, 0.125, 0.5)
echo(n, time, fb)Echo n times with feedbackecho(4, 0.25, 0.7)
gap(n, time)Gap stutter effectgap(4, 0.125)
elongate(n)Stretch patternelongate(2)

Sample Manipulation

FunctionDescriptionExample
chop(n)Chop sample into n pieceschop(8)
striate(n)Granular striatestriate(16)
shuffle(n)Shuffle n partsshuffle(4)

Sample Playback Control

MethodDescriptionRange
.speed(n)Playback speed-4 to 4 (negative = reverse)
.begin(pos)Sample start point0-1
.end(pos)Sample end point0-1
.loop(on)Loop sample0 or 1
.loopBegin(pos)Loop start0-1
.loopEnd(pos)Loop end0-1

Visualization

Visual feedback for patterns. Methods prefixed with underscore.

Pianoroll

note("c3 e3 g3 c4").s("triangle")
  ._pianoroll({ cycles: 4 })

Options: cycles (number of cycles to display), vertical (boolean)

Oscilloscope

note("c3").s("saw")
  ._scope(150)   // height in pixels

Punchcard

s("bd*4 [~ sd]*2")
  ._punchcard({ cycles: 2 })

Color

note("c3").color("#ff0088")  // Set event color

Interactive Controls

slider(id, label, min, max, step, default)

const cutoff = slider('cutoff', 'Filter', 200, 5000, 50, 1200);
note("c3").s("saw").lpf(cutoff)

toggle(id, label, default)

const reverb = toggle('reverb', 'Reverb', false);
note("c3").room(reverb ? 0.7 : 0)

select(id, label, options, default)

const wave = select('wave', 'Wave', ['sine', 'saw', 'square'], 'saw');
note("c3").s(wave)

Advanced Methods

MethodDescription
.collect()Collect pattern events into array
.restart(pat)Reset phase on trigger
.pick(patterns)Pick from array based on value
.as(name)Name a pattern
register(name, fn)Register custom function
.fmap(fn)Map over pattern values
.set(props)Set multiple properties
.appWhole(fn)Apply pattern of functions
alignWith(strategy, fn, patA, patB)Combine patterns with alignment
run(n)Create sequence 0,1,2...n-1

Pattern Alignment

Control how patterns are combined with alignWith.

StrategyDescription
'left'Keep timing of left pattern
'right'Keep timing of right pattern
'both'Combine both timings
'squeeze'Squeeze patterns together
'squeezeRight'Squeeze from right side
// Combine two patterns keeping left timing
alignWith('left', (a, b) => a + b,
  note("c3 e3"),
  note("0 7")
)

Custom Function Example

const myFn = register('myFn', (value, pat) => {
  return pat.fmap(v => ({ ...v, gain: value }));
});

note("c3").myFn(0.5)

Test Examples

Quick single-line examples to test each feature. Copy and paste to verify functionality.

Basic Playback

d1(s("bd sd hh oh"))

Sample Index (.n)

d1(s("clubkick*4").n("<0 1 2 3 4>"))

Notes

d1(s("sine*4").note("c4 e4 g4 c5"))

Gain

d1(s("bd*4").gain("<0.3 0.5 0.8 1>"))

Pan

d1(s("hh*8").pan(sine.range(0, 1)))

Speed

d1(s("bd*4").speed("<1 1.5 2 0.5>"))

Low-Pass Filter

d1(s("saw*4").note("c3").lpf("<200 400 800 1600>").lpq(5))

High-Pass Filter

d1(s("saw*4").note("c3").hpf("<100 200 400 800>"))

Attack Envelope

d1(s("saw*2").note("c3 e3").attack(0.3).release(0.5))

Decay/Sustain

d1(s("sine*4").note("c4").decay(0.2).sustain(0.3))

Delay

d1(s("cp*2").delay(0.5).delaytime(0.25).delayfeedback(0.5))

Reverb

d1(s("sd*2").room(0.8).size(0.9))

Bitcrusher

d1(s("bd*4").crush(4))

Compressor

d1(s("bd sd bd sd").compress(0.5).compressorRatio(8))

Sidechain Ducking

d1(s("bd*4"))
d2(s("saw").note("c2").lpf(400).duckorbit(0).duckattack(0.01).duckrelease(0.2).duckdepth(0.8))

Velocity

d1(s("hh*8").velocity("0.3 0.5 0.7 1 0.3 0.5 0.7 1"))

Filter Type (Ladder/24dB)

d1(s("saw").note("c2").lpf(400).lpq(8).ftype(1))

Sample Rate Reduction (Coarse)

d1(s("bd*4").coarse(8))

Waveshaping

d1(s("saw").note("c2").shape(0.7).lpf(800))

Post-Effects Gain

d1(s("saw").note("c2").distort(0.5).postgain(0.5))

Pitch Envelope (808 Kick)

d1(s("sine*4").note("c1").penv(24).pattack(0.001).pdecay(0.05).decay(0.3).sustain(0))

HP Filter Envelope

d1(s("saw").note("c2").hpf(100).hpenv(2000).hpattack(0.01).hpdecay(0.3))

Advanced Tremolo

d1(s("saw").note("c3").tremolo(0.8).tremrate(4).tremshape("square"))

Advanced Phaser

d1(s("saw").note("c3").phaser(1).phaserrate(0.3).phasercenter(800).phasersweep(600))

Advanced Reverb (Dark Room)

d1(s("cp*2").room(0.8).roomsize(3).roomlp(2000).roomdim(0.5))

Fast/Slow

d1(s("bd sd hh sd").fast(2))
d1(s("bd sd hh sd").slow(2))

Euclidean Rhythms

d1(euclid(5, 8, "bd"))

Stack

stack(
  s("bd*4"),
  s("~ sd ~ sd"),
  s("hh*8").gain(0.5)
)

Sequence

d1(seq("bd", "sd", "bd bd", "sd"))

Reverse

d1(s("arpy*4").n("<0 1 2 3>").rev())

Jux (Stereo Split)

d1(s("arpy*4").n("<0 1 2 3>").jux(x => x.rev()))

Every N Cycles

d1(s("bd*4").every(4, x => x.fast(2)))

Sometimes

d1(s("hh*8").sometimes(x => x.speed(2)))

Iter (Rotate)

d1(s("bd sd hh oh").iter(4))

Palindrome

d1(s("bd sd hh oh").palindrome())

Chunk

d1(s("bd sd hh oh hh sd bd oh").chunk(4, x => x.rev()))

Off (Offset Echo)

d1(s("bd sd").off(0.125, x => x.speed(1.5).gain(0.5)))

Degrade (Random Drops)

d1(s("hh*16").degrade())

Mini-Notation

d1(mini("[bd sd] hh [bd bd] sd"))

Synths

d1(s("sine").note("c3 e3 g3 c4").attack(0.01).decay(0.1).sustain(0.5).release(0.3))
d1(s("saw").note("c2").lpf(400).gain(0.5))
d1(s("square").note("e4 g4").gain(0.3).lpf(1000))

Signals (LFO)

d1(s("saw*4").note("c3").lpf(sine.range(200, 2000).slow(4)))

Multiple Orbits

d1(s("bd*4"))
d2(s("hh*8").gain(0.4))
d3(s("~ sd ~ sd"))

Clip Duration

d1(s("pad").note("c3 e3 g3").clip(0.5))

Chop (Slice Sample)

d1(s("breaks165").chop(8))

Stutter

d1(s("bd sd").stut(3, 0.5, 0.125))

Hush (Stop All)

hush()

Recipes & Examples

Copy-paste these complete examples to get started quickly.

Basic House Beat

d1(s("bd*4").bank("RolandTR909"))
d2(s("~ cp").fast(2).bank("RolandTR909"))
d3(s("hh*8").gain(0.4).bank("RolandTR909"))

Acid Bassline

d1(note("c2 c2 c3 c2 eb2 c2 f2 c2")
  .s("saw")
  .lpf(800).lpq(15)
  .lpenv(2000).lpa(0.01).lpd(0.1)
  .attack(0.001).decay(0.1).sustain(0))

Build-up with Drop

// Full beat for 12 cycles, breakdown for 4
d1(s("bd*4").bank("RolandTR909"))
d2(s("hh*8").whenmod(16, 12, () => silence()).bank("RolandTR909"))
d3(s("~ cp").fast(2).whenmod(16, 12, () => silence()).bank("RolandTR909"))

// Hi-hat roll on last 2 cycles before drop
d4(s("hh*4")
  .whenmod(16, 14, p => p.fast(4))
  .whenmod(16, 15, p => p.fast(8))
  .bank("RolandTR909"))

Ambient Pad with LFO

d1(note("[c3,e3,g3] [f3,a3,c4]").slow(2)
  .s("pad")
  .lpf(sine.range(500, 2000).slow(8))
  .room(0.8).roomsize(0.9)
  .attack(0.5).release(2))

Polyrhythmic Percussion

d1(euclid(3, 8, "bd").s().bank("RolandTR909"))
d2(euclid(5, 8, "hh").s().gain(0.5).bank("RolandTR909"))
d3(euclid(7, 16, "cp").s().gain(0.6).bank("RolandTR909"))

Stuttering Lead

d1(note("c4 e4 g4 b4")
  .s("saw")
  .every(4, p => p.stut(4, 0.5, 0.125))
  .lpf(2000)
  .delay(0.3).dt(0.25).dfb(0.4))