Reference

This is the long list of functions you can use. Remember that you don't need to remember all of those and that you can already make music with a small set of functions!

absoluteOrientationAlpha

Synonyms: absOriA, absOriZ, absoluteOrientationZ

The device's absolute orientation alpha value ranges from 0 to 1.

    n(absoluteOrientationAlpha.segment(4).range(0,7)).scale("C:minor")

    absoluteOrientationBeta

    Synonyms: absOriB, absOriX, absoluteOrientationX

    The device's absolute orientation beta value ranges from 0 to 1.

      n(absoluteOrientationBeta.segment(4).range(0,7)).scale("C:minor")

      absoluteOrientationGamma

      Synonyms: absOriG, absOriY, absoluteOrientationY

      The device's absolute orientation gamma value ranges from 0 to 1.

        n(absoluteOrientationGamma.segment(4).range(0,7)).scale("C:minor")

        accelerationX

        Synonyms: accX

        The accelerometer's x-axis value ranges from 0 to 1.

          n(accelerationX.segment(4).range(0,7)).scale("C:minor")

          accelerationY

          Synonyms: accY

          The accelerometer's y-axis value ranges from 0 to 1.

            n(accelerationY.segment(4).range(0,7)).scale("C:minor")

            accelerationZ

            Synonyms: accZ

            The accelerometer's z-axis value ranges from 0 to 1.

              n(accelerationZ.segment(4).range(0,7)).scale("C:minor")

              add

              Assumes a pattern of numbers. Adds the given number to each item in the pattern.

                // Here, the triad 0, 2, 4 is shifted by different amounts
                n("0 2 4".add("<0 3 4 0>")).scale("C:major")
                // Without add, the equivalent would be:
                // n("<[0 2 4] [3 5 7] [4 6 8] [0 2 4]>").scale("C:major")
                // You can also use add with notes:
                note("c3 e3 g3".add("<0 5 7 0>"))
                // Behind the scenes, the notes are converted to midi numbers:
                // note("48 52 55".add("<0 5 7 0>"))

                addVoicings

                Adds a new custom voicing dictionary.

                • name (string): identifier for the voicing dictionary
                • dictionary (object): maps chord symbol to possible voicings
                • range (Array): min, max note
                addVoicings('cookie', {
                  7: ['3M 7m 9M 12P 15P', '7m 10M 13M 16M 19P'],
                  '^7': ['3M 6M 9M 12P 14M', '7M 10M 13M 16M 19P'],
                  m7: ['8P 11P 14m 17m 19P', '5P 8P 11P 14m 17m'],
                  m7b5: ['3m 5d 8P 11P 14m', '5d 8P 11P 14m 17m'],
                  o7: ['3m 6M 9M 11A 15P'],
                  '7alt': ['3M 7m 10m 13m 15P'],
                  '7#11': ['7m 10m 13m 15P 17m'],
                }, ['C3', 'C6'])
                "<C^7 A7 Dm7 G7>".voicings('cookie').note()

                adsr

                ADSR envelope: Combination of Attack, Decay, Sustain, and Release.

                • time (number|Pattern): attack time in seconds
                • time (number|Pattern): decay time in seconds
                • gain (number|Pattern): sustain level (0 to 1)
                • time (number|Pattern): release time in seconds
                note("[c3 bb2 f3 eb3]*2").sound("sawtooth").lpf(600).adsr(".1:.1:.5:.2")

                aliasBank

                Register an alias for a bank of sounds. Optionally accepts a single argument map of bank aliases. Optionally accepts a single argument string of a path to a JSON file containing bank aliases.

                • args (any): either one or two arguments. first argument is bank to alias. Second argument is alias to use for the bank.

                all

                Applies a function to all the running patterns. Note that the patterns are grouped together into a single stack before the function is applied. This is probably what you want, but see each for a version that applies the function to each pattern separately.

                Note: Patterns must be labeled (e.g. with $:) to be picked up by all. An unlabeled pattern such as note("c4") is not registered and will produce no audio when all is present. Use $: note("c4") instead.

                $: sound("bd - cp sd")
                $: sound("hh*8")
                all(fast("<2 3>"))
                
                $: sound("bd - cp sd")
                $: sound("hh*8")
                all(x => x.pianoroll())
                
                • transform (function):

                almostAlways

                Shorthand for .sometimesBy(0.9, fn)

                  s("hh*8").almostAlways(x=>x.speed("0.5"))

                  almostNever

                  Shorthand for .sometimesBy(0.1, fn)

                    s("hh*8").almostNever(x=>x.speed("0.5"))

                    always

                    Shorthand for .sometimesBy(1, fn) (always calls fn)

                      s("hh*8").always(x=>x.speed("0.5"))

                      anchor

                      The top note to align the voicing to. Defaults to c5

                      • anchorNote (string|Pattern): the note to align the voicing or scale to
                      anchor("<c4 g4 c5 g5>").chord("C").voicing()
                      n("0 .. 7").anchor("<c4 g4 c5 g5>").scale("<C:major F:minor>")

                      and

                      performs a && b

                      • a (any):
                      • b (any):

                      appBoth

                      When this method is called on a pattern of functions, it matches its haps with those in the given pattern of values. A new pattern is returned, with each matching value applied to the corresponding function.

                      In this _appBoth variant, where timespans of the function and value haps are not the same but do intersect, the resulting hap has a timespan of the intersection. This applies to both the part and the whole timespan.

                      • pat_val (Pattern):

                      appLeft

                      As with appBoth, but the whole timespan is not the intersection, but the timespan from the function of patterns that this method is called on. In practice, this means that the pattern structure, including onsets, are preserved from the pattern of functions (often referred to as the left hand or inner pattern).

                      • pat_val (Pattern):

                      apply

                      Applies the given function to the pattern. Like layer, but with a single function:

                        "<c3 eb3 g3>".scale('C minor').apply(scaleTranspose("0,2,4")).note()

                        applyGradualLowpass

                        Applies a constantly changing lowpass filter to the given sound.

                        • input (AudioBuffer):
                        • lpFreqStart (number):
                        • lpFreqEnd (number):
                        • lpFreqEndAt (number):
                        • callback (function): May be called immediately within the current execution context, or later.

                        applyHannWindow

                        Apply Hann window in-place

                        • input (Array.<number>):

                        appRight

                        As with appLeft, but whole timespans are instead taken from the pattern of values, i.e. structure is preserved from the right hand/outer pattern.

                        • pat_val (Pattern):

                        appWhole

                        Assumes 'this' is a pattern of functions, and given a function to resolve wholes, applies a given pattern of values to that pattern of functions.

                        • whole_func (function):
                        • pat_val (function):

                        arp

                        Selects indices in in stacked notes.

                          note("<[c,eb,g]!2 [c,f,ab] [d,f,ab]>")
                          .arp("0 [0,2] 1 [0,2]")

                          arpWith

                          Selects indices in in stacked notes.

                            note("<[c,eb,g]!2 [c,f,ab] [d,f,ab]>")
                            .arpWith(haps => haps[2])

                            arrange

                            Allows to arrange multiple patterns together over multiple cycles. Takes a variable number of arrays with two elements specifying the number of cycles and the pattern to use.

                            • sections (any):
                            arrange(
                              [4, "<c a f e>(3,8)"],
                              [2, "<g a>(5,8)"]
                            ).note()

                            as

                            Sets properties in a batch.

                            • mapping (string|Array): the control names that are set
                            "c:.5 a:1 f:.25 e:.8".as("note:clip")
                            "{0@2 0.25 0 0.5 .3 .5}%8".as("begin").s("sax_vib").clip(1)

                            asNumber

                            Creates a new pattern with all values parsed as numerals.

                              asym

                              Asymmetrical diode distortion

                              • distortion (number|Pattern): amount of distortion to apply
                              • volume (number|Pattern): linear postgain of the distortion

                              attack

                              Synonyms: att

                              Amplitude envelope attack time: Specifies how long it takes for the sound to reach its peak value, relative to the onset.

                              • attack (number|Pattern): time in seconds.
                              note("c3 e3 f3 g3").attack("<0 .1 .5>")

                              band

                              Performs a bitwise and on each number and the given factor

                                bank

                                Select the sound bank to use. To be used together with s. The bank name (+ "_") will be prepended to the value of s.

                                • bank (string|Pattern): the name of the bank
                                s("bd sd [~ bd] sd").bank('RolandTR909') // = s("RolandTR909_bd RolandTR909_sd")

                                base

                                Creates a pattern of numbers in base b from a number or pattern of numbers limited to d digits long from the right

                                • n (number|Pattern|Array.<number>): number to convert
                                • b (number|Pattern): base to convert to (defaults to 10)
                                • d (number|Pattern): max number of digits to produce for each n (defaults to 0 for all)
                                $: note(base("7175 543", 10, 3)).scale("c:major").s("saw")
                                // $: note("1 7 5 5 4 3").scale("c:major").s("saw")

                                beat

                                creates a structure pattern from divisions of a cycle especially useful for creating rhythms

                                • join (function):
                                s("bd").beat("0,7,10", 16)
                                s("sd").beat("4,12", 16)

                                begin

                                A pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. 0.25 to cut off the first quarter from each sample.

                                • amount (number|Pattern): between 0 and 1, where 1 is the length of the sample
                                samples({ rave: 'rave/AREUREADY.wav' }, 'github:tidalcycles/dirt-samples')
                                s("rave").begin("<0 .25 .5 .75>").fast(2)

                                berlin

                                Generates a continuous pattern of [berlin noise](conceived by Jame Coyne and Jade Rowland as a joke but turned out to be surprisingly cool and useful, like perlin noise but with sawtooth waves), in the range 0..1.

                                  // ascending arpeggios
                                  n("0!16".add(berlin.fast(4).mul(14))).scale("d:minor")

                                  binary

                                  Creates a binary pattern from a number.

                                  • n (number): input number to convert to binary
                                  "hh".s().struct(binary(5))
                                  // "hh".s().struct("1 0 1")

                                  binaryL

                                  Creates a binary list pattern from a number.

                                  • n (number): input number to convert to binary
                                  s("saw").seg(8)
                                    .partials(binaryL(irand(4096).add(1)))

                                  binaryN

                                  Creates a binary pattern from a number, padded to n bits long.

                                  • n (number): input number to convert to binary
                                  • nBits (number): pattern length, defaults to 16
                                  "hh".s().struct(binaryN(55532, 16))
                                  // "hh".s().struct("1 1 0 1 1 0 0 0 1 1 1 0 1 1 0 0")

                                  binaryNL

                                  Creates a binary list pattern from a number, padded to n bits long.

                                  • n (number): input number to convert to binary
                                  • nBits (number): pattern length, defaults to 16

                                  bite

                                  Splits a pattern into the given number of slices, and plays them according to a pattern of slice numbers. Similar to slice, but slices up patterns rather than sound samples.

                                  • number (number): of slices
                                  • slices (number): to play
                                  note("0 1 2 3 4 5 6 7".scale('c:mixolydian'))
                                  .bite(4, "3 2 1 0")
                                  sound("bd - bd bd*2, - sd:6 - sd:5 sd:1 - [- sd:2] -, hh [- cp:7]")
                                  .bank("RolandTR909").speed(1.2)
                                  .bite(4, "0 0 [1 2] <3 2> 0 0 [2 1] 3")

                                  blshift

                                  Performs a bitwise left shift on each number by the given factor

                                    bmod

                                    Modulates with the output from a given bus. Can be called in sequence like pat.bmod(...).bmod(...) to set up multiple modulators

                                    Send to an audio bus with otherPat.bus(..).

                                    There are two ways to declare which control will be modulated:

                                    1. Explicitly put control in the config (e.g. bmod({ id: 2, c: "lpf" }))
                                    2. If the control parameter is absent, the control immediately before the bmod call will be used (e.g. s("saw").lpf(500).bmod({ id: 2 }) to modulate lpf)

                                    Modulators can be referred to by id so that they can be updated later e.g. inside a sometimes. See example below.

                                    • config (object): Bus modulation configuration.
                                    • config.bus (string|Pattern): Bus to get modulation signal from
                                    • config.control (string|Pattern): Node to modulate. Aliases: c
                                    • config.subControl (string|Pattern): Sub-control name to append to the control key. Aliases: sc
                                    • config.depth (number|Pattern): Relative modulation depth. Aliases: dep, dr
                                    • config.depthabs (number|Pattern): Absolute modulation depth. Aliases: da
                                    • config.dc (number|Pattern): DC offset prior to application
                                    • config.fxi (number|Pattern): FX index to target
                                    • id (string|Pattern): ID to use for this modulator
                                    modulator: s("one").seg(64).gain(slider(0, 0, 1)).bus(1).dry(0)
                                    carrier: s("saw").bmod({ b: 1 })

                                    bor

                                    Performs a bitwise or on each number and the given factor

                                      bpattack

                                      Synonyms: bpa

                                      Sets the attack duration for the bandpass filter envelope.

                                      • attack (number|Pattern): time of the bandpass filter envelope
                                      note("c2 e2 f2 g2")
                                      .sound('sawtooth')
                                      .bpf(500)
                                      .bpa("<.5 .25 .1 .01>/4")
                                      .bpenv(4)

                                      bpdc

                                      DC offset of the LFO for the bandpass filter

                                      • dcoffset (number|Pattern): dc offset. set to 0 for unipolar

                                      bpdecay

                                      Synonyms: bpd

                                      Sets the decay duration for the bandpass filter envelope.

                                      • decay (number|Pattern): time of the bandpass filter envelope
                                      note("c2 e2 f2 g2")
                                      .sound('sawtooth')
                                      .bpf(500)
                                      .bpd("<.5 .25 .1 0>/4")
                                      .bps(0.2)
                                      .bpenv(4)

                                      bpdepth

                                      Depth of the LFO for the bandpass filter

                                      • depth (number|Pattern): depth of modulation

                                      bpdepthfrequency

                                      Synonyms: bpdepthfreq

                                      Depth of the LFO for the bandpass filter, in HZ

                                      • depth (number|Pattern): depth of modulation
                                      note("<c c c# c c c4>*16").s("sawtooth").lpf(600).bpdepthfrequency("<200 500 100 0>")

                                      bpenv

                                      Synonyms: bpe

                                      Sets the bandpass filter envelope modulation depth.

                                      • modulation (number|Pattern): depth of the bandpass filter envelope between 0 and n
                                      note("c2 e2 f2 g2")
                                      .sound('sawtooth')
                                      .bpf(500)
                                      .bpa(.5)
                                      .bpenv("<4 2 1 0 -1 -2 -4>/4")

                                      bpf

                                      Synonyms: bandf, bp

                                      Sets the center frequency of the band-pass filter. When using mininotation, you can also optionally supply the 'bpq' parameter separated by ':'.

                                      • frequency (number|Pattern): center frequency
                                      s("bd sd [~ bd] sd,hh*6").bpf("<1000 2000 4000 8000>")

                                      bpq

                                      Synonyms: bandq

                                      Sets the band-pass q-factor (resonance).

                                      • q (number|Pattern): q factor
                                      s("bd sd [~ bd] sd").bpf(500).bpq("<0 1 2 3>")

                                      bprate

                                      Rate of the LFO for the bandpass filter

                                      • rate (number|Pattern): rate in hertz

                                      bprelease

                                      Synonyms: bpr

                                      Sets the release time for the bandpass filter envelope.

                                      • release (number|Pattern): time of the bandpass filter envelope
                                      note("c2 e2 f2 g2")
                                      .sound('sawtooth')
                                      .clip(.5)
                                      .bpf(500)
                                      .bpenv(4)
                                      .bpr("<.5 .25 .1 0>/4")
                                      .release(.5)

                                      bpshape

                                      Shape of the LFO for the bandpass filter

                                      • shape (number|Pattern): Shape of the lfo (0, 1, 2, ..)

                                      bpskew

                                      Skew of the LFO for the bandpass filter

                                      • skew (number|Pattern): How much to bend the LFO shape

                                      bpsustain

                                      Synonyms: bps

                                      Sets the sustain amplitude for the bandpass filter envelope.

                                      • sustain (number|Pattern): amplitude of the bandpass filter envelope
                                      note("c2 e2 f2 g2")
                                      .sound('sawtooth')
                                      .bpf(500)
                                      .bpd(.5)
                                      .bps("<0 .25 .5 1>/4")
                                      .bpenv(4)

                                      bpsync

                                      Cycle-synced rate of the LFO for the bandpass filter

                                      • rate (number|Pattern): rate in cycles

                                      brak

                                      Returns a new pattern where every other cycle is played once, twice as fast, and offset in time by one quarter of a cycle. Creates a kind of breakbeat feel.

                                        s("bd hh!2 rim").brak()

                                        brand

                                        A continuous pattern of 0 or 1 (binary random)

                                          s("hh*10").pan(brand)

                                          brandBy

                                          A continuous pattern of 0 or 1 (binary random), with a probability for the value being 1

                                          • pPat (number): probability - a number between 0 and 1
                                          s("hh*10").pan(brandBy(0.2))

                                          brshift

                                          Performs a bitwise right shift on each number by the given factor

                                            bus

                                            A bus is a send which can be used for mixing patterns. It combines with.. s("bus") to play that bus through another pattern (for, say, applying non-linear effects like distortion to multiple signals)

                                            otherPat.bmod(..) (to modulate another pattern with the bus)

                                            • number (number|Pattern):

                                            busgain

                                            Synonyms: bgain

                                            Postgain multiplier prior to sending the signal to the audio bus.

                                            • number (number|Pattern):

                                            bxor

                                            Performs a bitwise xor on each number and the given factor

                                              byteBeatExpression

                                              Synonyms: bbexpr, bb

                                              Create byte beats with custom expressions

                                              • byteBeatExpression (number|Pattern): bitwise expression for creating bytebeat
                                              s("bytebeat").bbexpr('t*(t>>15^t>>66)')

                                              byteBeatStartTime

                                              Synonyms: bbst

                                              Create byte beats with custom expressions

                                              • byteBeatStartTime (number|Pattern): in samples (t)
                                              note("c3!8".add("{0 0 12 0 7 5 3}%8")).s("bytebeat:5").bbst("<3 1>".mul(10000))._scope()

                                              ccn

                                              MIDI control number: Sends a MIDI control change message.

                                              • MIDI (number|Pattern): control number (0-127)

                                              ccv

                                              MIDI control value: Sends a MIDI control change message.

                                              • MIDI (number|Pattern): control value (0-127)

                                              ceil

                                              Assumes a numerical pattern. Returns a new pattern with all values set to their mathematical ceiling. E.g. 3.2 replaced with 4, and -4.2 replaced with -4.

                                                note("42 42.1 42.5 43".ceil())

                                                channel

                                                Choose the channel the pattern is sent to

                                                • channel (number|Pattern): channel number

                                                channels

                                                Synonyms: ch

                                                Allows you to set the output channels on the interface

                                                • channels (number|Pattern): pattern the output channels
                                                note("e a d b g").channels("3:4")

                                                chebyshev

                                                Distortion via Chebyshev polynomials

                                                • distortion (number|Pattern): amount of distortion to apply
                                                • volume (number|Pattern): linear postgain of the distortion

                                                choose

                                                Chooses randomly from the given list of elements.

                                                • xs (any): values / patterns to choose from.
                                                note("c2 g2!2 d2 f1").s(choose("sine", "triangle", "bd:6"))

                                                choose2

                                                As with choose, but the pattern that this method is called on should be in the range -1 .. 1

                                                • xs (any):

                                                chooseCycles

                                                Synonyms: randcat

                                                Picks one of the elements at random each cycle.

                                                • xs (any):
                                                chooseCycles("bd", "hh", "sd").s().fast(8)
                                                s("bd | hh | sd").fast(8)

                                                chooseInWith

                                                As with {chooseWith}, but the structure comes from the chosen values, rather than the pattern you're using to choose with.

                                                • pat (Pattern):
                                                • xs (*):
                                                // Because the structure comes from the chosen values (the notes, here)
                                                // The choosing pattern will only advance once per cycle (not 3 times per cycle)
                                                note(chooseInWith("<0 0.5 1>*3", ["c3", "b3", "d3"]))
                                                // Here, the chosen values have a structure such that the choosing pattern will advance 3 times per cycle
                                                note(chooseInWith("<0 0.5 1>*3", ["c3*3", "b3*3", "d3*3"]))

                                                chooseWith

                                                Choose from the list of values (or patterns of values) using the given pattern of numbers, which should be in the range of 0..1

                                                • pat (Pattern):
                                                • xs (*):
                                                note("c2 g2!2 d2 f1").s(chooseWith(sine.fast(2), ["sawtooth", "triangle", "bd:6"]))
                                                // Compare with chooseInWith
                                                note(chooseWith("<0 0.5 1>*3", ["c3", "b3", "d3"]))

                                                chop

                                                Cuts each sample into the given number of parts, allowing you to explore a technique known as 'granular synthesis'. It turns a pattern of samples into a pattern of parts of samples.

                                                  samples({ rhodes: 'https://cdn.freesound.org/previews/132/132051_316502-lq.mp3' })
                                                  s("rhodes")
                                                   .chop(4)
                                                   .rev() // reverse order of chops
                                                   .loopAt(2) // fit sample into 2 cycles

                                                  chord

                                                  The chord to voice

                                                  • symbols (string|Pattern): chord symbols to voice e.g., C, Eb, Fm7, G7. The symbols can be defined via addVoicings
                                                  chord("<Am C D F Am E Am E>").voicing()

                                                  chorus

                                                  mix control for the chorus effect

                                                  • chorus (string|Pattern): mix amount between 0 and 1
                                                  note("d d a# a").s("sawtooth").chorus(.5)

                                                  chunk

                                                  Synonyms: slowChunk, slowchunk

                                                  Divides a pattern into a given number of parts, then cycles through those parts in turn, applying the given function to each part in turn (one part per cycle).

                                                  • n (number):
                                                  • func (function):
                                                  • pat (Pattern):
                                                  • back (boolean):
                                                  • fast (boolean):
                                                  "0 1 2 3".chunk(4, x=>x.add(7))
                                                  .scale("A:minor").note()

                                                  chunkBack

                                                  Synonyms: chunkback

                                                  Like chunk, but cycles through the parts in reverse order. Known as chunk' in tidalcycles

                                                    "0 1 2 3".chunkBack(4, x=>x.add(7))
                                                    .scale("A:minor").note()

                                                    chunkBackInto

                                                    Synonyms: chunkbackinto

                                                    Like chunkInto, but moves backwards through the chunks.

                                                      sound("bd sd ht lt bd - cp lt").chunkInto(4, hurry(2))
                                                        .bank("tr909")

                                                      chunkInto

                                                      Synonyms: chunkinto

                                                      Like chunk, but the function is applied to a looped subcycle of the source pattern.

                                                        sound("bd sd ht lt bd - cp lt").chunkInto(4, hurry(2))
                                                          .bank("tr909")

                                                        chyx

                                                        BYTE BEATS

                                                          clip

                                                          Synonyms: legato

                                                          Multiplies the duration with the given number. Also cuts samples off at the end if they exceed the duration.

                                                          • factor (number|Pattern): = 0
                                                          note("c a f e").s("piano").clip("<.5 1 2>")

                                                          close

                                                          The same as open, but goes from 1 to 0 over one cycle, and then stays on 0 forever.

                                                            sound("bd sd [- bd] sd".fast(2))
                                                              .lpf(close.slow(4).range(300,3000)) // close envelope over 4 cycles
                                                              .restart("x/4") // restart every 4 cycles

                                                            coarse

                                                            Fake-resampling for lowering the sample rate. Caution: This effect seems to only work in chromium based browsers

                                                            • factor (number|Pattern): 1 for original 2 for half, 3 for a third and so on.
                                                            s("bd sd [~ bd] sd,hh*8").coarse("<1 4 8 16 32>")

                                                            color

                                                            Synonyms: colour

                                                            Sets the color of the hap in visualizations like pianoroll or highlighting.

                                                            • color (string): Hexadecimal or CSS color name

                                                            compress

                                                            Compress each cycle into the given timespan, leaving a gap

                                                              cat(
                                                                s("bd sd").compress(.25,.75),
                                                                s("~ bd sd ~")
                                                              )

                                                              compressor

                                                              Dynamics Compressor. The params are compressor("threshold:ratio:knee:attack:release") More info here

                                                                s("bd sd [~ bd] sd,hh*8")
                                                                .compressor("-20:20:10:.002:.02")

                                                                computeMagnitudes

                                                                Compute squared magnitudes for peak finding

                                                                  contract

                                                                  Experimental

                                                                  Contracts the step size of the pattern by the given factor. See also expand.

                                                                    sound("tha dhi thom nam").bank("mridangam").contract("3 2 1 1 2 3").pace(8)

                                                                    control

                                                                    MIDI control: Sends a MIDI control change message.

                                                                    • MIDI (number|Pattern): control number (0-127)
                                                                    • MIDI (number|Pattern): controller value (0-127)

                                                                    cosine

                                                                    A cosine signal between 0 and 1.

                                                                      n(stack(sine,cosine).segment(16).range(0,15))
                                                                      .scale("C:minor")

                                                                      cosine2

                                                                      A cosine signal between -1 and 1 (like cosine, but bipolar).

                                                                        cpm

                                                                        Plays the pattern at the given cycles per minute.

                                                                          s("<bd sd>,hh*2").cpm(90) // = 90 bpm

                                                                          createCC

                                                                          Implementation for the cc() factory function tied to this specific input.

                                                                          • cc (number): MIDI CC number
                                                                          • chan (number|undefined): MIDI channel (1-16) or undefined for all channels

                                                                          crush

                                                                          Bit crusher effect.

                                                                          • depth (number|Pattern): between 1 (for drastic reduction in bit-depth) to 16 (for barely no reduction).
                                                                          s("<bd sd>,hh*3").fast(2).crush("<16 8 7 6 5 4 3 2>")

                                                                          csoundm

                                                                          Sends notes to Csound for rendering with MIDI semantics. The hap value is translated to these Csound pfields:

                                                                          p1 -- Csound instrument either as a number (1-based, can be a fraction), or as a string name. p2 -- time in beats (usually seconds) from start of performance. p3 -- duration in beats (usually seconds). p4 -- MIDI key number (as a real number, not an integer but in [0, 127]. p5 -- MIDI velocity (as a real number, not an integer but in [0, 127]. p6 -- Strudel controls, as a string.

                                                                            cubic

                                                                            Cubic polynomial distortion

                                                                            • distortion (number|Pattern): amount of distortion to apply
                                                                            • volume (number|Pattern): linear postgain of the distortion

                                                                            cut

                                                                            In the style of classic drum-machines, cut will stop a playing sample as soon as another samples with in same cutgroup is to be played. An example would be an open hi-hat followed by a closed one, essentially muting the open.

                                                                            • group (number|Pattern): cut group number
                                                                            s("[oh hh]*4").cut(1)

                                                                            cyclesPer

                                                                            A pattern measuring the duration of events, in cycles per event. cyclesPer doesn't have structure itself, but takes structure, and therefore event durations, from the pattern that it is combined with. For example cyclesPer.struct("1 1 [1 1] 1") would give the same as "0.25 0.25 [0.125 0.125] 0.25". See also its reciprocal, per, also known as perCycle.

                                                                              // Shorter events are lower in pitch
                                                                              sound("saw saw [saw saw] saw")
                                                                                .note(cyclesPer.range(50, 100))
                                                                              sound("bd sd [bd bd] sd*4 [- sd] [bd [bd bd]]")
                                                                                .note(cyclesPer.add(20))

                                                                              decay

                                                                              Synonyms: dec

                                                                              Amplitude envelope decay time: the time it takes after the attack time to reach the sustain level. Note that the decay is only audible if the sustain value is lower than 1.

                                                                              • time (number|Pattern): decay time in seconds
                                                                              note("c3 e3 f3 g3").decay("<.1 .2 .3 .4>").sustain(0)

                                                                              defaultmidimap

                                                                              configures the default midimap, which is used when no "midimap" port is set

                                                                              • mapping (*):
                                                                              defaultmidimap({ lpf: 74 })
                                                                              $: note("c a f e").midi();
                                                                              $: lpf(sine.slow(4).segment(16)).midi();

                                                                              defragmentHaps

                                                                              Combines adjacent haps with the same value and whole. Only intended for use in tests.

                                                                                degrade

                                                                                Randomly removes 50% of events from the pattern. Shorthand for .degradeBy(0.5)

                                                                                  s("hh*8").degrade()
                                                                                  s("[hh?]*8")

                                                                                  degradeBy

                                                                                  Randomly removes events from the pattern by a given amount. 0 = 0% chance of removal 1 = 100% chance of removal

                                                                                  • amount (number): a number between 0 and 1
                                                                                  s("hh*8").degradeBy(0.2)
                                                                                  s("[hh?0.2]*8")
                                                                                  //beat generator
                                                                                  s("bd").segment(16).degradeBy(.5).ribbon(16,1)

                                                                                  degradeByWith

                                                                                  degradeByWith is like degradeBy, but with control over the random or other signal used to filter out the events.

                                                                                  degradeBy(x) is essentially degradeByWith(rand, x)

                                                                                  This allows you to do things other than with rand, see examples below

                                                                                  • test (Pattern|number):
                                                                                  • testAgainst (Pattern|number):
                                                                                  note("c a f e").degradeByWith(sine, .1)
                                                                                  note("c a f e").degradeByWith(perlin, .5)
                                                                                  note("c a f e").degradeByWith(sine, cosine)

                                                                                  delay

                                                                                  Sets the level of the delay signal.

                                                                                  When using mininotation, you can also optionally add the 'delaytime' and 'delayfeedback' parameter, separated by ':'.

                                                                                  • level (number|Pattern): between 0 and 1
                                                                                  s("bd bd").delay("<0 .25 .5 1>")
                                                                                  s("bd bd").delay("0.65:0.25:0.9 0.65:0.125:0.7")

                                                                                  delayfeedback

                                                                                  Synonyms: delayfb, dfb

                                                                                  Sets the level of the signal that is fed back into the delay. Caution: Values >= 1 will result in a signal that gets louder and louder! Don't do it

                                                                                  • feedback (number|Pattern): between 0 and 1
                                                                                  s("bd").delay(.25).delayfeedback("<.25 .5 .75 1>")

                                                                                  delaysync

                                                                                  Synonyms: delays, ds

                                                                                  Sets the time of the delay effect in cycles.

                                                                                  • cycles (number|Pattern): delay length in cycles
                                                                                  s("bd bd").delay(.25).delaysync("<1 2 3 5>".div(8))

                                                                                  delaytime

                                                                                  Synonyms: delayt, dt

                                                                                  Sets the time of the delay effect in seconds.

                                                                                  • delay (number|Pattern): in seconds
                                                                                  note("d d a# a".fast(2))
                                                                                  .s("sawtooth")
                                                                                  .delay(.8)
                                                                                  .delaytime(1/2)

                                                                                  density

                                                                                  crackle noise density

                                                                                  • density (number|Pattern): between 0 and x
                                                                                  s("crackle*4").density("<0.01 0.04 0.2 0.5>".slow(4))

                                                                                  detune

                                                                                  Synonyms: det

                                                                                  Set detune for stacked voices of supported oscillators.

                                                                                  • amount (number|Pattern):
                                                                                  note("d f a a# a d3").fast(2).s("supersaw").detune("<.1 .2 .5 24.1>")

                                                                                  dictionary

                                                                                  Which dictionary to use for the voicings. This falls back to the default dictionary if not provided

                                                                                  • dictionaryName (string): which dictionary (having been defined with addVoicings) to use
                                                                                  addVoicings('house', {
                                                                                  '': ['7 12 16', '0 7 16', '4 7 12'],
                                                                                  'm': ['0 3 7']
                                                                                  })
                                                                                  chord("<Am C D F Am E Am E>")
                                                                                  .dict('house').anchor(66)
                                                                                  .voicing().room(.5)

                                                                                  diode

                                                                                  Diode-emulating distortion

                                                                                  • distortion (number|Pattern): amount of distortion to apply
                                                                                  • volume (number|Pattern): linear postgain of the distortion

                                                                                  discreteOnly

                                                                                  Returns a new pattern, with 'continuous' haps (those without 'whole' timespans) removed from query results.

                                                                                    distort

                                                                                    Synonyms: dist

                                                                                    Wave shaping distortion. CAUTION: it can get loud. Second option in optional array syntax (ex: ".9:.5") applies a postgain to the output. Third option sets the waveshaping type. Most useful values are usually between 0 and 10 (depending on source gain). If you are feeling adventurous, you can turn it up to 11 and beyond ;)

                                                                                    • distortion (number|Pattern): amount of distortion to apply
                                                                                    • volume (number|Pattern): linear postgain of the distortion
                                                                                    • type (number|string|Pattern): type of distortion to apply
                                                                                    s("bd sd [~ bd] sd,hh*8").distort("<0 2 3 10:.5>")
                                                                                    note("d1!8").s("sine").penv(36).pdecay(.12).decay(.23).distort("8:.4")
                                                                                    s("bd:4*4").bank("tr808").distort("3:0.5:diode")

                                                                                    distorttype

                                                                                    Synonyms: disttype

                                                                                    Type of waveshaping distortion to apply.

                                                                                    • type (number|string|Pattern): type of distortion to apply
                                                                                    s("bd*4").bank("tr909").distort(2).distorttype("<0 1 2>")
                                                                                    s("sine").note("F1*2").release(1)
                                                                                      .penv(24).pdecay(0.05)
                                                                                      .distort(rand.range(1, 8))
                                                                                      .distorttype("<fold chebyshev scurve diode asym sinefold>")

                                                                                    distortvol

                                                                                    Synonyms: distortion, distvol

                                                                                    Postgain for waveshaping distortion.

                                                                                    • volume (number|Pattern): linear postgain of the distortion
                                                                                    s("bd*4").bank("tr909").distort(2).distortvol(0.8)

                                                                                    div

                                                                                    Divides each number by the given factor.

                                                                                      djf

                                                                                      DJ filter, below 0.5 is low pass filter, above is high pass filter.

                                                                                      • cutoff (number|Pattern): below 0.5 is low pass filter, above is high pass filter
                                                                                      n(irand(16).seg(8)).scale("d:phrygian").s("supersaw").djf("<.5 .3 .2 .75>")

                                                                                      dough

                                                                                      Uses dough as the audio engine. more info here

                                                                                        $: chord("<Dm9 Dm11 Dm7>").offset("<-1 0 1 0>").voicing()
                                                                                        .phaser(3).fm(1.4).fmh(1.01)
                                                                                        .dough()

                                                                                        drawLine

                                                                                        Intended for a debugging, drawLine renders the pattern as a string, where each character represents the same time span. Should only be used with single characters as values, otherwise the character slots will be messed up. Character legend:

                                                                                        • "|" cycle separator
                                                                                        • "-" hold previous value
                                                                                        • "." silence
                                                                                        • pat (Pattern): the pattern to use
                                                                                        • chars (number): max number of characters (approximately)
                                                                                        const line = drawLine("0 [1 2 3]", 10); // |0--123|0--123
                                                                                        console.log(line);
                                                                                        silence;

                                                                                        drive

                                                                                        Filter overdrive for supported filter types

                                                                                        • amount (number|Pattern):
                                                                                        note("{f g g c d a a#}%16".sub(17)).s("supersaw").lpenv(8).lpf(150).lpq(.8).ftype('ladder').drive("<.5 4>")

                                                                                        drop

                                                                                        Experimental

                                                                                        Drops the given number of steps from a pattern. A positive number will drop steps from the start of a pattern, and a negative number from the end.

                                                                                          "tha dhi thom nam".drop("1").sound().bank("mridangam")
                                                                                          "tha dhi thom nam".drop("-1").sound().bank("mridangam")
                                                                                          "tha dhi thom nam".drop("0 1 2 3").sound().bank("mridangam")
                                                                                          "tha dhi thom nam".drop("0 -1 -2 -3").sound().bank("mridangam")

                                                                                          dry

                                                                                          Set dryness of reverb. See room and size for more information about reverb.

                                                                                          • dry (number|Pattern): 0 = wet, 1 = dry
                                                                                          n("[0,3,7](3,8)").s("superpiano").room(.7).dry("<0 .5 .75 1>").osc()

                                                                                          duckattack

                                                                                          Synonyms: duckatt, datt

                                                                                          The time required for the ducked signal(s) to return to their normal volume.

                                                                                          Can vary across orbits with the ':' mininotation, e.g. duckonset("0:0.003"). Note: this requires first applying the effect to multiple orbits with e.g. duckorbit("2:3").

                                                                                          • time (number|Pattern): The attack time in seconds
                                                                                          sound: n(run(8)).scale("c:minor").s("sawtooth").delay(.7).orbit(2)
                                                                                          ducker: s("bd:4!4").beat("0,4,8,11,14",16).duckorbit(2).duckattack("<0.2 0 0.4>").duckdepth(1)
                                                                                          moreduck: n(run(8)).scale("c:minor").s("sawtooth").delay(.7).orbit(2)
                                                                                          lessduck: s("hh*16").orbit(5)
                                                                                          ducker: s("bd:4!4").beat("0,4,8,11,14",16).duckorbit("2:5").duckattack("0.4:0.1")

                                                                                          duckdepth

                                                                                          The amount of ducking applied to target orbit

                                                                                          Can vary across orbits with the ':' mininotation, e.g. duckdepth("0.3:0.1"). Note: this requires first applying the effect to multiple orbits with e.g. duckorbit("2:3").

                                                                                          • depth (number|Pattern): depth of modulation from 0 to 1
                                                                                          stack( n(run(8)).scale("c:minor").s("sawtooth").delay(.7).orbit(2), s("bd:4!4").beat("0,4,8,11,14",16).duckorbit(2).duckattack(0.2).duckdepth("<1 .9 .6 0>"))
                                                                                          $: n(run(16)).scale("c:minor:pentatonic").s("sawtooth").delay(.7).orbit(2)
                                                                                          $: s("hh*16").orbit(3)
                                                                                          $: s("bd:4!4").beat("0,4,8,11,14",16).duckorbit("2:3").duckattack(0.2).duckdepth("1:0.5")

                                                                                          duckonset

                                                                                          Synonyms: duckons

                                                                                          The time required for the ducked signal(s) to reach their lowest volume. Can be used to prevent clicking or for creative rhythmic effects.

                                                                                          Can vary across orbits with the ':' mininotation, e.g. duckonset("0:0.003"). Note: this requires first applying the effect to multiple orbits with e.g. duckorbit("2:3").

                                                                                          • time (number|Pattern): The onset time in seconds
                                                                                          // Clicks
                                                                                          sound: freq("63.2388").s("sine").orbit(2).gain(4)
                                                                                          duckerWithClick: s("bd*4").duckorbit(2).duckattack(0.3).duckonset(0).postgain(0)
                                                                                          // No clicks
                                                                                          sound: freq("63.2388").s("sine").orbit(2).gain(4)
                                                                                          duckerWithoutClick: s("bd*4").duckorbit(2).duckattack(0.3).duckonset(0.01).postgain(0)
                                                                                          // Rhythmic
                                                                                          noise: s("pink").distort("2:1").orbit(4) // used rhythmically with 0.3 onset below
                                                                                          hhat: s("hh*16").orbit(7)
                                                                                          ducker: s("bd*4").bank("tr909").duckorbit("4:7").duckonset("0.3:0.003").duckattack(0.25)

                                                                                          duckorbit

                                                                                          Synonyms: duck

                                                                                          Modulate the amplitude of an orbit to create a "sidechain" like effect.

                                                                                          Can be applied to multiple orbits with the ':' mininotation, e.g. duckorbit("2:3")

                                                                                          • orbit (number|Pattern): target orbit
                                                                                          $: n(run(16)).scale("c:minor:pentatonic").s("sawtooth").delay(.7).orbit(2)
                                                                                          $: s("bd:4!4").beat("0,4,8,11,14",16).duckorbit(2).duckattack(0.2).duckdepth(1)
                                                                                          $: n(run(16)).scale("c:minor:pentatonic").s("sawtooth").delay(.7).orbit(2)
                                                                                          $: s("hh*16").orbit(3)
                                                                                          $: s("bd:4!4").beat("0,4,8,11,14",16).duckorbit("2:3").duckattack(0.2).duckdepth(1)

                                                                                          duration

                                                                                          Synonyms: dur

                                                                                          Sets the duration of the event in cycles. Similar to clip / legato, it also cuts samples off at the end if they exceed the duration.

                                                                                          • seconds (number|Pattern): = 0
                                                                                          note("c a f e").s("piano").dur("<.5 1 2>")

                                                                                          each

                                                                                          Applies a function to each of the running patterns separately. This is intended for future use with upcoming 'stepwise' features. See all for a version that applies the function to all the patterns stacked together into a single pattern.

                                                                                          Note: Patterns must be labeled (e.g. with $:) to be picked up by each. An unlabeled pattern such as note("c4") is not registered and will produce no audio when each is present. Use $: note("c4") instead.

                                                                                          $: sound("bd - cp sd")
                                                                                          $: sound("hh*8")
                                                                                          each(fast("<2 3>"))
                                                                                          
                                                                                          • transform (function):

                                                                                          early

                                                                                          Nudge a pattern to start earlier in time. Equivalent of Tidal's <~ operator

                                                                                          • cycles (number|Pattern): number of cycles to nudge left
                                                                                          "bd ~".stack("hh ~".early(.1)).s()

                                                                                          echo

                                                                                          Superimpose and offset multiple times, gradually decreasing the velocity

                                                                                          • times (number): how many times to repeat
                                                                                          • time (number): cycle offset between iterations
                                                                                          • feedback (number): velocity multiplicator for each iteration
                                                                                          s("bd sd").echo(3, 1/6, .8)

                                                                                          echoWith

                                                                                          Synonyms: echowith, stutWith, stutwith

                                                                                          Superimpose and offset multiple times, applying the given function each time.

                                                                                          • times (number): how many times to repeat
                                                                                          • time (number): cycle offset between iterations
                                                                                          • func (function): function to apply, given the pattern and the iteration index
                                                                                          "<0 [2 4]>"
                                                                                          .echoWith(4, 1/8, (p,n) => p.add(n*2))
                                                                                          .scale("C:minor").note()

                                                                                          edoScale

                                                                                          Turns numbers into notes in the given EDO scale (zero indexed).

                                                                                          An EDO scale definition looks like this:

                                                                                          e.g. C:LLsLLLs:2:1 <- this is the C major scale, 12 EDO

                                                                                          e.g. C:LLsLLL:3:1 <- this is the Gorgo 6 note scale, 16 EDO

                                                                                          An EDO scale, e.g. C:LLsLLLs:2:1, consists of a root note (e.g. C) followed by semicolon (':') and then a Large/small step notation sequence (e.g. LLsLLLs) followed by semicolon, then the large step size (e.g. 2) followed by semicolon, then the small step size (e.g. 1).

                                                                                          The number of divisions of the octave is calculated as the sum of the steps in the EDO scale definition.

                                                                                          e.g. C:LLsLLLs:2:1 is 2+2+1+2+2+2+1 = 12 EDO, 7 note scale

                                                                                          e.g. C:LLsLLL:3:1 is 3+3+1+3+3+3 = 16 EDO, 6 note scale

                                                                                          The root note defaults to octave 3, if no octave number is given.

                                                                                          • scale (string): Definition of EDO scale.
                                                                                          n("0 2 4 6 4 2").edoScale("C:LLsLLLs:2:1")
                                                                                          n("[0,7] 4 [2,7] 4")
                                                                                          .edoScale("G2:<LLsLLL LLLLsL>:3:1")
                                                                                          .s("piano")._pitchwheel()
                                                                                          n(rand.range(0,5).segment(6))
                                                                                          .edoScale("<G2 C3>:LLsLL:3:1")
                                                                                          .s("piano")._pitchwheel()

                                                                                          end

                                                                                          The same as .begin, but cuts off the end off each sample.

                                                                                          • length (number|Pattern): 1 = whole sample, .5 = half sample, .25 = quarter sample etc..
                                                                                          s("bd*2,oh*4").end("<.1 .2 .5 1>").fast(2)

                                                                                          env

                                                                                          Configures an envelope. Can be called in sequence like pat.env(...).env(...) to set up multiple envelopes There are two ways to declare which control will be modulated:

                                                                                          1. Explicitly put control in the config (e.g. env({ c: "lpf" }))
                                                                                          2. If the control parameter is absent, the control immediately before the env call will be used (e.g. s("saw").lpf(500).env({ a: 1 }) to modulate lpf)

                                                                                          Modulators can be referred to by id so that they can be updated later e.g. inside a sometimes. See example below.

                                                                                          • config (object): Envelope configuration.
                                                                                          • config.control (string|Pattern): Node to modulate. Aliases: c
                                                                                          • config.subControl (string|Pattern): Sub-control name to append to the control key. Aliases: sc
                                                                                          • config.depth (number|Pattern): Relative modulation depth. Aliases: dep, dr
                                                                                          • config.depthabs (number|Pattern): Absolute modulation depth. Aliases: da
                                                                                          • config.attack (number|Pattern): Time to reach depth. Aliases: att, a
                                                                                          • config.decay (number|Pattern): Time to reach sustain. Aliases: dec, d
                                                                                          • config.sustain (number|Pattern): Sustain depth. Aliases: sus, s
                                                                                          • config.release (number|Pattern): Time to return to nominal value. Aliases: rel, r
                                                                                          • config.acurve (number|Pattern): Snappiness of attack curve (-1 = relaxed, 1 = snappy). Aliases: ac
                                                                                          • config.dcurve (number|Pattern): Snappiness of decay curve (-1 = relaxed, 1 = snappy). Aliases: dc
                                                                                          • config.rcurve (number|Pattern): Snappiness of release curve (-1 = relaxed, 1 = snappy). Aliases: rc
                                                                                          • config.fxi (number|Pattern): FX index to target
                                                                                          • id (string|Pattern): ID to use for this modulator
                                                                                          s("saw").note("F1").lpf(500).env({ a: 1 })
                                                                                          s("saw").env({ d: 1 }).note("F1")
                                                                                            .lpq(4).lpf(50)
                                                                                            .env({ a: 0.1, d: 1, ac: 0.8, dc: 0.3, depth: 50 })
                                                                                          s("saw").lpf(500).diode(0.3)
                                                                                            .env({ c: "lpf", a: 0.5, d: 0.5 })
                                                                                          s("pulse").lpf(500).env({ a: 1 })
                                                                                            .env({ c: "s", a: 1 })
                                                                                            .diode(0.3)
                                                                                            .sometimes(x => x.env({ a: "0.5" }, 1)) // envelope #1 (0-indexed)
                                                                                          s("pulse").lpf(500).env({ a: 1 }, 'lpf_mod')
                                                                                            .env({ c: "s", a: 1 })
                                                                                            .diode(0.3)
                                                                                            .sometimes(x => x.env({ a: "0.5" }, 'lpf_mod'))

                                                                                          eq

                                                                                          performs a == b

                                                                                          • a (any):
                                                                                          • b (any):

                                                                                          eqt

                                                                                          performs a === b (strictly equal)

                                                                                          • a (any):
                                                                                          • b (any):

                                                                                          euclid

                                                                                          Changes the structure of the pattern to form an Euclidean rhythm. Euclidean rhythms are rhythms obtained using the greatest common divisor of two numbers. They were described in 2004 by Godfried Toussaint, a Canadian computer scientist. Euclidean rhythms are really useful for computer/algorithmic music because they can describe a large number of rhythms with a couple of numbers.

                                                                                          A negative number of pulses inverts the pattern so pulses happen in the gaps of the normal euclidean rhythm.

                                                                                          A negative number of steps changes it into euclidLegato.

                                                                                          • pulses (number): the number of onsets/beats
                                                                                          • steps (number): the number of steps to fill
                                                                                          // The Cuban tresillo pattern.
                                                                                          note("c3").euclid(3,8)

                                                                                          euclidish

                                                                                          Synonyms: eish

                                                                                          A 'euclid' variant with an additional parameter that morphs the resulting rhythm from 0 (no morphing) to 1 (completely 'even'). For example sound("bd").euclidish(3,8,0) would be the same as sound("bd").euclid(3,8), and sound("bd").euclidish(3,8,1) would be the same as sound("bd bd bd"). sound("bd").euclidish(3,8,0.5) would have a groove somewhere between. Inspired by the work of Malcom Braff.

                                                                                          • pulses (number): the number of onsets
                                                                                          • steps (number): the number of steps to fill
                                                                                          • groove (number): exists between the extremes of 0 (straight euclidian) and 1 (straight pulse)
                                                                                          sound("hh").euclidish(7,12,sine.slow(8))
                                                                                          .pan(sine.slow(8))

                                                                                          euclidLegato

                                                                                          Similar to euclid, but each pulse is held until the next pulse, so there will be no gaps.

                                                                                          A negative number of steps changes it into euclid.

                                                                                          • pulses (number): the number of onsets/beats
                                                                                          • steps (number): the number of steps to fill
                                                                                          • rotation (): offset in steps
                                                                                          • pat ():
                                                                                          note("c3").euclidLegato(3,8)

                                                                                          euclidLegatoRot

                                                                                          Similar to euclid, but each pulse is held until the next pulse, so there will be no gaps, and has an additional parameter for 'rotating' the resulting sequence.

                                                                                          A negative number of steps changes it into euclidRot.

                                                                                          • pulses (number): the number of onsets/beats
                                                                                          • steps (number): the number of steps to fill
                                                                                          • rotation (number): offset in steps
                                                                                          note("c3").euclidLegatoRot(3,5,2)

                                                                                          euclidRot

                                                                                          Like euclid, but has an additional parameter for 'rotating' the resulting sequence.

                                                                                          • pulses (number): the number of onsets/beats
                                                                                          • steps (number): the number of steps to fill
                                                                                          • rotation (number): offset in steps
                                                                                          // A Samba rhythm necklace from Brazil
                                                                                          note("c3").euclidRot(3,16,14)

                                                                                          every

                                                                                          An alias for firstOf

                                                                                          • n (number): how many cycles
                                                                                          • func (function): function to apply
                                                                                          note("c3 d3 e3 g3").every(4, x=>x.rev())

                                                                                          expand

                                                                                          Experimental

                                                                                          Expands the step size of the pattern by the given factor.

                                                                                            sound("tha dhi thom nam").bank("mridangam").expand("3 2 1 1 2 3").pace(8)

                                                                                            extend

                                                                                            Experimental

                                                                                            extend is similar to fast in that it increases its density, but it also increases the step count accordingly. So stepcat("a b".extend(2), "c d") would be the same as "a b a b c d", whereas stepcat("a b".fast(2), "c d") would be the same as "[a b] [a b] c d".

                                                                                              stepcat(
                                                                                                sound("bd bd - <cp hh>").extend(2),
                                                                                                sound("bd - sd -")
                                                                                              ).pace(8)

                                                                                              fanchor

                                                                                              controls the center of the filter envelope. 0 is unipolar positive, .5 is bipolar, 1 is unipolar negative

                                                                                              • center (number|Pattern): 0 to 1
                                                                                              note("{f g g c d a a#}%8").s("sawtooth").lpf("{1000}%2")
                                                                                              .lpenv(8).fanchor("<0 .5 1>")

                                                                                              fast

                                                                                              Synonyms: density

                                                                                              Speed up a pattern by the given factor. Used by "*" in mini notation.

                                                                                              • factor (number|Pattern): speed up factor
                                                                                              s("bd hh sd hh").fast(2) // s("[bd hh sd hh]*2")

                                                                                              fastChunk

                                                                                              Synonyms: fastchunk

                                                                                              Like chunk, but the cycles of the source pattern aren't repeated for each set of chunks.

                                                                                                "<0 8> 1 2 3 4 5 6 7"
                                                                                                .scale("C2:major").note()
                                                                                                .fastChunk(4, x => x.color('red')).slow(2)

                                                                                                fastGap

                                                                                                Synonyms: fastgap

                                                                                                speeds up a pattern like fast, but rather than it playing multiple times as fast would it instead leaves a gap in the remaining space of the cycle. For example, the following will play the sound pattern "bd sn" only once but compressed into the first half of the cycle, i.e. twice as fast.

                                                                                                  s("bd sd").fastGap(2)

                                                                                                  filter

                                                                                                  Filters haps using the given function

                                                                                                  • test (function): function to test Hap
                                                                                                  s("hh!7 oh").filter(hap => hap.value.s === 'hh')

                                                                                                  filterHaps

                                                                                                  Returns a new Pattern, which only returns haps that meet the given test.

                                                                                                  • hap_test (function): a function which returns false for haps to be removed from the pattern
                                                                                                  s("bd*8").velocity(rand).filterHaps((h) => (h.whole.begin % 1) < h.value.velocity)

                                                                                                  filterValues

                                                                                                  As with filterHaps, but the function is applied to values inside haps.

                                                                                                  • value_test (function):
                                                                                                  const drums = s("bd sd bd sd")
                                                                                                  kick: drums.filterValues((v) => v.s === 'bd').duck(2)
                                                                                                  snare: drums.filterValues((v) => v.s === 'sd')
                                                                                                  bass: s("saw!4").note("G#1").lpf(80).lpenv(4).orbit(2)

                                                                                                  filterWhen

                                                                                                  Filters haps by their begin time

                                                                                                  • test (function): function to test Hap.whole.begin
                                                                                                  oneCycle: s("bd*4").filterWhen((t) => t < 1)

                                                                                                  findPeaks

                                                                                                  Find peaks in spectrum magnitudes

                                                                                                    firstCycle

                                                                                                    Queries the pattern for the first cycle, returning Haps. Mainly of use when debugging a pattern.

                                                                                                    • with_context (boolean): set to true, otherwise the context field will be stripped from the resulting haps.

                                                                                                    firstCycleValues

                                                                                                    Accessor for a list of values returned by querying the first cycle.

                                                                                                      firstOf

                                                                                                      Applies the given function every n cycles, starting from the first cycle.

                                                                                                      • n (number): how many cycles
                                                                                                      • func (function): function to apply
                                                                                                      note("c3 d3 e3 g3").firstOf(4, x=>x.rev())

                                                                                                      fit

                                                                                                      Makes the sample fit its event duration. Good for rhythmical loops like drum breaks. Similar to loopAt.

                                                                                                        samples({ rhodes: 'https://cdn.freesound.org/previews/132/132051_316502-lq.mp3' })
                                                                                                        s("rhodes/2").fit()

                                                                                                        floor

                                                                                                        Assumes a numerical pattern. Returns a new pattern with all values set to their mathematical floor. E.g. 3.7 replaced with to 3, and -4.2 replaced with -5.

                                                                                                          note("42 42.1 42.5 43".floor())

                                                                                                          fm

                                                                                                          Synonyms: fmi

                                                                                                          Sets the Frequency Modulation of the synth. Controls the modulation index, which defines the brightness of the sound.

                                                                                                          A number may be added afterwards to control the modulation index of any of the 8 individual FMs (e.g. fm3). Also, FMs may be routed into each other with matrix commands like fm13, which would send fm1 back into fm3

                                                                                                          • brightness (number|Pattern): modulation index
                                                                                                          note("c e g b g e")
                                                                                                          .fm("<0 1 2 8 32>")
                                                                                                          ._scope()
                                                                                                          s("sine").note("F1").seg(8)
                                                                                                           .fm(4).fm2(rand.mul(4)).fm3(saw.mul(8).slow(8))
                                                                                                           .fmh(1.06).fmh2(10).fmh3(0.1)

                                                                                                          fmattack

                                                                                                          Synonyms: fmatt

                                                                                                          Attack time for the FM envelope: time it takes to reach maximum modulation

                                                                                                          A number may be added afterwards to control the attack of the envelope of any of the 8 individual FMs (e.g. fmatt5)

                                                                                                          • time (number|Pattern): attack time
                                                                                                          note("c e g b g e")
                                                                                                          .fm(4)
                                                                                                          .fmattack("<0 .05 .1 .2>")
                                                                                                          ._scope()

                                                                                                          fmdecay

                                                                                                          Synonyms: fmdec

                                                                                                          Decay time for the FM envelope: seconds until the sustain level is reached after the attack phase.

                                                                                                          A number may be added afterwards to control the decay of the envelope of any of the 8 individual FMs (e.g. fmdec6)

                                                                                                          • time (number|Pattern): decay time
                                                                                                          note("c e g b g e")
                                                                                                          .fm(4)
                                                                                                          .fmdecay("<.01 .05 .1 .2>")
                                                                                                          .fmsustain(.4)
                                                                                                          ._scope()

                                                                                                          fmenv

                                                                                                          Synonyms: fme

                                                                                                          Ramp type of fm envelope. Exp might be a bit broken..

                                                                                                          A number may be added afterwards to control the envelope of any of the 8 individual FMs (e.g. fmenv4)

                                                                                                          • type (number|Pattern): lin | exp
                                                                                                          note("c e g b g e")
                                                                                                          .fm(4)
                                                                                                          .fmdecay(.2)
                                                                                                          .fmsustain(0)
                                                                                                          .fmenv("<exp lin>")
                                                                                                          ._scope()

                                                                                                          fmh

                                                                                                          Sets the Frequency Modulation Harmonicity Ratio. Controls the timbre of the sound. Whole numbers and simple ratios sound more natural, while decimal numbers and complex ratios sound metallic.

                                                                                                          A number may be added afterwards to control the harmonicity of any of the 8 individual FMs (e.g. fmh2)

                                                                                                          • harmonicity (number|Pattern):
                                                                                                          note("c e g b g e")
                                                                                                          .fm(4)
                                                                                                          .fmh("<1 2 1.5 1.61>")
                                                                                                          ._scope()

                                                                                                          fmrelease

                                                                                                          Synonyms: fmrel

                                                                                                          Release time for the FM envelope: how much modulation is applied after the note is released

                                                                                                          A number may be added afterwards to control the release of the envelope of any of the 8 individual FMs (e.g. fmrel8)

                                                                                                          • time (number|Pattern): release time

                                                                                                          fmsustain

                                                                                                          Synonyms: fmsus

                                                                                                          Sustain level for the FM envelope: how much modulation is applied after the decay phase

                                                                                                          A number may be added afterwards to control the sustain of the envelope of any of the 8 individual FMs (e.g. fmsus7)

                                                                                                          • level (number|Pattern): sustain level
                                                                                                          note("c e g b g e")
                                                                                                          .fm(4)
                                                                                                          .fmdecay(.1)
                                                                                                          .fmsustain("<1 .75 .5 0>")
                                                                                                          ._scope()

                                                                                                          fmwave

                                                                                                          Waveform of the fm modulator

                                                                                                          A number may be added afterwards to control the waveform any of the 8 individual FMs (e.g. fmwave6)

                                                                                                          • wave (number|Pattern): waveform
                                                                                                          n("0 1 2 3".fast(4)).scale("d:minor").s("sine").fmwave("<sine square sawtooth crackle>").fm(4).fmh(2.01)
                                                                                                          n("0 1 2 3".fast(4)).chord("<Dm Am F G>").voicing().s("sawtooth").fmwave("brown").fm(.6)

                                                                                                          focus

                                                                                                          Similar to compress, but doesn't leave gaps, and the 'focus' can be bigger than a cycle

                                                                                                            s("bd hh sd hh").focus(1/4, 3/4)

                                                                                                            fold

                                                                                                            Wavefolding distortion

                                                                                                            • distortion (number|Pattern): amount of distortion to apply
                                                                                                            • volume (number|Pattern): linear postgain of the distortion

                                                                                                            freq

                                                                                                            Set frequency of sound.

                                                                                                            • frequency (number|Pattern): in Hz. the audible range is between 20 and 20000 Hz
                                                                                                            freq("220 110 440 110").s("superzow").osc()
                                                                                                            freq("110".mul.out(".5 1.5 .6 [2 3]")).s("superzow").osc()

                                                                                                            fromBipolar

                                                                                                            Assumes a numerical pattern, containing bipolar values in the range -1 .. 1 Returns a new pattern with values scaled to the unipolar range 0 .. 1

                                                                                                              fscope

                                                                                                              Renders an oscilloscope for the frequency domain of the audio signal.

                                                                                                              • config (object): object that may have the following arguments
                                                                                                              • config.color (string): line color as hex or color name. defaults to white.
                                                                                                              • config.scale (number): scales the y-axis. Defaults to 0.25
                                                                                                              • config.pos (number): y-position relative to screen height. 0 = top, 1 = bottom of screen
                                                                                                              • config.lean (number): y-axis alignment where 0 = top and 1 = bottom
                                                                                                              • config.min (number): min value
                                                                                                              • config.max (number): max value
                                                                                                              s("sawtooth").fscope()

                                                                                                              ftranspose

                                                                                                              Synonyms: ftrans, fTrans, ftranspose, fTranspose

                                                                                                              Frequency transpose. Assumes pattern either has freq set, or has values that can be interpreted as frequencies amt has optional edoSize param, defaults to 12. If haps have edoSize param set, such as from the output of xen("31edo"), ftrans will fallback to that instead of 12 as the default.

                                                                                                              Transposes the frequency by amt edoSteps

                                                                                                              • amt (number):
                                                                                                              • edoSize (number): (optional)
                                                                                                              i("0 1 2").xen("12edo").ftrans("7")
                                                                                                              // n("0 1 2").scale("A:chromatic").trans("7")
                                                                                                              i("0 8 18").xen("31edo").ftrans("<8 -8>")
                                                                                                              // to transpose by steps of an edo, use "step:edo" :
                                                                                                              i("0 7 8 18").xen("31edo").ftrans("<0 1:31 1:12>")
                                                                                                              // it can also work with frequency values directly
                                                                                                              freq("200 300 400").ftrans("<0 7:31 7>")

                                                                                                              ftype

                                                                                                              Sets the filter type. The ladder filter is more aggressive. More types might be added in the future.

                                                                                                              • type (number|Pattern): 12db (0), ladder (1), or 24db (2)
                                                                                                              note("{f g g c d a a#}%8").s("sawtooth").lpenv(4).lpf(500).ftype("<0 1 2>").lpq(1)
                                                                                                              note("c f g g a c d4").fast(2)
                                                                                                              .sound('sawtooth')
                                                                                                              .lpf(200).fanchor(0)
                                                                                                              .lpenv(3).lpq(1)
                                                                                                              .ftype("<ladder 12db 24db>")

                                                                                                              FX

                                                                                                              Establishes an FX chain. Can be called by chaining .FX(fx1).FX(fx2).. calls and/or in a single .FX(fx1, fx2, ..) call. The fx1, .. are patterns which establish the controls of the given effect. See examples.

                                                                                                              • effects (any):
                                                                                                              $: s("[sbd <hh [bd | lt | oh]>]*4").dec(.4)
                                                                                                                .FX(
                                                                                                                  phaser(0.5).gain(2),
                                                                                                                  bpf(800),
                                                                                                                  distort(1.3),
                                                                                                                  room(0.2),
                                                                                                                  delay(0.5).gain(1.25),
                                                                                                                  distort(0.3),
                                                                                                                ).fxr(1.7) // sets release time of effects (like delay)
                                                                                                              $: s("saw").fm(0.5)
                                                                                                                .delay(0.3) // outer effects are applied *last*
                                                                                                                .FX(coarse(4)) // first coarse
                                                                                                                .FX(lpf(500).lpe(4).lpa(1).lpd(2)) // then lpf
                                                                                                                .FX(distort(1)) // then distort

                                                                                                              gain

                                                                                                              Controls the gain by an exponential amount.

                                                                                                              • amount (number|Pattern): gain.
                                                                                                              s("hh*8").gain(".4!2 1 .4!2 1 .4 1").fast(2)

                                                                                                              gap

                                                                                                              Does absolutely nothing, but with a given metrical 'steps'

                                                                                                              • steps (number):
                                                                                                              gap(3) // "~@3"

                                                                                                              generateGraph

                                                                                                              Creates a canvas element showing a graph of the given data.

                                                                                                              • data (Float32Array): An array of numbers, or a Float32Array.
                                                                                                              • width (number): Width in pixels of the canvas.
                                                                                                              • height (number): Height in pixels of the canvas.
                                                                                                              • min (number): Minimum value of data for the graph (lower edge).
                                                                                                              • max (number): Maximum value of data in the graph (upper edge).

                                                                                                              generateReverb

                                                                                                              Generates a reverb impulse response.

                                                                                                              • params (Object): TODO: Document the properties.
                                                                                                              • callback (function): Function to call when the impulse response has been generated. The impulse response is passed to this function as its parameter. May be called immediately within the current execution context, or later.

                                                                                                              getClockTime

                                                                                                              Get the current clock time in seconds (onSchedule time)

                                                                                                                getCps

                                                                                                                Get the current cycles per second

                                                                                                                  getDevice

                                                                                                                  Look up a device by index or name. Otherwise return a default device, or fail if none are connected.

                                                                                                                  • indexOrName (string|number):
                                                                                                                  • devices (Array.<Input>|Array.<Output>):

                                                                                                                  getDuration

                                                                                                                  Synonyms: getDur

                                                                                                                  Returns the duration, in seconds, of the given sample. Has optional param n (for instance, the 2 in s("casio:2"))

                                                                                                                  Note: must be called with await, otherwise you'll get a pending Promise object.

                                                                                                                  • s (string): sampleName
                                                                                                                  • n (number):
                                                                                                                  // Set a patterns cycle length to exactly the length of the sample
                                                                                                                  samples('github:tidalcycles/dirt-samples')
                                                                                                                  let k = await getDuration('sax')
                                                                                                                  s("sax").cps(1/k)

                                                                                                                  getFrequency

                                                                                                                  Synonyms: getFreq

                                                                                                                  Given a hap, returns the frequency of the note or freq, if defined

                                                                                                                  Given a note, returns the frequency of that note getFreq('c3')

                                                                                                                  Given a midi note number, returns the frequency of that midi note getFreq('c3')

                                                                                                                  • hap (Hap|note|number): input
                                                                                                                  i("4 8 9 10 - - 5 7 9 11 - -").tune("tranh3")
                                                                                                                  .mul(getFreq('c3'))
                                                                                                                  .freq().clip(.5).room(1)

                                                                                                                  getMidiDeviceNamesString

                                                                                                                  Get a string listing device names for error messages.

                                                                                                                  • devices (Array.<Input>|Array.<Output>):

                                                                                                                  getTime

                                                                                                                  Get the current cycle time as a number

                                                                                                                    gravityX

                                                                                                                    Synonyms: gravX

                                                                                                                    The device's gravity x-axis value ranges from 0 to 1.

                                                                                                                      n(gravityX.segment(4).range(0,7)).scale("C:minor")

                                                                                                                      gravityY

                                                                                                                      Synonyms: gravY

                                                                                                                      The device's gravity y-axis value ranges from 0 to 1.

                                                                                                                        n(gravityY.segment(4).range(0,7)).scale("C:minor")

                                                                                                                        gravityZ

                                                                                                                        Synonyms: gravZ

                                                                                                                        The device's gravity z-axis value ranges from 0 to 1.

                                                                                                                          n(gravityZ.segment(4).range(0,7)).scale("C:minor")

                                                                                                                          grow

                                                                                                                          Experimental

                                                                                                                          Progressively grows the pattern by 'n' steps until the full pattern is played, or if a second value is given (using mininotation list syntax with :), that number of times. A positive number will progressively grow steps from the start of a pattern, and a negative number from the end.

                                                                                                                            "tha dhi thom nam".grow("1").sound()
                                                                                                                            .bank("mridangam")
                                                                                                                            "tha dhi thom nam".grow("-1").sound()
                                                                                                                            .bank("mridangam")
                                                                                                                            "tha dhi thom nam".grow("1 -1").sound().bank("mridangam").pace(4)
                                                                                                                            note("0 1 2 3 4 5 6 7".scale("C:ritusen")).sound("folkharp")
                                                                                                                            .grow("1 -1").pace(8)

                                                                                                                            gt

                                                                                                                            performs a > b

                                                                                                                            • a (any):
                                                                                                                            • b (any):

                                                                                                                            gte

                                                                                                                            performs a >= b

                                                                                                                            • a (any):
                                                                                                                            • b (any):

                                                                                                                            handleOutputBuffersToRetrieve

                                                                                                                            Add contents of output buffers just processed to output buffers

                                                                                                                              hard

                                                                                                                              Hard-clipping distortion

                                                                                                                              • distortion (number|Pattern): amount of distortion to apply
                                                                                                                              • volume (number|Pattern): linear postgain of the distortion

                                                                                                                              hpattack

                                                                                                                              Synonyms: hpa

                                                                                                                              Sets the attack duration for the highpass filter envelope.

                                                                                                                              • attack (number|Pattern): time of the highpass filter envelope
                                                                                                                              note("c2 e2 f2 g2")
                                                                                                                              .sound('sawtooth')
                                                                                                                              .hpf(500)
                                                                                                                              .hpa("<.5 .25 .1 .01>/4")
                                                                                                                              .hpenv(4)

                                                                                                                              hpdc

                                                                                                                              DC offset of the LFO for the highpass filter

                                                                                                                              • dcoffset (number|Pattern): dc offset. set to 0 for unipolar

                                                                                                                              hpdecay

                                                                                                                              Synonyms: hpd

                                                                                                                              Sets the decay duration for the highpass filter envelope.

                                                                                                                              • decay (number|Pattern): time of the highpass filter envelope
                                                                                                                              note("c2 e2 f2 g2")
                                                                                                                              .sound('sawtooth')
                                                                                                                              .hpf(500)
                                                                                                                              .hpd("<.5 .25 .1 0>/4")
                                                                                                                              .hps(0.2)
                                                                                                                              .hpenv(4)

                                                                                                                              hpdepth

                                                                                                                              Depth of the LFO for the highpass filter

                                                                                                                              • depth (number|Pattern): depth of modulation

                                                                                                                              hpdepthfrequency

                                                                                                                              Synonyms: hpdepthfreq

                                                                                                                              Depth of the LFO for the hipass filter, in hz

                                                                                                                              • depth (number|Pattern): depth of modulation
                                                                                                                              note("<c c c# c c c4>*16").s("sawtooth").lpf(600).hpdepthfrequency("<200 500 100 0>")

                                                                                                                              hpenv

                                                                                                                              Synonyms: hpe

                                                                                                                              Sets the highpass filter envelope modulation depth.

                                                                                                                              • modulation (number|Pattern): depth of the highpass filter envelope between 0 and n
                                                                                                                              note("c2 e2 f2 g2")
                                                                                                                              .sound('sawtooth')
                                                                                                                              .hpf(500)
                                                                                                                              .hpa(.5)
                                                                                                                              .hpenv("<4 2 1 0 -1 -2 -4>/4")

                                                                                                                              hpf

                                                                                                                              Synonyms: hp, hcutoff

                                                                                                                              Applies the cutoff frequency of the high-pass filter.

                                                                                                                              When using mininotation, you can also optionally add the 'hpq' parameter, separated by ':'.

                                                                                                                              • frequency (number|Pattern): audible between 0 and 20000
                                                                                                                              s("bd sd [~ bd] sd,hh*8").hpf("<4000 2000 1000 500 200 100>")
                                                                                                                              s("bd sd [~ bd] sd,hh*8").hpf("<2000 2000:25>")

                                                                                                                              hpq

                                                                                                                              Synonyms: hresonance

                                                                                                                              Controls the high-pass q-value.

                                                                                                                              • q (number|Pattern): resonance factor between 0 and 50
                                                                                                                              s("bd sd [~ bd] sd,hh*8").hpf(2000).hpq("<0 10 20 30>")

                                                                                                                              hprate

                                                                                                                              Rate of the LFO for the highpass filter

                                                                                                                              • rate (number|Pattern): rate in hertz

                                                                                                                              hprelease

                                                                                                                              Synonyms: hpr

                                                                                                                              Sets the release time for the highpass filter envelope.

                                                                                                                              • release (number|Pattern): time of the highpass filter envelope
                                                                                                                              note("c2 e2 f2 g2")
                                                                                                                              .sound('sawtooth')
                                                                                                                              .clip(.5)
                                                                                                                              .hpf(500)
                                                                                                                              .hpenv(4)
                                                                                                                              .hpr("<.5 .25 .1 0>/4")
                                                                                                                              .release(.5)

                                                                                                                              hpshape

                                                                                                                              Shape of the LFO for the highpass filter

                                                                                                                              • shape (number|Pattern): Shape of the lfo (0, 1, 2, ..)

                                                                                                                              hpskew

                                                                                                                              Skew of the LFO for the highpass filter

                                                                                                                              • skew (number|Pattern): How much to bend the LFO shape

                                                                                                                              hpsustain

                                                                                                                              Synonyms: hps

                                                                                                                              Sets the sustain amplitude for the highpass filter envelope.

                                                                                                                              • sustain (number|Pattern): amplitude of the highpass filter envelope
                                                                                                                              note("c2 e2 f2 g2")
                                                                                                                              .sound('sawtooth')
                                                                                                                              .hpf(500)
                                                                                                                              .hpd(.5)
                                                                                                                              .hps("<0 .25 .5 1>/4")
                                                                                                                              .hpenv(4)

                                                                                                                              hpsync

                                                                                                                              Cycle-synced rate of the LFO for the highpass filter

                                                                                                                              • rate (number|Pattern): rate in cycles

                                                                                                                              hsl

                                                                                                                              Sets the pattern's color to the given hsl

                                                                                                                              • hue (number): (0 - 360)
                                                                                                                              • saturation (number): percentage (0 - 100)
                                                                                                                              • lightness (number): percentage (0 - 100)

                                                                                                                              hsla

                                                                                                                              Sets the pattern's color to the given hsla

                                                                                                                              • hue (number): (0 - 360)
                                                                                                                              • saturation (number): percentage (0 - 100)
                                                                                                                              • lightness (number): percentage (0 - 100)
                                                                                                                              • alpha (number): (transparency) (0.0 - 1.0)

                                                                                                                              hurry

                                                                                                                              Both speeds up the pattern (like 'fast') and the sample playback (like 'speed').

                                                                                                                                s("bd sd:2").hurry("<1 2 4 3>").slow(1.5)

                                                                                                                                hush

                                                                                                                                Silences a pattern.

                                                                                                                                  stack(
                                                                                                                                    s("bd").hush(),
                                                                                                                                    s("hh*3")
                                                                                                                                  )

                                                                                                                                  i

                                                                                                                                  Selects the given degree. Currently used in xen and tune:

                                                                                                                                  • value (number|Pattern):
                                                                                                                                  i("0 1 2 3 4 5 6 7").xen("<5edo 10edo 15edo hexany15>")

                                                                                                                                  inhabit

                                                                                                                                  Synonyms: pickSqueeze

                                                                                                                                  Picks patterns (or plain values) either from a list (by index) or a lookup table (by name). Similar to pick, but cycles are squeezed into the target ('inhabited') pattern.

                                                                                                                                  • pat (Pattern):
                                                                                                                                  • xs (*):
                                                                                                                                  let a = s("bd(3,8)")
                                                                                                                                  let b = s("cp sd")
                                                                                                                                  "<a b [a,b]>".inhabit({ a, b })
                                                                                                                                  s("a@2 [a b] a"
                                                                                                                                  .inhabit({a: "bd(3,8)", b: "sd sd"}))
                                                                                                                                  .slow(4)

                                                                                                                                  inhabitmod

                                                                                                                                  Synonyms: pickmodSqueeze

                                                                                                                                  The same as inhabit, but if you pick a number greater than the size of the list, it wraps around, rather than sticking at the maximum value. For example, if you pick the fifth pattern of a list of three, you'll get the second one.

                                                                                                                                  • pat (Pattern):
                                                                                                                                  • xs (*):

                                                                                                                                  initDough

                                                                                                                                  initializes dough ahead of time. you don't need to use this, but if you do, you can await it, so dough is ready before the pattern starts.

                                                                                                                                    await initDough()
                                                                                                                                    $: chord("<Dm9 Dm11 Dm7>").offset("<-1 0 1 0>").voicing()
                                                                                                                                    .phaser(3).fm(1.4).fmh(1.01)
                                                                                                                                    .dough()

                                                                                                                                    inside

                                                                                                                                    Carries out an operation 'inside' a cycle.

                                                                                                                                      "0 1 2 3 4 3 2 1".inside(4, rev).scale('C major').note()
                                                                                                                                      // "0 1 2 3 4 3 2 1".slow(4).rev().fast(4).scale('C major').note()

                                                                                                                                      into

                                                                                                                                      Breaks a pattern into pieces according to the structure of a given pattern. True values in the given pattern cause the corresponding subcycle of the source pattern to be looped, and for an (optional) given function to be applied. False values result in the corresponding part of the source pattern to be played unchanged.

                                                                                                                                      • pieces (Pattern):
                                                                                                                                      • func (Pattern):
                                                                                                                                      sound("bd sd ht lt").into("1 0", hurry(2))

                                                                                                                                      invert

                                                                                                                                      Synonyms: inv

                                                                                                                                      Swaps 1s and 0s in a binary pattern.

                                                                                                                                        s("bd").struct("1 0 0 1 0 0 1 0".lastOf(4, invert))

                                                                                                                                        irand

                                                                                                                                        A continuous pattern of random integers, between 0 and n-1.

                                                                                                                                        • ipat (number): max value (exclusive)
                                                                                                                                        // randomly select scale notes from 0 - 7 (= C to C)
                                                                                                                                        n(irand(8)).struct("x x*2 x x*3").scale("C:minor")

                                                                                                                                        irbegin

                                                                                                                                        Synonyms: ir

                                                                                                                                        Sets the beginning of the IR response sample

                                                                                                                                        • begin (string|Pattern): between 0 and 1
                                                                                                                                        samples('github:switchangel/pad')
                                                                                                                                        $: s("brk/2").fit().scrub(irand(16).div(16).seg(8)).ir("swpad:4").room(.65).irspeed("-2").irbegin("<0 .5 .75>/2").roomsize(.6)

                                                                                                                                        iresponse

                                                                                                                                        Synonyms: ir

                                                                                                                                        Sets the sample to use as an impulse response for the reverb.

                                                                                                                                        • sample (string|Pattern): to use as an impulse response
                                                                                                                                        s("bd sd [~ bd] sd").room(.8).ir("<shaker_large:0 shaker_large:2>")

                                                                                                                                        irspeed

                                                                                                                                        Sets speed of the sample for the impulse response.

                                                                                                                                        • speed (string|Pattern):
                                                                                                                                        samples('github:switchangel/pad')
                                                                                                                                        $: s("brk/2").fit().scrub(irand(16).div(16).seg(8)).ir("swpad:4").room(.2).irspeed("<2 1 .5>/2").irbegin(.5).roomsize(.5)

                                                                                                                                        isaw

                                                                                                                                        A sawtooth signal between 1 and 0 (like saw, but flipped).

                                                                                                                                          note("<c3 [eb3,g3] g2 [g3,bb3]>*8")
                                                                                                                                          .clip(isaw.slow(2))
                                                                                                                                          n(isaw.range(0,8).segment(8))
                                                                                                                                          .scale('C major')

                                                                                                                                          isaw2

                                                                                                                                          A sawtooth signal between 1 and -1 (like saw2, but flipped).

                                                                                                                                            isobite

                                                                                                                                            Synonyms: cycleStruct, cyclestruct

                                                                                                                                            Similar to struct, but every hap in the structure pattern plays the next cycle of the main pattern. With a different number of cycles in the main pattern and haps in the structure pattern, this creates an isorhythm.

                                                                                                                                            Note: This function works on the assumption that the structure pattern repeats every cycle. If the structure pattern only repeats after multiple cycles, it may skip or repeat certain parts of the melody.

                                                                                                                                            • structure (Pattern): structure of the pattern
                                                                                                                                            "<0 1 2 3 4 5>".isobite("[x - x*2]*2").n().scale("c:major")
                                                                                                                                            // the same as "0 - [1 2] 3 - [4 5]".n().scale("c:major")
                                                                                                                                            "<0 1 2 3 4>".isobite("x - x").n().scale("c:major")
                                                                                                                                            // the same as "<[0 - 1] [2 - 3] [4 - 0] [1 - 2] [3 - 4]>".n().scale("c:major")
                                                                                                                                            // Here the structure pattern repeats after 2 cycles,
                                                                                                                                            // so certain haps from the melody are skipped.
                                                                                                                                            "<0 1 2 3>".isobite("x x*2".slow(2)).n().scale("c:major")
                                                                                                                                            // the same as "<[0] [2 3] [2] [2 3]>".n().scale("c:major")
                                                                                                                                            // This can be avoided by making the struct pattern 1 cycle,
                                                                                                                                            // and slowing the whole pattern down as follows:
                                                                                                                                            "<0 1 2 3>".isobite("x x*2").slow(2).n().scale("c:major")
                                                                                                                                            // the same as "<[0] [1 2] [3] [0 1] [2] [3 0] [1] [2 3]>".n().scale("c:major")

                                                                                                                                            isquare

                                                                                                                                            A square signal between 1 and 0 (like square but flipped).

                                                                                                                                              isquare2

                                                                                                                                              A square signal between 1 and -1 (like isquare, but bipolar).

                                                                                                                                                iter

                                                                                                                                                Divides a pattern into a given number of subdivisions, plays the subdivisions in order, but increments the starting subdivision each cycle. The pattern wraps to the first subdivision after the last subdivision is played.

                                                                                                                                                  note("0 1 2 3".scale('A minor')).iter(4)

                                                                                                                                                  iterBack

                                                                                                                                                  Synonyms: iterback

                                                                                                                                                  Like iter, but plays the subdivisions in reverse order. Known as iter' in tidalcycles

                                                                                                                                                    note("0 1 2 3".scale('A minor')).iterBack(4)

                                                                                                                                                    itri

                                                                                                                                                    An inverted triangle signal between 1 and 0 (like tri, but flipped).

                                                                                                                                                      n(itri.segment(8).range(0,7)).scale("C:minor")

                                                                                                                                                      itri2

                                                                                                                                                      An inverted triangle signal between -1 and 1 (like itri, but bipolar).

                                                                                                                                                        jux

                                                                                                                                                        The jux function creates strange stereo effects, by applying a function to a pattern, but only in the right-hand channel.

                                                                                                                                                          s("bd lt [~ ht] mt cp ~ bd hh").jux(rev)
                                                                                                                                                          s("bd lt [~ ht] mt cp ~ bd hh").jux(press)
                                                                                                                                                          s("bd lt [~ ht] mt cp ~ bd hh").jux(iter(4))

                                                                                                                                                          juxBy

                                                                                                                                                          Synonyms: juxby

                                                                                                                                                          Jux with adjustable stereo width. 0 = mono, 1 = full stereo.

                                                                                                                                                            s("bd lt [~ ht] mt cp ~ bd hh").juxBy("<0 .5 1>/2", rev)

                                                                                                                                                            juxFlip

                                                                                                                                                            Synonyms: juxflip, flux

                                                                                                                                                            Like jux, but flips the ears each cycle.

                                                                                                                                                              s("bd lt [~ ht] mt cp ~ bd hh").juxFlip(rev)
                                                                                                                                                              s("bd lt [~ ht] mt cp ~ bd hh").juxFlip(press)
                                                                                                                                                              s("bd lt [~ ht] mt cp ~ bd hh").juxFlip(iter(4))

                                                                                                                                                              juxFlipBy

                                                                                                                                                              Synonyms: juxflipby, fluxBy, fluxby

                                                                                                                                                              Like juxBy, except it flips the ears each cycle.

                                                                                                                                                                s("bd lt [~ ht] mt cp ~ bd hh").juxFlipBy(".8", rev)

                                                                                                                                                                K

                                                                                                                                                                Produces a Kabelsalat modular sound engine. This can be used as either an effect (by including audioin() at the beginning of your kabel expression) or as a sound source (via any expression which doesn't start with audioin()).

                                                                                                                                                                Some helpers you have available to you:

                                                                                                                                                                • Strudel mini notation works fine in K(..) via "" or ``
                                                                                                                                                                • More complex Strudel expressions (like "0 1 2".fast(4) or irand(24)) can be written by wrapping them in S(..) inside your Kabel code
                                                                                                                                                                • We expose Strudel's note frequency under sFreq and Strudel's gate information under sGate
                                                                                                                                                                • You can use more complex multi-line expressions (like let x = a; let y = b; x.lpf(y);) by wrapping them inside a function in K (see example).
                                                                                                                                                                • expr (KabelsalatExpression|function): Kabelsalat graph definition
                                                                                                                                                                note("A c e".fast(4)).transpose("<0 2 4 6 8>")
                                                                                                                                                                  .scale("F:minor").transpose("12")
                                                                                                                                                                  .s("saw")
                                                                                                                                                                  .K(
                                                                                                                                                                    // audioin().mul(sGate.adsr(0.001, 0.3, 0, 0.2)) // as effect
                                                                                                                                                                    saw(saw(sFreq / "2!3 16").mul(8).add(sFreq).lag("0!3 0.1")).mul(0.3) // as source
                                                                                                                                                                    .mul(sGate.adsr(0, 0.15, 0.5, "0.1!3 1"))
                                                                                                                                                                    .lpf(sGate.adsr(0, 0.2, 0.3, 0.2).mul(1).add(0))
                                                                                                                                                                    .add(x => x.delay(S("0.3 0.2".fast(2))).mul(0.7))
                                                                                                                                                                    .add(x => x.delay("0.03 [0.08 0.01] 0.01 0.013").mul(0.77)).mul(0.7)
                                                                                                                                                                    .add(x => x.delay(.13).mul(0.7))
                                                                                                                                                                    .out()
                                                                                                                                                                  )
                                                                                                                                                                n("<0 1 <2 3 2 4>>*16")
                                                                                                                                                                  .scale("G#2:minor").sometimes(x => x.transpose("12 | 24"))
                                                                                                                                                                  .K(() => {
                                                                                                                                                                    const att = S(rand.range(0, 0.05))
                                                                                                                                                                    const dec = S(rand.range(0.05, 0.2))
                                                                                                                                                                    let f = n(sFreq);
                                                                                                                                                                    const mod = sine(f).mul("0.1 | 0.2 | 0.3")
                                                                                                                                                                      .add("[[1.5 1] | 1 | 2 | 4 | [6 4@3]]*2")
                                                                                                                                                                    saw(f.mul(mod))
                                                                                                                                                                    .mul(sGate.ad(att, dec))
                                                                                                                                                                    .add(x => x.delay(0.4).mul(0.3))
                                                                                                                                                                    .out()
                                                                                                                                                                  }).fxr(1).room(0.3)

                                                                                                                                                                keep

                                                                                                                                                                When called on a pattern a, with a input pattern b (a.keep(b)), combines a and b such that anything defined in a, and anything defined in b that is not defined in a will be in the resulting pattern

                                                                                                                                                                The structure is maintained from a, because the default pattern alignment is in, see the section on Pattern Alignment in the technical manual in the docs

                                                                                                                                                                This is the inverse of set

                                                                                                                                                                See examples below

                                                                                                                                                                • a (Pattern):
                                                                                                                                                                // notes, already defined, will stay "c a f e",
                                                                                                                                                                // while "s", not defined, will be set to "piano"
                                                                                                                                                                note("c a f e").keep(note("e f a c").s("piano"))

                                                                                                                                                                keyDown

                                                                                                                                                                returns true when a key or array of keys is held Key name reference

                                                                                                                                                                  keyDown("Control:j").pick([s("bd(5,8)"), s("cp(3,8)")])

                                                                                                                                                                  label

                                                                                                                                                                  Sets the displayed text for an event on the pianoroll

                                                                                                                                                                  • label (string): text to display

                                                                                                                                                                  lastOf

                                                                                                                                                                  Applies the given function every n cycles, starting from the last cycle.

                                                                                                                                                                  • n (number): how many cycles
                                                                                                                                                                  • func (function): function to apply
                                                                                                                                                                  note("c3 d3 e3 g3").lastOf(4, x=>x.rev())

                                                                                                                                                                  late

                                                                                                                                                                  Nudge a pattern to start later in time. Equivalent of Tidal's ~> operator

                                                                                                                                                                  • cycles (number|Pattern): number of cycles to nudge right
                                                                                                                                                                  "bd ~".stack("hh ~".late(.1)).s()

                                                                                                                                                                  layer

                                                                                                                                                                  Layers the result of the given function(s). Like superimpose, but without the original pattern:

                                                                                                                                                                  • funcs (any):
                                                                                                                                                                  "<0 2 4 6 ~ 4 ~ 2 0!3 ~!5>*8"
                                                                                                                                                                    .layer(x=>x.add("0,2"))
                                                                                                                                                                    .scale('C minor').note()

                                                                                                                                                                  lfo

                                                                                                                                                                  Configures an LFO. Can be called in sequence like pat.lfo(...).lfo(...) to set up multiple LFOs. There are two ways to declare which control will be modulated:

                                                                                                                                                                  1. Explicitly put control in the config (e.g. lfo({ c: "lpf" }))
                                                                                                                                                                  2. If the control parameter is absent, the control immediately before the lfo call will be used (e.g. s("saw").lpf(500).lfo() to modulate lpf)

                                                                                                                                                                  Modulators can be referred to by id so that they can be updated later e.g. inside a sometimes. See example below.

                                                                                                                                                                  • config (object): LFO configuration.
                                                                                                                                                                  • config.control (string|Pattern): Node to modulate. Aliases: c
                                                                                                                                                                  • config.subControl (string|Pattern): Sub-control name to append to the control key. Aliases: sc
                                                                                                                                                                  • config.rate (number|Pattern): Modulation rate. Aliases: r
                                                                                                                                                                  • config.sync (number|Pattern): Tempo-synced modulation rate. Aliases: s
                                                                                                                                                                  • config.depth (number|Pattern): Relative modulation depth. Aliases: dep, dr
                                                                                                                                                                  • config.depthabs (number|Pattern): Absolute modulation depth. Aliases: da
                                                                                                                                                                  • config.dcoffset (number|Pattern): DC offset / bias for the waveform. Aliases: dc
                                                                                                                                                                  • config.shape (number|Pattern): Shape index. Aliases: sh
                                                                                                                                                                  • config.skew (number|Pattern): Skew amount. Aliases: sk
                                                                                                                                                                  • config.curve (number|Pattern): Exponential curve amount. Aliases: cu
                                                                                                                                                                  • config.retrig (number|Pattern): If &gt; 0.5, the LFO will retrigger on each event. Aliases: rt
                                                                                                                                                                  • config.fxi (number|Pattern): FX index to target
                                                                                                                                                                  • id (string|Pattern): ID to use for this modulator
                                                                                                                                                                  s("saw").note("F1").lpf(500).lfo()
                                                                                                                                                                  s("saw").lfo().lpf(500).lfo({ s: 0.3 })
                                                                                                                                                                  s("saw").lpf(500).diode(0.3)
                                                                                                                                                                    .lfo({ c: "lpf" })
                                                                                                                                                                  s("pulse").lpf(500).lfo()
                                                                                                                                                                    .lfo({ c: "s" })
                                                                                                                                                                    .diode(0.3)
                                                                                                                                                                    .sometimes(x => x.lfo({ s: "8" }, 1)) // lfo #1 (0-indexed)
                                                                                                                                                                  s("pulse").lpf(500).lfo({ depth: 4 }, 'lpf_mod')
                                                                                                                                                                    .lfo({ c: "s" })
                                                                                                                                                                    .diode(0.3)
                                                                                                                                                                    .sometimes(x => x.lfo({ s: "8" }, 'lpf_mod'))

                                                                                                                                                                  linger

                                                                                                                                                                  Selects the given fraction of the pattern and repeats that part to fill the remainder of the cycle.

                                                                                                                                                                  • fraction (number): fraction to select
                                                                                                                                                                  s("lt ht mt cp, [hh oh]*2").linger("<1 .5 .25 .125>")

                                                                                                                                                                  log

                                                                                                                                                                  Writes the content of the current event to the console (visible in the side menu).

                                                                                                                                                                  • func (function):
                                                                                                                                                                  • getData (function):
                                                                                                                                                                  s("bd sd").log()

                                                                                                                                                                  logValues

                                                                                                                                                                  A simplified version of log which writes all "values" (various configurable parameters) within the event to the console (visible in the side menu).

                                                                                                                                                                  • func (function):
                                                                                                                                                                  s("bd sd").gain("0.25 0.5 1").n("2 1 0").logValues()

                                                                                                                                                                  loop

                                                                                                                                                                  Loops the sample. Note that the tempo of the loop is not synced with the cycle tempo. To change the loop region, use loopBegin / loopEnd.

                                                                                                                                                                  • on (number|Pattern): If 1, the sample is looped
                                                                                                                                                                  s("casio").loop(1)

                                                                                                                                                                  loopAt

                                                                                                                                                                  Makes the sample fit the given number of cycles by changing the speed.

                                                                                                                                                                  • factor (number):
                                                                                                                                                                  • pat (Pattern):
                                                                                                                                                                  • cps (number):
                                                                                                                                                                  samples({ rhodes: 'https://cdn.freesound.org/previews/132/132051_316502-lq.mp3' })
                                                                                                                                                                  s("rhodes").loopAt(2)

                                                                                                                                                                  loopAtCps

                                                                                                                                                                  Makes the sample fit the given number of cycles and cps value, by changing the speed. deprecated: use loopAt or fit instead, together with setCps / setCpm.

                                                                                                                                                                    samples({ rhodes: 'https://cdn.freesound.org/previews/132/132051_316502-lq.mp3' })
                                                                                                                                                                    s("rhodes").loopAtCps(4,1.5).cps(1.5)

                                                                                                                                                                    loopBegin

                                                                                                                                                                    Synonyms: loopb

                                                                                                                                                                    Begin to loop at a specific point in the sample (inbetween begin and end). Note that the loop point must be inbetween begin and end, and before loopEnd! Note: Samples starting with wt_ will automatically loop! (wt = wavetable)

                                                                                                                                                                    • time (number|Pattern): between 0 and 1, where 1 is the length of the sample
                                                                                                                                                                    s("space").loop(1)
                                                                                                                                                                    .loopBegin("<0 .125 .25>")._scope()

                                                                                                                                                                    loopEnd

                                                                                                                                                                    Synonyms: loope

                                                                                                                                                                    End the looping section at a specific point in the sample (inbetween begin and end). Note that the loop point must be inbetween begin and end, and after loopBegin!

                                                                                                                                                                    • time (number|Pattern): between 0 and 1, where 1 is the length of the sample
                                                                                                                                                                    s("space").loop(1)
                                                                                                                                                                    .loopEnd("<1 .75 .5 .25>")._scope()

                                                                                                                                                                    lpattack

                                                                                                                                                                    Synonyms: lpa

                                                                                                                                                                    Sets the attack duration for the lowpass filter envelope.

                                                                                                                                                                    • attack (number|Pattern): time of the filter envelope
                                                                                                                                                                    note("c2 e2 f2 g2")
                                                                                                                                                                    .sound('sawtooth')
                                                                                                                                                                    .lpf(300)
                                                                                                                                                                    .lpa("<.5 .25 .1 .01>/4")
                                                                                                                                                                    .lpenv(4)

                                                                                                                                                                    lpdc

                                                                                                                                                                    DC offset of the LFO for the lowpass filter

                                                                                                                                                                    • dcoffset (number|Pattern): dc offset. set to 0 for unipolar

                                                                                                                                                                    lpdecay

                                                                                                                                                                    Synonyms: lpd

                                                                                                                                                                    Sets the decay duration for the lowpass filter envelope.

                                                                                                                                                                    • decay (number|Pattern): time of the filter envelope
                                                                                                                                                                    note("c2 e2 f2 g2")
                                                                                                                                                                    .sound('sawtooth')
                                                                                                                                                                    .lpf(300)
                                                                                                                                                                    .lpd("<.5 .25 .1 0>/4")
                                                                                                                                                                    .lpenv(4)

                                                                                                                                                                    lpdepth

                                                                                                                                                                    Depth of the LFO for the lowpass filter

                                                                                                                                                                    • depth (number|Pattern): depth of modulation
                                                                                                                                                                    note("<c c c# c c c4>*16").s("sawtooth").lpf(600).lpdepth("<1 .5 1.8 0>")

                                                                                                                                                                    lpdepthfrequency

                                                                                                                                                                    Synonyms: lpdepthfreq

                                                                                                                                                                    Depth of the LFO for the lowpass filter, in HZ

                                                                                                                                                                    • depth (number|Pattern): depth of modulation
                                                                                                                                                                    note("<c c c# c c c4>*16").s("sawtooth").lpf(600).lpdepthfrequency("<200 500 100 0>")

                                                                                                                                                                    lpenv

                                                                                                                                                                    Synonyms: lpe

                                                                                                                                                                    Sets the lowpass filter envelope modulation depth.

                                                                                                                                                                    • modulation (number|Pattern): depth of the lowpass filter envelope between 0 and n
                                                                                                                                                                    note("c2 e2 f2 g2")
                                                                                                                                                                    .sound('sawtooth')
                                                                                                                                                                    .lpf(300)
                                                                                                                                                                    .lpa(.5)
                                                                                                                                                                    .lpenv("<4 2 1 0 -1 -2 -4>/4")

                                                                                                                                                                    lpf

                                                                                                                                                                    Synonyms: cutoff, ctf, lp

                                                                                                                                                                    Applies the cutoff frequency of the low-pass filter.

                                                                                                                                                                    When using mininotation, you can also optionally add the 'lpq' parameter, separated by ':'.

                                                                                                                                                                    • frequency (number|Pattern): audible between 0 and 20000
                                                                                                                                                                    s("bd sd [~ bd] sd,hh*6").lpf("<4000 2000 1000 500 200 100>")
                                                                                                                                                                    s("bd*16").lpf("1000:0 1000:10 1000:20 1000:30")

                                                                                                                                                                    lpq

                                                                                                                                                                    Synonyms: resonance

                                                                                                                                                                    Controls the low-pass q-value.

                                                                                                                                                                    • q (number|Pattern): resonance factor between 0 and 50
                                                                                                                                                                    s("bd sd [~ bd] sd,hh*8").lpf(2000).lpq("<0 10 20 30>")

                                                                                                                                                                    lprate

                                                                                                                                                                    Rate of the LFO for the lowpass filter

                                                                                                                                                                    • rate (number|Pattern): rate in hertz
                                                                                                                                                                    note("<c c c# c c c4>*16").s("sawtooth").lpf(600).lprate("<4 8 2 1>")

                                                                                                                                                                    lprelease

                                                                                                                                                                    Synonyms: lpr

                                                                                                                                                                    Sets the release time for the lowpass filter envelope.

                                                                                                                                                                    • release (number|Pattern): time of the filter envelope
                                                                                                                                                                    note("c2 e2 f2 g2")
                                                                                                                                                                    .sound('sawtooth')
                                                                                                                                                                    .clip(.5)
                                                                                                                                                                    .lpf(300)
                                                                                                                                                                    .lpenv(4)
                                                                                                                                                                    .lpr("<.5 .25 .1 0>/4")
                                                                                                                                                                    .release(.5)

                                                                                                                                                                    lpshape

                                                                                                                                                                    Shape of the LFO for the lowpass filter

                                                                                                                                                                    • shape (number|Pattern): Shape of the lfo (0, 1, 2, ..)

                                                                                                                                                                    lpskew

                                                                                                                                                                    Skew of the LFO for the lowpass filter

                                                                                                                                                                    • skew (number|Pattern): How much to bend the LFO shape

                                                                                                                                                                    lpsustain

                                                                                                                                                                    Synonyms: lps

                                                                                                                                                                    Sets the sustain amplitude for the lowpass filter envelope.

                                                                                                                                                                    • sustain (number|Pattern): amplitude of the lowpass filter envelope
                                                                                                                                                                    note("c2 e2 f2 g2")
                                                                                                                                                                    .sound('sawtooth')
                                                                                                                                                                    .lpf(300)
                                                                                                                                                                    .lpd(.5)
                                                                                                                                                                    .lps("<0 .25 .5 1>/4")
                                                                                                                                                                    .lpenv(4)

                                                                                                                                                                    lpsync

                                                                                                                                                                    Cycle-synced rate of the LFO for the lowpass filter

                                                                                                                                                                    • rate (number|Pattern): rate in cycles
                                                                                                                                                                    note("<c c c# c c c4>*16").s("sawtooth").lpf(600).lpsync("<4 8 2 1>")

                                                                                                                                                                    lt

                                                                                                                                                                    performs a < b

                                                                                                                                                                    • a (any):
                                                                                                                                                                    • b (any):

                                                                                                                                                                    lte

                                                                                                                                                                    performs a <= b

                                                                                                                                                                    • a (any):
                                                                                                                                                                    • b (any):

                                                                                                                                                                    markcss

                                                                                                                                                                    Overrides the css of highlighted events. Make sure to use single quotes!

                                                                                                                                                                      note("c a f e")
                                                                                                                                                                      .markcss('text-decoration:underline')

                                                                                                                                                                      mask

                                                                                                                                                                      Returns silence when mask is 0 or "~"

                                                                                                                                                                      • args (any):
                                                                                                                                                                      note("c [eb,g] d [eb,g]").mask("<1 [0 1]>")

                                                                                                                                                                      midi

                                                                                                                                                                      MIDI output: Opens a MIDI output port.

                                                                                                                                                                      • midiport (string|number): MIDI device name or index defaulting to 0
                                                                                                                                                                      • options (object): Additional MIDI configuration options
                                                                                                                                                                      • options.isController (boolean): sending notes for midi controllers. Default is false
                                                                                                                                                                      • options.noteOffsetMs (number): note-off offset to prevent glitching in ms. Default is 10 or firefox and 1 otherwise
                                                                                                                                                                      • options.midichannel (number): default is 1
                                                                                                                                                                      • options.velocity (number): default is 0.9
                                                                                                                                                                      • options.gain (number): default is 1
                                                                                                                                                                      • options.midimap (string): default is 'default'
                                                                                                                                                                      note("c4").midichan(1).midi('IAC Driver Bus 1')

                                                                                                                                                                      midi2note

                                                                                                                                                                      converts midi values into notes

                                                                                                                                                                      • n (number):

                                                                                                                                                                      midibend

                                                                                                                                                                      MIDI pitch bend: Sends a MIDI pitch bend message.

                                                                                                                                                                      • midibend (number|Pattern): MIDI pitch bend (-1 - 1)
                                                                                                                                                                      note("c4").midibend(sine.slow(4).range(-0.4,0.4)).midi()

                                                                                                                                                                      midichan

                                                                                                                                                                      MIDI channel: Sets the MIDI channel for the event.

                                                                                                                                                                      • channel (number|Pattern): MIDI channel number (0-15)
                                                                                                                                                                      note("c4").midichan(1).midi()

                                                                                                                                                                      midicmd

                                                                                                                                                                      MIDI command: Sends a MIDI command message.

                                                                                                                                                                      • command (number|Pattern): MIDI command
                                                                                                                                                                      midicmd("clock*48,<start stop>/2").midi()

                                                                                                                                                                      MidiInput

                                                                                                                                                                      Constructs a new Midi input device

                                                                                                                                                                      • input (string|number): MIDI device name or index defaulting to 0

                                                                                                                                                                      midikeys

                                                                                                                                                                      MIDI keyboard: Opens a MIDI input port to receive MIDI keyboard messages.

                                                                                                                                                                      The note length is fixed as Superdough is not currently set up for undetermined note durations

                                                                                                                                                                      The 'midichan' control value contains the number of the channel the note is coming from so it could be filtered or manipulated further in the chain.

                                                                                                                                                                      • input (string|number): MIDI device name or index defaulting to 0
                                                                                                                                                                      const kb = await midikeys('Arturia KeyStep 32')
                                                                                                                                                                      kb().s("tri").lpf(80).lpe(6).lpd(0.1).room(2).delay(0.35)
                                                                                                                                                                      const kb = await midikeys('Arturia KeyStep 32')
                                                                                                                                                                      kb("0.5 1")
                                                                                                                                                                        .s("saw")
                                                                                                                                                                        .add(note(rand.mul(0.3)))
                                                                                                                                                                        .lpf(1000).lpe(2).room(0.5)
                                                                                                                                                                      // discard all notes not coming out from midi channel 2
                                                                                                                                                                      const kb = await midikeys('Arturia KeyStep 32')
                                                                                                                                                                      kb().filterValues(v=>v.midichan==2).s("tri")

                                                                                                                                                                      midimaps

                                                                                                                                                                      Adds midimaps to the registry. Inside each midimap, control names (e.g. lpf) are mapped to cc numbers.

                                                                                                                                                                      • map (string|object):
                                                                                                                                                                      midimaps({ mymap: { lpf: 74 } })
                                                                                                                                                                      $: note("c a f e")
                                                                                                                                                                      .lpf(sine.slow(4))
                                                                                                                                                                      .midimap('mymap')
                                                                                                                                                                      .midi()
                                                                                                                                                                      midimaps({ mymap: {
                                                                                                                                                                        lpf: { ccn: 74, min: 0, max: 20000, exp: 0.5 }
                                                                                                                                                                      }})
                                                                                                                                                                      $: note("c a f e")
                                                                                                                                                                      .lpf(sine.slow(2).range(400,2000))
                                                                                                                                                                      .midimap('mymap')
                                                                                                                                                                      .midi()

                                                                                                                                                                      midin

                                                                                                                                                                      MIDI input: Opens a MIDI input port to receive MIDI control change messages.

                                                                                                                                                                      The output is a function that accepts a midi cc value to query as well as (optionally) a midi channel

                                                                                                                                                                      • input (string|number): MIDI device name or index defaulting to 0
                                                                                                                                                                      const cc = await midin('IAC Driver Bus 1')
                                                                                                                                                                      note("c a f e").lpf(cc(0).range(0, 1000)).lpq(cc(1).range(0, 10)).sound("sawtooth")
                                                                                                                                                                      const allCC = await midin('IAC Driver Bus 1')
                                                                                                                                                                      const cc = (ccNum) => allCC(ccNum, 2) // just channel 2
                                                                                                                                                                      note("c a f e").s("saw")
                                                                                                                                                                        .when(cc(0).gt(0), x => x.postgain(0))

                                                                                                                                                                      midiport

                                                                                                                                                                      MIDI port: Sets the MIDI port for the event.

                                                                                                                                                                      • port (number|Pattern): MIDI port
                                                                                                                                                                      note("c a f e").midiport("<0 1 2 3>").midi()

                                                                                                                                                                      miditouch

                                                                                                                                                                      MIDI key after touch: Sends a MIDI key after touch message.

                                                                                                                                                                      • miditouch (number|Pattern): MIDI key after touch (0-1)
                                                                                                                                                                      note("c4").miditouch(sine.slow(4).range(0,1)).midi()

                                                                                                                                                                      mod

                                                                                                                                                                      Divides each number by the given factor and returns the remainder

                                                                                                                                                                        mode

                                                                                                                                                                        How the voicing is aligned to the anchor

                                                                                                                                                                        • below: top note <= anchor

                                                                                                                                                                        • duck: top note <= anchor, anchor excluded

                                                                                                                                                                        • above: bottom note >= anchor

                                                                                                                                                                        • root: bottom note is the lowest root of the chord >= anchor

                                                                                                                                                                        • oldabove : old (buggy) behavior of above, kept for legacy reason

                                                                                                                                                                        • oldroot : old (buggy) behavior of root, kept for legacy reason

                                                                                                                                                                        • modeName (string|Pattern): one of {below | above | duck | root | oldabove | oldroot}
                                                                                                                                                                        mode("<below above duck root>").chord("C").voicing()

                                                                                                                                                                        morph

                                                                                                                                                                        Takes two binary rhythms represented as lists of 1s and 0s, and a number between 0 and 1 that morphs between them. The two lists should contain the same number of true values.

                                                                                                                                                                        • frompat (Pattern|Array.<number>):
                                                                                                                                                                        • topat (Pattern|Array.<number>):
                                                                                                                                                                        • bypat (Pattern|number):
                                                                                                                                                                        sound("hh").struct(morph([1,0,1,0,1,0,1,0], // straight rhythm
                                                                                                                                                                                                 [1,1,0,1,0,1,0], // wonky rhythm
                                                                                                                                                                                                 0.25 // creates a slightly wonky rhythm
                                                                                                                                                                                                )
                                                                                                                                                                                          )
                                                                                                                                                                        sound("hh").struct(morph("1:0:1:0:1:0:1:0", // straight rhythm
                                                                                                                                                                                                 "1:1:0:1:0:1:0", // wonky rhythm
                                                                                                                                                                                                 sine.slow(8) // slowly morph between the rhythms
                                                                                                                                                                                                )
                                                                                                                                                                                          )

                                                                                                                                                                        mousex

                                                                                                                                                                        Synonyms: mouseX

                                                                                                                                                                        The mouse's x position value ranges from 0 to 1.

                                                                                                                                                                          n(mousex.segment(4).range(0,7)).scale("C:minor")

                                                                                                                                                                          mousey

                                                                                                                                                                          Synonyms: mouseY

                                                                                                                                                                          The mouse's y position value ranges from 0 to 1.

                                                                                                                                                                            n(mousey.segment(4).range(0,7)).scale("C:minor")

                                                                                                                                                                            mul

                                                                                                                                                                            Multiplies each number by the given factor.

                                                                                                                                                                              "<1 1.5 [1.66, <2 2.33>]>*4".mul(150).freq()

                                                                                                                                                                              n

                                                                                                                                                                              Selects the given index:

                                                                                                                                                                              • for samples, it picks the sample by index, with wrap around
                                                                                                                                                                              • for scales, it picks the scale degree
                                                                                                                                                                              • for voicings, it picks the voice index
                                                                                                                                                                              • value (number|Pattern): sample index starting from 0
                                                                                                                                                                              s("bd sd [~ bd] sd,hh*6").n("<0 1>")

                                                                                                                                                                              ne

                                                                                                                                                                              performs a != b

                                                                                                                                                                              • a (any):
                                                                                                                                                                              • b (any):

                                                                                                                                                                              net

                                                                                                                                                                              performs a !== b (strictly not equal)

                                                                                                                                                                              • a (any):
                                                                                                                                                                              • b (any):

                                                                                                                                                                              never

                                                                                                                                                                              Shorthand for .sometimesBy(0, fn) (never calls fn)

                                                                                                                                                                                s("hh*8").never(x=>x.speed("0.5"))

                                                                                                                                                                                noise

                                                                                                                                                                                Adds pink noise to the mix

                                                                                                                                                                                • wet (number|Pattern): wet amount
                                                                                                                                                                                sound("<white pink brown>/2")

                                                                                                                                                                                note

                                                                                                                                                                                Plays the given note name or midi number. A note name consists of

                                                                                                                                                                                • a letter (a-g or A-G)
                                                                                                                                                                                • optional accidentals (b or #)
                                                                                                                                                                                • optional (possibly negative) octave number (0-9). Defaults to 3

                                                                                                                                                                                Examples of valid note names: c, bb, Bb, f#, c3, A4, Eb2, c#5

                                                                                                                                                                                You can also use midi numbers instead of note names, where 69 is mapped to A4 440Hz in 12EDO.

                                                                                                                                                                                  note("c a f e")
                                                                                                                                                                                  note("c4 a4 f4 e4")
                                                                                                                                                                                  note("60 69 65 64")
                                                                                                                                                                                  note("fbb1 a#0 cbbb-1 e##-2").sound("saw")

                                                                                                                                                                                  nrpnn

                                                                                                                                                                                  MIDI NRPN non-registered parameter number: Sends a MIDI NRPN non-registered parameter number message.

                                                                                                                                                                                  • nrpnn (number|Pattern): MIDI NRPN non-registered parameter number (0-127)
                                                                                                                                                                                  note("c4").nrpnn("1:8").nrpv("123").midichan(1).midi()

                                                                                                                                                                                  nrpv

                                                                                                                                                                                  MIDI NRPN non-registered parameter value: Sends a MIDI NRPN non-registered parameter value message.

                                                                                                                                                                                  • nrpv (number|Pattern): MIDI NRPN non-registered parameter value (0-127)
                                                                                                                                                                                  note("c4").nrpnn("1:8").nrpv("123").midichan(1).midi()

                                                                                                                                                                                  octaves

                                                                                                                                                                                  How many octaves are voicing steps spread apart, defaults to 1

                                                                                                                                                                                  • count (number|Pattern): the number of octaves
                                                                                                                                                                                  chord("<Am C D F Am E Am E>").octaves("<2 4>").voicing()

                                                                                                                                                                                  off

                                                                                                                                                                                  Superimposes the function result on top of the original pattern, delayed by the given time.

                                                                                                                                                                                  • time (Pattern|number): offset time
                                                                                                                                                                                  • func (function): function to apply
                                                                                                                                                                                  "c3 eb3 g3".off(1/8, x=>x.add(7)).note()

                                                                                                                                                                                  offset

                                                                                                                                                                                  Sets how the voicing is offset from the anchored position

                                                                                                                                                                                  • shift (number|Pattern): the amount to shift the voicing up or down
                                                                                                                                                                                  chord("<Am C D F Am E Am E>").offset("<0 1 2 3 4 5>") // alter the voicing each time

                                                                                                                                                                                  often

                                                                                                                                                                                  Shorthand for .sometimesBy(0.75, fn)

                                                                                                                                                                                    s("hh*8").often(x=>x.speed("0.5"))

                                                                                                                                                                                    onSchedule

                                                                                                                                                                                    Attaches a function that is called for each hap onset.

                                                                                                                                                                                    • onSchedule (function):
                                                                                                                                                                                    • dominant (boolean):
                                                                                                                                                                                    s("bd sd").onSchedule((hap, time, cps) => {
                                                                                                                                                                                      console.log('hap scheduled', time, cps);
                                                                                                                                                                                    })

                                                                                                                                                                                    onsetsOnly

                                                                                                                                                                                    Returns a new pattern, with all haps without onsets filtered out. A hap with an onset is one with a whole timespan that begins at the same time as its part timespan.

                                                                                                                                                                                      onTriggerTime

                                                                                                                                                                                      make something happen on event time uses browser timeout which is innacurate for audio tasks

                                                                                                                                                                                      • func (function):
                                                                                                                                                                                      s("bd!8").onTriggerTime((hap) => {console.log(hap)})

                                                                                                                                                                                      open

                                                                                                                                                                                      A signal that goes from 0 to 1 over one cycle, and then stays at 1 forever. Mainly useful in combination with other functions that reset the cycle. See also close.

                                                                                                                                                                                        sound("bd sd [- bd] sd".fast(2))
                                                                                                                                                                                          .lpf(open.slow(4).range(300,3000)) // close envelope over 4 cycles
                                                                                                                                                                                          .restart("x/4") // restart every 4 cycles

                                                                                                                                                                                        or

                                                                                                                                                                                        performs a || b

                                                                                                                                                                                        • a (any):
                                                                                                                                                                                        • b (any):

                                                                                                                                                                                        orbit

                                                                                                                                                                                        Synonyms: o

                                                                                                                                                                                        An orbit is a global parameter context for patterns. Patterns with the same orbit will share the same global effects.

                                                                                                                                                                                        • number (number|Pattern):
                                                                                                                                                                                        stack(
                                                                                                                                                                                          s("hh*6").delay(.5).delaytime(.25).orbit(1),
                                                                                                                                                                                          s("~ sd ~ sd").delay(.5).delaytime(.125).orbit(2)
                                                                                                                                                                                        )

                                                                                                                                                                                        orientationAlpha

                                                                                                                                                                                        Synonyms: oriA, oriZ, orientationZ

                                                                                                                                                                                        The device's orientation alpha value ranges from 0 to 1.

                                                                                                                                                                                          n(orientationAlpha.segment(4).range(0,7)).scale("C:minor")

                                                                                                                                                                                          orientationBeta

                                                                                                                                                                                          Synonyms: oriB, oriX, orientationX

                                                                                                                                                                                          The device's orientation beta value ranges from 0 to 1.

                                                                                                                                                                                            n(orientationBeta.segment(4).range(0,7)).scale("C:minor")

                                                                                                                                                                                            orientationGamma

                                                                                                                                                                                            Synonyms: oriG, oriY, orientationY

                                                                                                                                                                                            The device's orientation gamma value ranges from 0 to 1.

                                                                                                                                                                                              n(orientationGamma.segment(4).range(0,7)).scale("C:minor")

                                                                                                                                                                                              osc

                                                                                                                                                                                              Sends each hap as an OSC message, which can be picked up by SuperCollider or any other OSC-enabled software. For more info, read MIDI & OSC in the docs

                                                                                                                                                                                                oschost

                                                                                                                                                                                                The host to send open sound control messages to. Requires running the OSC bridge.

                                                                                                                                                                                                • oschost (string|Pattern): e.g. 'localhost'
                                                                                                                                                                                                note("c4").oschost('127.0.0.1').oscport(57120).osc();

                                                                                                                                                                                                oscport

                                                                                                                                                                                                The port to send open sound control messages to. Requires running the OSC bridge.

                                                                                                                                                                                                • oscport (number|Pattern): e.g. 57120
                                                                                                                                                                                                note("c4").oschost('127.0.0.1').oscport(57120).osc();

                                                                                                                                                                                                outside

                                                                                                                                                                                                Carries out an operation 'outside' a cycle.

                                                                                                                                                                                                  "<[0 1] 2 [3 4] 5>".outside(4, rev).scale('C major').note()
                                                                                                                                                                                                  // "<[0 1] 2 [3 4] 5>".fast(4).rev().slow(4).scale('C major').note()

                                                                                                                                                                                                  pace

                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                  Speeds a pattern up or down, to fit to the given number of steps per cycle.

                                                                                                                                                                                                    sound("bd sd cp").pace(4)
                                                                                                                                                                                                    // The same as sound("{bd sd cp}%4") or sound("<bd sd cp>*4")

                                                                                                                                                                                                    palindrome

                                                                                                                                                                                                    Applies rev to a pattern every other cycle, so that the pattern alternates between forwards and backwards.

                                                                                                                                                                                                      note("c d e g").palindrome()

                                                                                                                                                                                                      pan

                                                                                                                                                                                                      Sets position in stereo.

                                                                                                                                                                                                      • pan (number|Pattern): between 0 and 1, from left to right (assuming stereo), once round a circle (assuming multichannel)
                                                                                                                                                                                                      s("[bd hh]*2").pan("<.5 1 .5 0>")
                                                                                                                                                                                                      s("bd rim sd rim bd ~ cp rim").pan(sine.slow(2))

                                                                                                                                                                                                      panchor

                                                                                                                                                                                                      Sets the range anchor of the envelope:

                                                                                                                                                                                                      • anchor 0: range = [note, note + penv]
                                                                                                                                                                                                      • anchor 1: range = [note - penv, note] If you don't set an anchor, the value will default to the psustain value.
                                                                                                                                                                                                      • anchor (number|Pattern): anchor offset
                                                                                                                                                                                                      note("c c4").penv(12).panchor("<0 .5 1 .5>")

                                                                                                                                                                                                      parray

                                                                                                                                                                                                      Turns a list of patterns into a single pattern which outputs list-values

                                                                                                                                                                                                      • pats (Array.<Pattern>):

                                                                                                                                                                                                      partials

                                                                                                                                                                                                      Scale the magnitude of the harmonics of one of the core synths ('sine', 'tri', 'saw', ..)

                                                                                                                                                                                                      Can also be used to create a new synth via s('user').partials(...)

                                                                                                                                                                                                      • list (Array.<number>|Pattern): [0, 1] magnitudes for partials. 0th entry is the fundamental harmonic (i.e. DC offset is skipped)
                                                                                                                                                                                                      s("user").seg(16).n(irand(8)).scale("A:major")
                                                                                                                                                                                                        .partials([1, 0, 1, 0, 0, 1])
                                                                                                                                                                                                      s("saw").seg(8).n(irand(12)).scale("G#:minor")
                                                                                                                                                                                                        .partials(binaryL(irand(256).add("1")))

                                                                                                                                                                                                      pattack

                                                                                                                                                                                                      Synonyms: patt

                                                                                                                                                                                                      Attack time of pitch envelope.

                                                                                                                                                                                                      • time (number|Pattern): time in seconds
                                                                                                                                                                                                      note("c eb g bb").pattack("0 .1 .25 .5").slow(2)

                                                                                                                                                                                                      Pattern

                                                                                                                                                                                                      Create a pattern. As an end user, you will most likely not create a Pattern directly.

                                                                                                                                                                                                      • query (function): The function that maps a State to an array of Hap.
                                                                                                                                                                                                      • steps (number|undefined):

                                                                                                                                                                                                      pcurve

                                                                                                                                                                                                      Curve of envelope. Defaults to linear. exponential is good for kicks

                                                                                                                                                                                                      • type (number|Pattern): 0 = linear, 1 = exponential
                                                                                                                                                                                                      note("g1*4")
                                                                                                                                                                                                      .s("sine").pdec(.5)
                                                                                                                                                                                                      .penv(32)
                                                                                                                                                                                                      .pcurve("<0 1>")

                                                                                                                                                                                                      pdecay

                                                                                                                                                                                                      Synonyms: pdec

                                                                                                                                                                                                      Decay time of pitch envelope.

                                                                                                                                                                                                      • time (number|Pattern): time in seconds
                                                                                                                                                                                                      note("<c eb g bb>").pdecay("<0 .1 .25 .5>")

                                                                                                                                                                                                      penv

                                                                                                                                                                                                      Amount of pitch envelope. Negative values will flip the envelope. If you don't set other pitch envelope controls, pattack:.2 will be the default.

                                                                                                                                                                                                      • semitones (number|Pattern): change in semitones
                                                                                                                                                                                                      note("c")
                                                                                                                                                                                                      .penv("<12 7 1 .5 0 -1 -7 -12>")

                                                                                                                                                                                                      per

                                                                                                                                                                                                      Synonyms: perCycle

                                                                                                                                                                                                      A pattern measuring the 'shortness' of events, or in other words, the duration of pattern events, in events per cycle. per doesn't have structure itself, but takes structure, and therefore event durations, from the pattern that it is combined with. For example per.struct("1 1 [1 1] 1") would give the same as "4 4 [8 8] 4". See also its reciprocal, cyclesPer.

                                                                                                                                                                                                        // Shorter events are more distorted
                                                                                                                                                                                                        n("0 0*2 0 0*2 0 [0 0 0]@2").sound("bd")
                                                                                                                                                                                                         .distort(per.div(2))

                                                                                                                                                                                                        perlin

                                                                                                                                                                                                        Generates a continuous pattern of perlin noise, in the range 0..1.

                                                                                                                                                                                                          // randomly change the cutoff
                                                                                                                                                                                                          s("bd*4,hh*8").cutoff(perlin.range(500,8000))

                                                                                                                                                                                                          perx

                                                                                                                                                                                                          Like per but measures the shortness of events according to an exponential curve. In particular, where the event duration halves, the returned value increases by one. perx.struct("1 1 [1 [1 1]] 1") would therefore be the same as "3 3 [4 [5 5]] 3".

                                                                                                                                                                                                            phaser

                                                                                                                                                                                                            Synonyms: ph

                                                                                                                                                                                                            Phaser audio effect that approximates popular guitar pedals.

                                                                                                                                                                                                            • speed (number|Pattern): speed of modulation
                                                                                                                                                                                                            n(run(8)).scale("D:pentatonic").s("sawtooth").release(0.5)
                                                                                                                                                                                                            .phaser("<1 2 4 8>")

                                                                                                                                                                                                            phasercenter

                                                                                                                                                                                                            Synonyms: phc

                                                                                                                                                                                                            The center frequency of the phaser in HZ. Defaults to 1000

                                                                                                                                                                                                            • centerfrequency (number|Pattern): in HZ
                                                                                                                                                                                                            n(run(8)).scale("D:pentatonic").s("sawtooth").release(0.5)
                                                                                                                                                                                                            .phaser(2).phasercenter("<800 2000 4000>")

                                                                                                                                                                                                            phaserdepth

                                                                                                                                                                                                            Synonyms: phd, phasdp

                                                                                                                                                                                                            The amount the signal is affected by the phaser effect. Defaults to 0.75

                                                                                                                                                                                                            • depth (number|Pattern): number between 0 and 1
                                                                                                                                                                                                            n(run(8)).scale("D:pentatonic").s("sawtooth").release(0.5)
                                                                                                                                                                                                            .phaser(2).phaserdepth("<0 .5 .75 1>")

                                                                                                                                                                                                            phasersweep

                                                                                                                                                                                                            Synonyms: phs

                                                                                                                                                                                                            The frequency sweep range of the lfo for the phaser effect. Defaults to 2000

                                                                                                                                                                                                            • phasersweep (number|Pattern): most useful values are between 0 and 4000
                                                                                                                                                                                                            n(run(8)).scale("D:pentatonic").s("sawtooth").release(0.5)
                                                                                                                                                                                                            .phaser(2).phasersweep("<800 2000 4000>")

                                                                                                                                                                                                            phases

                                                                                                                                                                                                            Rotates the harmonics of one of the core synths ('sine', 'tri', 'saw', 'user', ..) by a list of phases

                                                                                                                                                                                                            • list (Array.<number>|Pattern): of [0, 1) phases for partials. 0th entry is the fundamental phase (i.e. DC offset is skipped)
                                                                                                                                                                                                            // Phase cancellation
                                                                                                                                                                                                            s("saw").seg(8).n(irand(12)).scale("G#1:minor")
                                                                                                                                                                                                              .partials(partials([1, 1, 1]))
                                                                                                                                                                                                              .superimpose(x => x.phases([0.5, 0.5, 0.5]))

                                                                                                                                                                                                            pianoroll

                                                                                                                                                                                                            Synonyms: punchcard

                                                                                                                                                                                                            Visualises a pattern as a scrolling 'pianoroll', displayed in the background of the editor. To show a pianoroll for all running patterns, use all(pianoroll). To have a pianoroll appear below a pattern instead, prefix with _, e.g.: sound("bd sd")._pianoroll().

                                                                                                                                                                                                            • options (object): Object containing all the optional following parameters as key value pairs:
                                                                                                                                                                                                            • options.cycles (number): number of cycles to be displayed at the same time - defaults to 4
                                                                                                                                                                                                            • options.playhead (number): location of the active notes on the time axis - 0 to 1, defaults to 0.5
                                                                                                                                                                                                            • options.vertical (boolean): displays the roll vertically - 0 by default
                                                                                                                                                                                                            • options.labels (boolean): displays labels on individual notes (see the label function) - 0 by default
                                                                                                                                                                                                            • options.flipTime (boolean): reverse the direction of the roll - 0 by default
                                                                                                                                                                                                            • options.flipValues (boolean): reverse the relative location of notes on the value axis - 0 by default
                                                                                                                                                                                                            • options.overscan (number): lookup X cycles outside of the cycles window to display notes in advance - 1 by default
                                                                                                                                                                                                            • options.hideNegative (boolean): hide notes with negative time (before starting playing the pattern) - 0 by default
                                                                                                                                                                                                            • options.smear (boolean): notes leave a solid trace - 0 by default
                                                                                                                                                                                                            • options.fold (boolean): notes takes the full value axis width - 0 by default
                                                                                                                                                                                                            • options.active (string): hexadecimal or CSS color of the active notes - defaults to #FFCA28
                                                                                                                                                                                                            • options.inactive (string): hexadecimal or CSS color of the inactive notes - defaults to #7491D2
                                                                                                                                                                                                            • options.background (string): hexadecimal or CSS color of the background - defaults to transparent
                                                                                                                                                                                                            • options.playheadColor (string): hexadecimal or CSS color of the line representing the play head - defaults to white
                                                                                                                                                                                                            • options.fill (boolean): notes are filled with color (otherwise only the label is displayed) - 0 by default
                                                                                                                                                                                                            • options.fillActive (boolean): active notes are filled with color - 0 by default
                                                                                                                                                                                                            • options.stroke (boolean): notes are shown with colored borders - 0 by default
                                                                                                                                                                                                            • options.strokeActive (boolean): active notes are shown with colored borders - 0 by default
                                                                                                                                                                                                            • options.hideInactive (boolean): only active notes are shown - 0 by default
                                                                                                                                                                                                            • options.colorizeInactive (boolean): use note color for inactive notes - 1 by default
                                                                                                                                                                                                            • options.fontFamily (string): define the font used by notes labels - defaults to 'monospace'
                                                                                                                                                                                                            • options.minMidi (number): minimum note value to display on the value axis - defaults to 10
                                                                                                                                                                                                            • options.maxMidi (number): maximum note value to display on the value axis - defaults to 90
                                                                                                                                                                                                            • options.autorange (boolean): automatically calculate the minMidi and maxMidi parameters - 0 by default
                                                                                                                                                                                                            note("c2 a2 eb2")
                                                                                                                                                                                                            .euclid(5,8)
                                                                                                                                                                                                            .s('sawtooth')
                                                                                                                                                                                                            .lpenv(4).lpf(300)
                                                                                                                                                                                                            .pianoroll({ labels: 1 })

                                                                                                                                                                                                            pick

                                                                                                                                                                                                            Picks patterns (or plain values) either from a list (by index) or a lookup table (by name). Similar to inhabit, but maintains the structure of the original patterns. The lookup can also be a pattern of objects, such as a pattern of controls, in which case each of its events is used as the lookup table.

                                                                                                                                                                                                            • pat (Pattern):
                                                                                                                                                                                                            • xs (*):
                                                                                                                                                                                                            note("<0 1 2!2 3>".pick(["g a", "e f", "f g f g" , "g c d"]))
                                                                                                                                                                                                            sound("<0 1 [2,0]>".pick(["bd sd", "cp cp", "hh hh"]))
                                                                                                                                                                                                            sound("<0!2 [0,1] 1>".pick(["bd(3,8)", "sd sd"]))
                                                                                                                                                                                                            s("<a!2 [a,b] b>".pick({a: "bd(3,8)", b: "sd sd"}))
                                                                                                                                                                                                            // pick a field out of a pattern of objects
                                                                                                                                                                                                            const pat = sound("bd cp").speed("<2 3>")
                                                                                                                                                                                                            pat.fast("speed".pick(pat))

                                                                                                                                                                                                            pickAndRename

                                                                                                                                                                                                            Selects entries from source and renames them via map

                                                                                                                                                                                                            • source (object):
                                                                                                                                                                                                            • map (*):

                                                                                                                                                                                                            pickF

                                                                                                                                                                                                            pickF lets you use a pattern of numbers to pick which function to apply to another pattern.

                                                                                                                                                                                                            • pat (Pattern):
                                                                                                                                                                                                            • lookup (Pattern): a pattern of indices or names
                                                                                                                                                                                                            • lookup (Array.<function()>|object): the array or lookup object of functions from which to pull
                                                                                                                                                                                                            s("bd [rim hh]").pickF("<0 1 2>", [rev,jux(rev),fast(2)])
                                                                                                                                                                                                            note("<c2 d2>(3,8)").s("square")
                                                                                                                                                                                                            .pickF("<0 2> 1", [jux(rev), fast(2), x=>x.lpf(800)])
                                                                                                                                                                                                            note("<c2 d2>(3,8)").s("square")
                                                                                                                                                                                                            .pickF("<jr l> f", { jr:jux(rev), f:fast(2), l:x=>x.lpf(800) })

                                                                                                                                                                                                            pickmod

                                                                                                                                                                                                            The same as pick, but if you pick a number greater than the size of the list, it wraps around, rather than sticking at the maximum value. For example, if you pick the fifth pattern of a list of three, you'll get the second one.

                                                                                                                                                                                                            • pat (Pattern):
                                                                                                                                                                                                            • xs (*):

                                                                                                                                                                                                            pickmodF

                                                                                                                                                                                                            The same as pickF, but if you pick a number greater than the size of the functions list, it wraps around, rather than sticking at the maximum value.

                                                                                                                                                                                                            • pat (Pattern):
                                                                                                                                                                                                            • lookup (Pattern): a pattern of indices or names
                                                                                                                                                                                                            • lookup (Array.<function()>|object): the array or lookup object of functions from which to pull

                                                                                                                                                                                                            pickmodOut

                                                                                                                                                                                                            The same as pickOut, but if you pick a number greater than the size of the list, it wraps around, rather than sticking at the maximum value.

                                                                                                                                                                                                            • pat (Pattern):
                                                                                                                                                                                                            • xs (*):

                                                                                                                                                                                                            pickmodReset

                                                                                                                                                                                                            The same as pickReset, but if you pick a number greater than the size of the list, it wraps around, rather than sticking at the maximum value.

                                                                                                                                                                                                            • pat (Pattern):
                                                                                                                                                                                                            • xs (*):

                                                                                                                                                                                                            pickmodRestart

                                                                                                                                                                                                            The same as pickRestart, but if you pick a number greater than the size of the list, it wraps around, rather than sticking at the maximum value.

                                                                                                                                                                                                            • pat (Pattern):
                                                                                                                                                                                                            • xs (*):
                                                                                                                                                                                                            "<a@2 b@2 c@2 d@2>".pickRestart({
                                                                                                                                                                                                                    a: n("0 1 2 0"),
                                                                                                                                                                                                                    b: n("2 3 4 ~"),
                                                                                                                                                                                                                    c: n("[4 5] [4 3] 2 0"),
                                                                                                                                                                                                                    d: n("0 -3 0 ~")
                                                                                                                                                                                                                  }).scale("C:major").s("piano")

                                                                                                                                                                                                            pickOut

                                                                                                                                                                                                            Similar to pick, but it applies an outerJoin instead of an innerJoin.

                                                                                                                                                                                                            • pat (Pattern):
                                                                                                                                                                                                            • xs (*):
                                                                                                                                                                                                            note("<0*4 1 2*2 3*3>".pickOut(["g a", "e f", "f g f g" , "g c d"]))

                                                                                                                                                                                                            pickReset

                                                                                                                                                                                                            Similar to pick, but the choosen pattern is reset when its index is triggered.

                                                                                                                                                                                                            • pat (Pattern):
                                                                                                                                                                                                            • xs (*):

                                                                                                                                                                                                            pickRestart

                                                                                                                                                                                                            Similar to pick, but the choosen pattern is restarted when its index is triggered.

                                                                                                                                                                                                            • pat (Pattern):
                                                                                                                                                                                                            • xs (*):

                                                                                                                                                                                                            pitchwheel

                                                                                                                                                                                                            Renders a pitch circle to visualize frequencies within one octave

                                                                                                                                                                                                            • options (object):
                                                                                                                                                                                                            • options.hapcircles (number):
                                                                                                                                                                                                            • options.circle (number):
                                                                                                                                                                                                            • options.edo (number):
                                                                                                                                                                                                            • options.root (string):
                                                                                                                                                                                                            • options.thickness (number):
                                                                                                                                                                                                            • options.hapRadius (number):
                                                                                                                                                                                                            • options.mode (string):
                                                                                                                                                                                                            • options.margin (number):
                                                                                                                                                                                                            n("0 .. 12").scale("C:chromatic")
                                                                                                                                                                                                            .s("sawtooth")
                                                                                                                                                                                                            .lpf(500)
                                                                                                                                                                                                            ._pitchwheel()

                                                                                                                                                                                                            ply

                                                                                                                                                                                                            The ply function repeats each event the given number of times.

                                                                                                                                                                                                              s("bd ~ sd cp").ply("<1 2 3>")

                                                                                                                                                                                                              plyForEach

                                                                                                                                                                                                              Synonyms: plyforeach

                                                                                                                                                                                                              The plyForEach function repeats each event the given number of times, applying the given function to each event. This version of ply uses the iteration index as an argument to the function, similar to echoWith.

                                                                                                                                                                                                              • factor (number): how many times to repeat
                                                                                                                                                                                                              • func (function): function to apply, given the pattern and the iteration index
                                                                                                                                                                                                              "<0 [2 4]>"
                                                                                                                                                                                                              .plyForEach(4, (p,n) => p.add(n*2))
                                                                                                                                                                                                              .scale("C:minor").note()

                                                                                                                                                                                                              plyWith

                                                                                                                                                                                                              Synonyms: plywith

                                                                                                                                                                                                              The plyWith function repeats each event the given number of times, applying the given function to each event.\n

                                                                                                                                                                                                              • factor (number): how many times to repeat
                                                                                                                                                                                                              • func (function): function to apply, given the pattern
                                                                                                                                                                                                              "<0 [2 4]>"
                                                                                                                                                                                                              .plyWith(4, (p) => p.add(2))
                                                                                                                                                                                                              .scale("C:minor").note()

                                                                                                                                                                                                              polymeter

                                                                                                                                                                                                              Synonyms: pm

                                                                                                                                                                                                              Experimental

                                                                                                                                                                                                              Aligns the steps of the patterns, creating polymeters. The patterns are repeated until they all fit the cycle. For example, in the below the first pattern is repeated twice, and the second is repeated three times, to fit the lowest common multiple of six steps.

                                                                                                                                                                                                              • args (any):
                                                                                                                                                                                                              // The same as note("{c eb g, c2 g2}%6")
                                                                                                                                                                                                              polymeter("c eb g", "c2 g2").note()

                                                                                                                                                                                                              postgain

                                                                                                                                                                                                              Gain applied after all effects have been processed.

                                                                                                                                                                                                                s("bd sd [~ bd] sd,hh*8")
                                                                                                                                                                                                                .compressor("-20:20:10:.002:.02").postgain(1.5)

                                                                                                                                                                                                                pow

                                                                                                                                                                                                                Raises each number to the power of the given factor

                                                                                                                                                                                                                  prelease

                                                                                                                                                                                                                  Synonyms: prel

                                                                                                                                                                                                                  Release time of pitch envelope

                                                                                                                                                                                                                  • time (number|Pattern): time in seconds
                                                                                                                                                                                                                  note("<c eb g bb> ~")
                                                                                                                                                                                                                  .release(.5) // to hear the pitch release
                                                                                                                                                                                                                  .prelease("<0 .1 .25 .5>")

                                                                                                                                                                                                                  prepareInputBuffersToSend

                                                                                                                                                                                                                  Copy contents of input buffers to buffer actually sent to process

                                                                                                                                                                                                                    press

                                                                                                                                                                                                                    Syncopates a rhythm, by shifting each event halfway into its timespan.

                                                                                                                                                                                                                      stack(s("hh*4"),
                                                                                                                                                                                                                            s("bd mt sd ht").every(4, press)
                                                                                                                                                                                                                           ).slow(2)

                                                                                                                                                                                                                      pressBy

                                                                                                                                                                                                                      Like press, but allows you to specify the amount by which each event is shifted. pressBy(0.5) is the same as press, while pressBy(1/3) shifts each event by a third of its timespan.

                                                                                                                                                                                                                        stack(s("hh*4"),
                                                                                                                                                                                                                              s("bd mt sd ht").pressBy("<0 0.5 0.25>")
                                                                                                                                                                                                                             ).slow(2)

                                                                                                                                                                                                                        print

                                                                                                                                                                                                                        Prints the values of a pattern's events. Without a leading underscore, prints to the existing console panel, labeled with its position among other print() calls, e.g. [print(line:1)]. With the _ prefix, it shows a scrollable widget inside the code instead, and its content resets on every (re-)evaluation.

                                                                                                                                                                                                                        • options (object): object that may have the following arguments
                                                                                                                                                                                                                        • options.width (number): widget width in px, _print only. defaults to 600
                                                                                                                                                                                                                        • options.height (number): widget height in px, _print only. defaults to 100
                                                                                                                                                                                                                        • options.maxLines (number): max lines kept, _print only. defaults to 500
                                                                                                                                                                                                                        • options.round (number): decimal digits for the event time. defaults to 4. 0 shows only the cycle
                                                                                                                                                                                                                        • options.padding (number): integer digits reserved for the cycle, so it stays aligned once cycles reach 10 or 100. defaults to 3
                                                                                                                                                                                                                        s("bd sd hh cp").print()
                                                                                                                                                                                                                        s("bd sd hh*2 cp")._print({ round: 5 })

                                                                                                                                                                                                                        progNum

                                                                                                                                                                                                                        MIDI program number: Sends a MIDI program change message.

                                                                                                                                                                                                                        • program (number|Pattern): MIDI program number (0-127)
                                                                                                                                                                                                                        note("c4").progNum(10).midichan(1).midi()

                                                                                                                                                                                                                        pure

                                                                                                                                                                                                                        A discrete value that repeats once per cycle.

                                                                                                                                                                                                                        • value (number):
                                                                                                                                                                                                                        pure('e4') // "e4"

                                                                                                                                                                                                                        pw

                                                                                                                                                                                                                        Controls the pulsewidth of the pulse oscillator

                                                                                                                                                                                                                        • pulsewidth (number|Pattern):
                                                                                                                                                                                                                        note("{f a c e}%16").s("pulse").pw(".8:1:.2")
                                                                                                                                                                                                                        n(run(8)).scale("D:pentatonic").s("pulse").pw("0 .75 .5 1")

                                                                                                                                                                                                                        pwrate

                                                                                                                                                                                                                        Synonyms: pwr

                                                                                                                                                                                                                        Controls the lfo rate for the pulsewidth of the pulse oscillator

                                                                                                                                                                                                                        • rate (number|Pattern):
                                                                                                                                                                                                                        n(run(8)).scale("D:pentatonic").s("pulse").pw("0.5").pwrate("<5 .1 25>").pwsweep("<0.3 .8>")

                                                                                                                                                                                                                        pwsweep

                                                                                                                                                                                                                        Synonyms: pws

                                                                                                                                                                                                                        Controls the lfo sweep for the pulsewidth of the pulse oscillator

                                                                                                                                                                                                                        • sweep (number|Pattern):
                                                                                                                                                                                                                        n(run(8)).scale("D:pentatonic").s("pulse").pw("0.5").pwrate("<5 .1 25>").pwsweep("<0.3 .8>")

                                                                                                                                                                                                                        queryArc

                                                                                                                                                                                                                        Query haps inside the given time span.

                                                                                                                                                                                                                        • begin (Fraction|number): from time
                                                                                                                                                                                                                        • end (Fraction|number): to time
                                                                                                                                                                                                                        • controls (object):
                                                                                                                                                                                                                        const pattern = sequence('a', ['b', 'c'])
                                                                                                                                                                                                                        const haps = pattern.queryArc(0, 1)
                                                                                                                                                                                                                        console.log(haps)
                                                                                                                                                                                                                        silence

                                                                                                                                                                                                                        rand

                                                                                                                                                                                                                        A continuous pattern of random numbers, between 0 and 1.

                                                                                                                                                                                                                          // randomly change the cutoff
                                                                                                                                                                                                                          s("bd*4,hh*8").cutoff(rand.range(500,8000))

                                                                                                                                                                                                                          rand2

                                                                                                                                                                                                                          A continuous pattern of random numbers, between -1 and 1

                                                                                                                                                                                                                            randL

                                                                                                                                                                                                                            Creates a list of random numbers of the given length

                                                                                                                                                                                                                            • n (number): Number of random numbers to sample
                                                                                                                                                                                                                            s("saw").seg(16).n(irand(12)).scale("F1:minor")
                                                                                                                                                                                                                              .partials(randL(8))

                                                                                                                                                                                                                            range

                                                                                                                                                                                                                            Assumes a numerical pattern, containing unipolar values in the range 0 .. 1. Returns a new pattern with values scaled to the given min/max range. Most useful in combination with continuous patterns.

                                                                                                                                                                                                                              s("[bd sd]*2,hh*8")
                                                                                                                                                                                                                              .cutoff(sine.range(500,4000))

                                                                                                                                                                                                                              range2

                                                                                                                                                                                                                              Assumes a numerical pattern, containing bipolar values in the range -1 .. 1 Returns a new pattern with values scaled to the given min/max range.

                                                                                                                                                                                                                                s("[bd sd]*2,hh*8")
                                                                                                                                                                                                                                .cutoff(sine2.range2(500,4000))

                                                                                                                                                                                                                                rangex

                                                                                                                                                                                                                                Assumes a numerical pattern, containing unipolar values in the range 0 .. 1 Returns a new pattern with values scaled to the given min/max range, following an exponential curve.

                                                                                                                                                                                                                                  s("[bd sd]*2,hh*8")
                                                                                                                                                                                                                                  .cutoff(sine.rangex(500,4000))

                                                                                                                                                                                                                                  rarely

                                                                                                                                                                                                                                  Shorthand for .sometimesBy(0.25, fn)

                                                                                                                                                                                                                                    s("hh*8").rarely(x=>x.speed("0.5"))

                                                                                                                                                                                                                                    ratio

                                                                                                                                                                                                                                    Allows dividing numbers via list notation using ":". Returns a new pattern with just numbers.

                                                                                                                                                                                                                                      ratio("1, 5:4, 3:2").mul(110)
                                                                                                                                                                                                                                      .freq().s("piano")

                                                                                                                                                                                                                                      readInputs

                                                                                                                                                                                                                                      Read next web audio block to input buffers

                                                                                                                                                                                                                                      • inputs (*):

                                                                                                                                                                                                                                      reallocateChannelsIfNeeded

                                                                                                                                                                                                                                      Handles dynamic reallocation of input/output channels buffer (channel numbers may vary during lifecycle)

                                                                                                                                                                                                                                      • inputs (*):
                                                                                                                                                                                                                                      • outputs (*):

                                                                                                                                                                                                                                      ref

                                                                                                                                                                                                                                      exposes a custom value at query time. basically allows mutating state without evaluation

                                                                                                                                                                                                                                      • accessor (function):

                                                                                                                                                                                                                                      register

                                                                                                                                                                                                                                      Registers a new pattern method. The method is added to the Pattern class + the standalone function is returned from register.

                                                                                                                                                                                                                                      • name (string|Array.<string>): name of the function, or an array of names to be used as synonyms
                                                                                                                                                                                                                                      • func (function): function with 1 or more params, where last is the current pattern
                                                                                                                                                                                                                                      • patternify (boolean): defaults to true; if set to false, you will have more control over the arguments to func as they will be in their raw form and it will be up to you to patternify them and/or query them for values
                                                                                                                                                                                                                                      • preserveSteps (boolean):
                                                                                                                                                                                                                                      • join (function):
                                                                                                                                                                                                                                      const vlpf = register('vlpf', (freq, pat) => {
                                                                                                                                                                                                                                        return pat.fmap((v) => ({...v, cutoff: freq * (v.velocity ?? 1) }));
                                                                                                                                                                                                                                      })
                                                                                                                                                                                                                                      s("saw").seg(8).velocity(rand).vlpf(800)

                                                                                                                                                                                                                                      release

                                                                                                                                                                                                                                      Synonyms: rel

                                                                                                                                                                                                                                      Amplitude envelope release time: The time it takes after the offset to go from sustain level to zero.

                                                                                                                                                                                                                                      • time (number|Pattern): release time in seconds
                                                                                                                                                                                                                                      note("c3 e3 g3 c4").release("<0 .1 .4 .6 1>/2")

                                                                                                                                                                                                                                      removeUndefineds

                                                                                                                                                                                                                                      Returns a new pattern, with haps containing undefined values removed from query results.

                                                                                                                                                                                                                                        repeatCycles

                                                                                                                                                                                                                                        Repeats each cycle the given number of times.

                                                                                                                                                                                                                                          note(irand(12).add(34)).segment(4).repeatCycles(2).s("gm_acoustic_guitar_nylon")

                                                                                                                                                                                                                                          replicate

                                                                                                                                                                                                                                          Experimental

                                                                                                                                                                                                                                          replicate is similar to extend, except that replicate will "replicate" the thing being extended. This will only differ from extend when the input pattern differs from cycle to cycle.

                                                                                                                                                                                                                                            stepcat(
                                                                                                                                                                                                                                              sound("bd bd - <cp hh>").replicate(2),
                                                                                                                                                                                                                                              sound("bd - sd -")
                                                                                                                                                                                                                                            ).pace(8)

                                                                                                                                                                                                                                            reset

                                                                                                                                                                                                                                            Resets the pattern to the start of the cycle for each onset of the reset pattern.

                                                                                                                                                                                                                                            • args (any):
                                                                                                                                                                                                                                            s("[<bd lt> sd]*2, hh*8").reset("<x@3 x(5,8)>")

                                                                                                                                                                                                                                            restart

                                                                                                                                                                                                                                            Restarts the pattern for each onset of the restart pattern. While reset will only reset the current cycle, restart will start from cycle 0.

                                                                                                                                                                                                                                            • args (any):
                                                                                                                                                                                                                                            s("[<bd lt> sd]*2, hh*8").restart("<x@3 x(5,8)>")

                                                                                                                                                                                                                                            rev

                                                                                                                                                                                                                                            Reverse all cycles in a pattern. See also revv for reversing a whole pattern.

                                                                                                                                                                                                                                              note("c d e g").rev()

                                                                                                                                                                                                                                              revv

                                                                                                                                                                                                                                              Reverse a whole pattern. See also rev for reversing each cycle.

                                                                                                                                                                                                                                                // This is the same as `<[g e] [d c]>`. If `rev()` is used, you get
                                                                                                                                                                                                                                                // the same as `<[d c] [g e]>`, where each cycle reverses, but the order of
                                                                                                                                                                                                                                                // cycles stays the same.
                                                                                                                                                                                                                                                note("<[c d] [e g]>").revv()

                                                                                                                                                                                                                                                ribbon

                                                                                                                                                                                                                                                Synonyms: rib

                                                                                                                                                                                                                                                Loops the pattern inside an offset for cycles. If you think of the entire span of time in cycles as a ribbon, you can cut a single piece and loop it.

                                                                                                                                                                                                                                                • offset (number): start point of loop in cycles
                                                                                                                                                                                                                                                • cycles (number): loop length in cycles
                                                                                                                                                                                                                                                note("<c d e f>").ribbon(1, 2)
                                                                                                                                                                                                                                                // Looping a portion of randomness
                                                                                                                                                                                                                                                n(irand(8).segment(4)).scale("c:pentatonic").ribbon(1337, 2)
                                                                                                                                                                                                                                                // rhythm generator
                                                                                                                                                                                                                                                s("bd!16?").ribbon(29,.5)

                                                                                                                                                                                                                                                room

                                                                                                                                                                                                                                                Sets the level of reverb.

                                                                                                                                                                                                                                                When using mininotation, you can also optionally add the 'size' parameter, separated by ':'.

                                                                                                                                                                                                                                                • level (number|Pattern):
                                                                                                                                                                                                                                                s("bd sd [~ bd] sd").room("<0 .2 .4 .6 .8 1>")
                                                                                                                                                                                                                                                s("bd sd [~ bd] sd").room("<0.9:1 0.9:4>")

                                                                                                                                                                                                                                                roomdim

                                                                                                                                                                                                                                                Synonyms: rdim

                                                                                                                                                                                                                                                Reverb lowpass frequency at -60dB (in hertz). When this property is changed, the reverb will be recaculated, so only change this sparsely..

                                                                                                                                                                                                                                                • frequency (number): between 0 and 20000hz
                                                                                                                                                                                                                                                s("bd sd [~ bd] sd").room(0.5).rlp(10000).rdim(8000)
                                                                                                                                                                                                                                                s("bd sd [~ bd] sd").room(0.5).rlp(5000).rdim(400)

                                                                                                                                                                                                                                                roomfade

                                                                                                                                                                                                                                                Synonyms: rfade

                                                                                                                                                                                                                                                Reverb fade time (in seconds). When this property is changed, the reverb will be recaculated, so only change this sparsely..

                                                                                                                                                                                                                                                • seconds (number): for the reverb to fade
                                                                                                                                                                                                                                                s("bd sd [~ bd] sd").room(0.5).rlp(10000).rfade(0.5)
                                                                                                                                                                                                                                                s("bd sd [~ bd] sd").room(0.5).rlp(5000).rfade(4)

                                                                                                                                                                                                                                                roomlp

                                                                                                                                                                                                                                                Synonyms: rlp

                                                                                                                                                                                                                                                Reverb lowpass starting frequency (in hertz). When this property is changed, the reverb will be recaculated, so only change this sparsely..

                                                                                                                                                                                                                                                • frequency (number): between 0 and 20000hz
                                                                                                                                                                                                                                                s("bd sd [~ bd] sd").room(0.5).rlp(10000)
                                                                                                                                                                                                                                                s("bd sd [~ bd] sd").room(0.5).rlp(5000)

                                                                                                                                                                                                                                                roomsize

                                                                                                                                                                                                                                                Synonyms: rsize, sz, size

                                                                                                                                                                                                                                                Sets the room size of the reverb, see room. When this property is changed, the reverb will be recaculated, so only change this sparsely..

                                                                                                                                                                                                                                                • size (number|Pattern): between 0 and 10
                                                                                                                                                                                                                                                s("bd sd [~ bd] sd").room(.8).rsize(1)
                                                                                                                                                                                                                                                s("bd sd [~ bd] sd").room(.8).rsize(4)

                                                                                                                                                                                                                                                rootNotes

                                                                                                                                                                                                                                                Maps the chords of the incoming pattern to root notes in the given octave.

                                                                                                                                                                                                                                                • octave (octave): octave to use
                                                                                                                                                                                                                                                "<C^7 A7 Dm7 G7>".rootNotes(2).note()

                                                                                                                                                                                                                                                rotationAlpha

                                                                                                                                                                                                                                                Synonyms: rotA, rotZ, rotationZ

                                                                                                                                                                                                                                                The device's rotation around the alpha-axis value ranges from 0 to 1.

                                                                                                                                                                                                                                                  n(rotationAlpha.segment(4).range(0,7)).scale("C:minor")

                                                                                                                                                                                                                                                  rotationBeta

                                                                                                                                                                                                                                                  Synonyms: rotB, rotX, rotationX

                                                                                                                                                                                                                                                  The device's rotation around the beta-axis value ranges from 0 to 1.

                                                                                                                                                                                                                                                    n(rotationBeta.segment(4).range(0,7)).scale("C:minor")

                                                                                                                                                                                                                                                    rotationGamma

                                                                                                                                                                                                                                                    Synonyms: rotG, rotY, rotationY

                                                                                                                                                                                                                                                    The device's rotation around the gamma-axis value ranges from 0 to 1.

                                                                                                                                                                                                                                                      n(rotationGamma.segment(4).range(0,7)).scale("C:minor")

                                                                                                                                                                                                                                                      round

                                                                                                                                                                                                                                                      Assumes a numerical pattern. Returns a new pattern with all values rounded to the nearest integer.

                                                                                                                                                                                                                                                        n("0.5 1.5 2.5".round()).scale("C:major")

                                                                                                                                                                                                                                                        run

                                                                                                                                                                                                                                                        A discrete pattern of numbers from 0 to n-1

                                                                                                                                                                                                                                                        • n (number):
                                                                                                                                                                                                                                                        n(run(4)).scale("C4:pentatonic")
                                                                                                                                                                                                                                                        // n("0 1 2 3").scale("C4:pentatonic")

                                                                                                                                                                                                                                                        s

                                                                                                                                                                                                                                                        Synonyms: sound

                                                                                                                                                                                                                                                        Select a sound / sample by name. When using mininotation, you can also optionally supply 'n' and 'gain' parameters separated by ':'.

                                                                                                                                                                                                                                                        • sound (string|Pattern): The sound / pattern of sounds to pick
                                                                                                                                                                                                                                                        s("bd hh")
                                                                                                                                                                                                                                                        s("bd:0 bd:1 bd:0:0.3 bd:1:1.4")

                                                                                                                                                                                                                                                        samples

                                                                                                                                                                                                                                                        Loads a collection of samples to use with s

                                                                                                                                                                                                                                                          samples('github:tidalcycles/dirt-samples');
                                                                                                                                                                                                                                                          s("[bd ~]*2, [~ hh]*2, ~ sd")
                                                                                                                                                                                                                                                          samples({
                                                                                                                                                                                                                                                           bd: '808bd/BD0000.WAV',
                                                                                                                                                                                                                                                           sd: '808sd/SD0010.WAV'
                                                                                                                                                                                                                                                           }, 'https://raw.githubusercontent.com/tidalcycles/Dirt-Samples/master/');
                                                                                                                                                                                                                                                          s("[bd ~]*2, [~ hh]*2, ~ sd")

                                                                                                                                                                                                                                                          saw

                                                                                                                                                                                                                                                          A sawtooth signal between 0 and 1.

                                                                                                                                                                                                                                                            note("<c3 [eb3,g3] g2 [g3,bb3]>*8")
                                                                                                                                                                                                                                                            .clip(saw.slow(2))
                                                                                                                                                                                                                                                            n(saw.range(0,8).segment(8))
                                                                                                                                                                                                                                                            .scale('C major')

                                                                                                                                                                                                                                                            saw2

                                                                                                                                                                                                                                                            A sawtooth signal between -1 and 1 (like saw, but bipolar).

                                                                                                                                                                                                                                                              scale

                                                                                                                                                                                                                                                              Turns numbers into notes in the scale (zero indexed) or quantizes notes to a scale.

                                                                                                                                                                                                                                                              When describing notes via numbers, note that negative numbers can be used to wrap backwards in the scale as well as sharps or flats to produce notes outside of the scale.

                                                                                                                                                                                                                                                              Also sets scale for other scale operations, like Pattern#scaleTranspose.

                                                                                                                                                                                                                                                              A scale consists of a root note (e.g. c4, c, f#, bb4) followed by semicolon (':') and then a scale type.

                                                                                                                                                                                                                                                              The scale name must be written without spaces (because it would be interpreted as a multi-step pattern otherwise). If your scale name includes spaces, replace them with colons.

                                                                                                                                                                                                                                                              The root note defaults to octave 3, if no octave number is given.

                                                                                                                                                                                                                                                              • scale (string): Name of scale
                                                                                                                                                                                                                                                              n("0 2 4 6 4 2").scale("C:major")
                                                                                                                                                                                                                                                              n("[0,7] 4 [2,7] 4")
                                                                                                                                                                                                                                                              .scale("C:<major minor>/2")
                                                                                                                                                                                                                                                              .s("piano")
                                                                                                                                                                                                                                                              n(rand.range(0,12).segment(8))
                                                                                                                                                                                                                                                              .scale("C:ritusen")
                                                                                                                                                                                                                                                              .s("piano")
                                                                                                                                                                                                                                                              n("<[0,7b] [-4# -4] [-2,7##] 4 [0,7] [-4# -4b] [-2,7###] 4b>*4")
                                                                                                                                                                                                                                                              .scale("C:<major minor>/2")
                                                                                                                                                                                                                                                              .s("piano")
                                                                                                                                                                                                                                                              note("C1*16").transpose(irand(36)).scale('Cb2 major').scaleTranspose(3)
                                                                                                                                                                                                                                                              n("[0 0] [1 2] [3 4] [5 6]").scale("C:major:blues")

                                                                                                                                                                                                                                                              scaleTranspose

                                                                                                                                                                                                                                                              Synonyms: scaleTrans, strans

                                                                                                                                                                                                                                                              Transposes notes inside the scale by the number of steps. Expected to be called on a Pattern which already has a Pattern#scale

                                                                                                                                                                                                                                                              • offset (offset): number of steps inside the scale
                                                                                                                                                                                                                                                              "-8 [2,4,6]"
                                                                                                                                                                                                                                                              .scale('C4 bebop major')
                                                                                                                                                                                                                                                              .scaleTranspose("<0 -1 -2 -3 -4 -5 -6 -4>")
                                                                                                                                                                                                                                                              .note()

                                                                                                                                                                                                                                                              scope

                                                                                                                                                                                                                                                              Synonyms: tscope

                                                                                                                                                                                                                                                              Renders an oscilloscope for the time domain of the audio signal.

                                                                                                                                                                                                                                                              • config (object): optional config with options:
                                                                                                                                                                                                                                                              • align (boolean): if 1, the scope will be aligned to the first zero crossing. defaults to 1
                                                                                                                                                                                                                                                              • color (string): line color as hex or color name. defaults to white.
                                                                                                                                                                                                                                                              • thickness (number): line thickness. defaults to 3
                                                                                                                                                                                                                                                              • scale (number): scales the y-axis. Defaults to 0.25
                                                                                                                                                                                                                                                              • pos (number): y-position relative to screen height. 0 = top, 1 = bottom of screen
                                                                                                                                                                                                                                                              • trigger (number): amplitude value that is used to align the scope. defaults to 0.
                                                                                                                                                                                                                                                              s("sawtooth")._scope()

                                                                                                                                                                                                                                                              scramble

                                                                                                                                                                                                                                                              Slices a pattern into the given number of parts, then plays those parts at random. Similar to shuffle, but parts might be played more than once, or not at all, per cycle.

                                                                                                                                                                                                                                                                note("c d e f").sound("piano").scramble(4)
                                                                                                                                                                                                                                                                seq("c d e f".scramble(4), "g").note().sound("piano")

                                                                                                                                                                                                                                                                scrub

                                                                                                                                                                                                                                                                Allows you to scrub an audio file like a tape loop by passing values that represents the position in the audio file in the optional array syntax ex: "0.5:2", the second value controls the speed of playback

                                                                                                                                                                                                                                                                  samples('github:switchangel/pad')
                                                                                                                                                                                                                                                                  s("swpad:0").scrub("{0.1!2 .25@3 0.7!2 <0.8:1.5>}%8")
                                                                                                                                                                                                                                                                  samples('github:yaxu/clean-breaks/main');
                                                                                                                                                                                                                                                                  s("amen/4").fit().scrub("{0@3 0@2 4@3}%8".div(16))

                                                                                                                                                                                                                                                                  seed

                                                                                                                                                                                                                                                                  Change the seed for random signals. Normally, random signals depend on time, so two patterns at the same time will have the same random values. Specifying a new seed changes the signal output by rand. This also affects other functions that use randomness, like shuffle and sometimes.

                                                                                                                                                                                                                                                                  • n (number): A new seed. Can be any number.
                                                                                                                                                                                                                                                                  $: s("hh*4").degrade();
                                                                                                                                                                                                                                                                  $: s("bd*4").degrade().seed(1); // Will degrade different events from the hi-hat

                                                                                                                                                                                                                                                                  segment

                                                                                                                                                                                                                                                                  Synonyms: seg

                                                                                                                                                                                                                                                                  Samples the pattern at a rate of n events per cycle. Useful for turning a continuous pattern into a discrete one.

                                                                                                                                                                                                                                                                  • segments (number): number of segments per cycle
                                                                                                                                                                                                                                                                  note(saw.range(40,52).segment(24))

                                                                                                                                                                                                                                                                  seq

                                                                                                                                                                                                                                                                  Synonyms: fastcat, sequence

                                                                                                                                                                                                                                                                  Like cat, but the items are crammed into one cycle.

                                                                                                                                                                                                                                                                    seq("e5", "b4", ["d5", "c5"]).note()
                                                                                                                                                                                                                                                                    // "e5 b4 [d5 c5]".note()
                                                                                                                                                                                                                                                                    // As a chained function:
                                                                                                                                                                                                                                                                    s("hh*4").seq(
                                                                                                                                                                                                                                                                      note("c4(5,8)")
                                                                                                                                                                                                                                                                    )

                                                                                                                                                                                                                                                                    seqPLoop

                                                                                                                                                                                                                                                                    Similarly to arrange, allows you to arrange multiple patterns together over multiple cycles. Unlike arrange, you specify a start and stop time for each pattern rather than duration, which means that patterns can overlap.

                                                                                                                                                                                                                                                                    • parts (any):
                                                                                                                                                                                                                                                                    seqPLoop(
                                                                                                                                                                                                                                                                    [0, 2, "bd(3,8)"],
                                                                                                                                                                                                                                                                    [1, 3, "cp(3,8)"]
                                                                                                                                                                                                                                                                    ).sound()

                                                                                                                                                                                                                                                                    sequenceP

                                                                                                                                                                                                                                                                    Takes a list of patterns, and returns a pattern of lists.

                                                                                                                                                                                                                                                                    • pats (Array.<Pattern>):

                                                                                                                                                                                                                                                                    set

                                                                                                                                                                                                                                                                    When called on a pattern a, with a input pattern b (a.set(b)), combines a and b such that anything defined in b and anything defined in a that is not defined in b will be in the resulting pattern.

                                                                                                                                                                                                                                                                    The structure is maintained from a, because the default pattern alignment is in, see the section on Pattern Alignment in the technical manual in the docs

                                                                                                                                                                                                                                                                    This is the inverse of keep

                                                                                                                                                                                                                                                                    See examples below

                                                                                                                                                                                                                                                                    • a (Pattern):
                                                                                                                                                                                                                                                                    • b (Pattern):
                                                                                                                                                                                                                                                                    // because input pattern has `s` set,
                                                                                                                                                                                                                                                                    // it overrides the "sine" declared earlier
                                                                                                                                                                                                                                                                    note("c a f e").s("sine").set(s("triangle"))

                                                                                                                                                                                                                                                                    setContext

                                                                                                                                                                                                                                                                    Returns a new pattern with the context field set to every hap set to the given value.

                                                                                                                                                                                                                                                                    • context (*):

                                                                                                                                                                                                                                                                    setcpm

                                                                                                                                                                                                                                                                    Changes the global tempo to the given cycles per minute

                                                                                                                                                                                                                                                                    • cpm (number): cycles per minute
                                                                                                                                                                                                                                                                    setcpm(140/4) // =140 bpm in 4/4
                                                                                                                                                                                                                                                                    $: s("bd*4,[- sd]*2").bank('tr707')

                                                                                                                                                                                                                                                                    setDefaultJoin

                                                                                                                                                                                                                                                                    Sets the default method of combining events from two patterns (aka alignment) in Strudel. The default method is 'in', meaning that patterns to the left will (typically) dictate the event timings when combined with patterns to the right. By changing alignment to 'out', the opposite will happen. With 'mix', they will combine their event timings.

                                                                                                                                                                                                                                                                    Note that we say the default method, because alignments can also be set explicitly with calls like 'add.mix', 'set.squeeze', etc.

                                                                                                                                                                                                                                                                    • alignment (string): Default join method to use. Options: 'in', 'out', 'mix', 'squeeze', 'squeezeout', 'reset', 'restart', 'poly'
                                                                                                                                                                                                                                                                    setDefaultJoin('mix') // also try 'in', 'out', 'squeeze', etc.
                                                                                                                                                                                                                                                                    s("saw").vel("1 0.5").note("F A C E").delay("0 0.2 0.3")

                                                                                                                                                                                                                                                                    setGainCurve

                                                                                                                                                                                                                                                                    Apply a function to all gains provided in patterns. Can be used to rescale gain to be quadratic, exponential, etc. rather than linear

                                                                                                                                                                                                                                                                    • newGainCurveFunc (function): function to apply to all gain values
                                                                                                                                                                                                                                                                    setGainCurve((x) => x * x) // quadratic gain
                                                                                                                                                                                                                                                                    s("bd*4").gain(0.5) // equivalent to 0.25 gain normally

                                                                                                                                                                                                                                                                    setMaxPolyphony

                                                                                                                                                                                                                                                                    Set the max polyphony. If notes are ringing out via release then they will start to die out in first-in-first-out order once the max polyphony has been hit

                                                                                                                                                                                                                                                                    • polyphony (number): Max polyphony. Defaults to 128
                                                                                                                                                                                                                                                                    setMaxPolyphony(4)
                                                                                                                                                                                                                                                                    n(irand(24).seg(8)).scale("C#3:minor").room(1).release(4).gain(0.5)

                                                                                                                                                                                                                                                                    shape

                                                                                                                                                                                                                                                                    (Deprecated) Wave shaping distortion. WARNING: can suddenly get unpredictably loud. Please use distort instead, which has a more predictable response curve second option in optional array syntax (ex: ".9:.5") applies a postgain to the output

                                                                                                                                                                                                                                                                    • distortion (number|Pattern): between 0 and 1
                                                                                                                                                                                                                                                                    s("bd sd [~ bd] sd,hh*8").shape("<0 .2 .4 .6 .8>")

                                                                                                                                                                                                                                                                    shiftInputBuffers

                                                                                                                                                                                                                                                                    Shift left content of input buffers to receive new web audio block

                                                                                                                                                                                                                                                                      shiftOutputBuffers

                                                                                                                                                                                                                                                                      Shift left content of output buffers to receive new web audio block

                                                                                                                                                                                                                                                                        shiftPeaks

                                                                                                                                                                                                                                                                        Shift peaks and regions of influence by pitchFactor into new specturm

                                                                                                                                                                                                                                                                        • pitchFactor (number):

                                                                                                                                                                                                                                                                        showFirstCycle

                                                                                                                                                                                                                                                                        More human-readable version of the firstCycleValues accessor.

                                                                                                                                                                                                                                                                          shrink

                                                                                                                                                                                                                                                                          Experimental

                                                                                                                                                                                                                                                                          Progressively shrinks the pattern by 'n' steps until there's nothing left, or if a second value is given (using mininotation list syntax with :), that number of times. A positive number will progressively drop steps from the start of a pattern, and a negative number from the end.

                                                                                                                                                                                                                                                                            "tha dhi thom nam".shrink("1").sound()
                                                                                                                                                                                                                                                                            .bank("mridangam")
                                                                                                                                                                                                                                                                            "tha dhi thom nam".shrink("-1").sound()
                                                                                                                                                                                                                                                                            .bank("mridangam")
                                                                                                                                                                                                                                                                            "tha dhi thom nam".shrink("1 -1").sound().bank("mridangam").pace(4)
                                                                                                                                                                                                                                                                            note("0 1 2 3 4 5 6 7".scale("C:ritusen")).sound("folkharp")
                                                                                                                                                                                                                                                                            .shrink("1 -1").pace(8)

                                                                                                                                                                                                                                                                            shuffle

                                                                                                                                                                                                                                                                            Slices a pattern into the given number of parts, then plays those parts in random order. Each part will be played exactly once per cycle.

                                                                                                                                                                                                                                                                              note("c d e f").sound("piano").shuffle(4)
                                                                                                                                                                                                                                                                              seq("c d e f".shuffle(4), "g").note().sound("piano")

                                                                                                                                                                                                                                                                              signal

                                                                                                                                                                                                                                                                              Creates a signal given by the input function

                                                                                                                                                                                                                                                                              • func (*):
                                                                                                                                                                                                                                                                              // sawtooth signal definition
                                                                                                                                                                                                                                                                              signal(t=>t%1).segment(16).range(30,40).note()
                                                                                                                                                                                                                                                                              signal(t=>Math.pow(t,2)%1).range(40, 60).add(5).segment(16)
                                                                                                                                                                                                                                                                              .off(0, x=>x.add(7))
                                                                                                                                                                                                                                                                              .note()
                                                                                                                                                                                                                                                                              .s("gm_electric_guitar_jazz,gm_epiano")
                                                                                                                                                                                                                                                                                .gain(1.7)
                                                                                                                                                                                                                                                                              .pianoroll()

                                                                                                                                                                                                                                                                              silence

                                                                                                                                                                                                                                                                              Does absolutely nothing..

                                                                                                                                                                                                                                                                                silence // "~"

                                                                                                                                                                                                                                                                                sine

                                                                                                                                                                                                                                                                                A sine signal between 0 and 1.

                                                                                                                                                                                                                                                                                  n(sine.segment(16).range(0,15))
                                                                                                                                                                                                                                                                                  .scale("C:minor")

                                                                                                                                                                                                                                                                                  sine2

                                                                                                                                                                                                                                                                                  A sine signal between -1 and 1 (like sine, but bipolar).

                                                                                                                                                                                                                                                                                    sinefold

                                                                                                                                                                                                                                                                                    Wavefolding distortion composed with sinusoid

                                                                                                                                                                                                                                                                                    • distortion (number|Pattern): amount of distortion to apply
                                                                                                                                                                                                                                                                                    • volume (number|Pattern): linear postgain of the distortion

                                                                                                                                                                                                                                                                                    slice

                                                                                                                                                                                                                                                                                    Chops samples into the given number of slices, triggering those slices with a given pattern of slice numbers. Instead of a number, it also accepts a list of numbers from 0 to 1 to slice at specific points.

                                                                                                                                                                                                                                                                                      samples('github:tidalcycles/dirt-samples')
                                                                                                                                                                                                                                                                                      s("breaks165").slice(8, "0 1 <2 2*2> 3 [4 0] 5 6 7".every(3, rev)).slow(0.75)
                                                                                                                                                                                                                                                                                      samples('github:tidalcycles/dirt-samples')
                                                                                                                                                                                                                                                                                      s("breaks125").fit().slice([0,.25,.5,.75], "0 1 1 <2 3>")

                                                                                                                                                                                                                                                                                      slider

                                                                                                                                                                                                                                                                                      Displays a slider widget to allow the user manipulate a value

                                                                                                                                                                                                                                                                                      • value (number): Initial value
                                                                                                                                                                                                                                                                                      • min (number): Minimum value - optional, defaults to 0
                                                                                                                                                                                                                                                                                      • max (number): Maximum value - optional, defaults to 1
                                                                                                                                                                                                                                                                                      • step (number): Step size - optional

                                                                                                                                                                                                                                                                                      slow

                                                                                                                                                                                                                                                                                      Synonyms: sparsity

                                                                                                                                                                                                                                                                                      Slow down a pattern over the given number of cycles. Like the "/" operator in mini notation.

                                                                                                                                                                                                                                                                                      • factor (number|Pattern): slow down factor
                                                                                                                                                                                                                                                                                      s("bd hh sd hh").slow(2) // s("[bd hh sd hh]/2")

                                                                                                                                                                                                                                                                                      slowcat

                                                                                                                                                                                                                                                                                      Synonyms: cat

                                                                                                                                                                                                                                                                                      Concatenation: combines a list of patterns, switching between them successively, one per cycle.

                                                                                                                                                                                                                                                                                      • pats (any):
                                                                                                                                                                                                                                                                                      slowcat("e5", "b4", ["d5", "c5"])

                                                                                                                                                                                                                                                                                      slowcatPrime

                                                                                                                                                                                                                                                                                      Concatenation: combines a list of patterns, switching between them successively, one per cycle. Unlike slowcat, this version will skip cycles.

                                                                                                                                                                                                                                                                                      • pats (any): The items to concatenate

                                                                                                                                                                                                                                                                                      soft

                                                                                                                                                                                                                                                                                      Soft-clipping distortion

                                                                                                                                                                                                                                                                                      • distortion (number|Pattern): amount of distortion to apply
                                                                                                                                                                                                                                                                                      • volume (number|Pattern): linear postgain of the distortion

                                                                                                                                                                                                                                                                                      someCycles

                                                                                                                                                                                                                                                                                      Shorthand for .someCyclesBy(0.5, fn)

                                                                                                                                                                                                                                                                                        s("bd,hh*8").someCycles(x=>x.speed("0.5"))

                                                                                                                                                                                                                                                                                        someCyclesBy

                                                                                                                                                                                                                                                                                        Randomly applies the given function by the given probability on a cycle by cycle basis. Similar to sometimesBy

                                                                                                                                                                                                                                                                                        • probability (number|Pattern): a number between 0 and 1
                                                                                                                                                                                                                                                                                        • function (function): the transformation to apply
                                                                                                                                                                                                                                                                                        s("bd,hh*8").someCyclesBy(.3, x=>x.speed("0.5"))

                                                                                                                                                                                                                                                                                        sometimes

                                                                                                                                                                                                                                                                                        Applies the given function with a 50% chance

                                                                                                                                                                                                                                                                                        • function (function): the transformation to apply
                                                                                                                                                                                                                                                                                        s("hh*8").sometimes(x=>x.speed("0.5"))

                                                                                                                                                                                                                                                                                        sometimesBy

                                                                                                                                                                                                                                                                                        Randomly applies the given function by the given probability. Similar to someCyclesBy

                                                                                                                                                                                                                                                                                        • probability (number|Pattern): a number between 0 and 1
                                                                                                                                                                                                                                                                                        • function (function): the transformation to apply
                                                                                                                                                                                                                                                                                        s("hh*8").sometimesBy(.4, x=>x.speed("0.5"))

                                                                                                                                                                                                                                                                                        sortHapsByPart

                                                                                                                                                                                                                                                                                        Returns a new pattern, which returns haps sorted in temporal order. Mainly of use when comparing two patterns for equality, in tests.

                                                                                                                                                                                                                                                                                          soundAlias

                                                                                                                                                                                                                                                                                          Register an alias for a sound.

                                                                                                                                                                                                                                                                                          • original (string): The original sound name
                                                                                                                                                                                                                                                                                          • alias (string): The alias to use for the sound

                                                                                                                                                                                                                                                                                          source

                                                                                                                                                                                                                                                                                          Synonyms: src

                                                                                                                                                                                                                                                                                          Define a custom webaudio node to use as a sound source.

                                                                                                                                                                                                                                                                                          • getSource (function):

                                                                                                                                                                                                                                                                                          spectrum

                                                                                                                                                                                                                                                                                          Renders a spectrum analyzer for the incoming audio signal.

                                                                                                                                                                                                                                                                                          • config (object): optional config with options:
                                                                                                                                                                                                                                                                                          • thickness (number): line thickness in px (default 3)
                                                                                                                                                                                                                                                                                          • speed (number): scroll speed (default 1)
                                                                                                                                                                                                                                                                                          • min (number): min db (default -80)
                                                                                                                                                                                                                                                                                          • max (number): max db (default 0)
                                                                                                                                                                                                                                                                                          n("<0 4 <2 3> 1>*3")
                                                                                                                                                                                                                                                                                          .off(1/8, add(n(5)))
                                                                                                                                                                                                                                                                                          .off(1/5, add(n(7)))
                                                                                                                                                                                                                                                                                          .scale("d3:minor:pentatonic")
                                                                                                                                                                                                                                                                                          .s('sine')
                                                                                                                                                                                                                                                                                          .dec(.3).room(.5)
                                                                                                                                                                                                                                                                                          ._spectrum()

                                                                                                                                                                                                                                                                                          speed

                                                                                                                                                                                                                                                                                          Changes the speed of sample playback, i.e. a cheap way of changing pitch.

                                                                                                                                                                                                                                                                                          • speed (number|Pattern): inf to inf, negative numbers play the sample backwards.
                                                                                                                                                                                                                                                                                          s("bd*6").speed("1 2 4 1 -2 -4")
                                                                                                                                                                                                                                                                                          speed("1 1.5*2 [2 1.1]").s("piano").clip(1)

                                                                                                                                                                                                                                                                                          spiral

                                                                                                                                                                                                                                                                                          Displays a spiral visual.

                                                                                                                                                                                                                                                                                          • options (object): Object containing all the optional following parameters as key value pairs:
                                                                                                                                                                                                                                                                                          • options.stretch (number): controls the rotations per cycle ratio, where 1 = 1 cycle / 360 degrees
                                                                                                                                                                                                                                                                                          • options.size (number): the diameter of the spiral
                                                                                                                                                                                                                                                                                          • options.thickness (number): line thickness
                                                                                                                                                                                                                                                                                          • options.cap (string): style of line ends: butt (default), round, square
                                                                                                                                                                                                                                                                                          • options.inset (string): number of rotations before spiral starts (default 3)
                                                                                                                                                                                                                                                                                          • options.playheadColor (string): color of playhead, defaults to white
                                                                                                                                                                                                                                                                                          • options.playheadLength (number): length of playhead in rotations, defaults to 0.02
                                                                                                                                                                                                                                                                                          • options.playheadThickness (number): thickness of playheadrotations, defaults to thickness
                                                                                                                                                                                                                                                                                          • options.padding (number): space around spiral
                                                                                                                                                                                                                                                                                          • options.steady (number): steadyness of spiral vs playhead. 1 = spiral doesn't move, playhead does.
                                                                                                                                                                                                                                                                                          • options.activeColor (number): color of active segment. defaults to foreground of theme
                                                                                                                                                                                                                                                                                          • options.inactiveColor (number): color of inactive segments. defaults to gutterForeground of theme
                                                                                                                                                                                                                                                                                          • options.colorizeInactive (boolean): wether or not to colorize inactive segments, defaults to 0
                                                                                                                                                                                                                                                                                          • options.fade (boolean): wether or not past and future should fade out. defaults to 1
                                                                                                                                                                                                                                                                                          • options.logSpiral (boolean): wether or not the spiral should be logarithmic. defaults to 0
                                                                                                                                                                                                                                                                                          note("c2 a2 eb2")
                                                                                                                                                                                                                                                                                          .euclid(5,8)
                                                                                                                                                                                                                                                                                          .s('sawtooth')
                                                                                                                                                                                                                                                                                          .lpenv(4).lpf(300)
                                                                                                                                                                                                                                                                                          ._spiral({ steady: .96 })

                                                                                                                                                                                                                                                                                          splice

                                                                                                                                                                                                                                                                                          Works the same as slice, but changes the playback speed of each slice to match the duration of its step.

                                                                                                                                                                                                                                                                                            samples('github:tidalcycles/dirt-samples')
                                                                                                                                                                                                                                                                                            s("breaks165")
                                                                                                                                                                                                                                                                                            .splice(8,  "0 1 [2 3 0]@2 3 0@2 7")

                                                                                                                                                                                                                                                                                            splitQueries

                                                                                                                                                                                                                                                                                            Returns a new pattern, with queries split at cycle boundaries. This makes some calculations easier to express, as all haps are then constrained to happen within a cycle.

                                                                                                                                                                                                                                                                                              spread

                                                                                                                                                                                                                                                                                              Set the stereo pan spread for supported oscillators

                                                                                                                                                                                                                                                                                              • spread (number|Pattern): between 0 and 1
                                                                                                                                                                                                                                                                                              note("d f a a# a d3").fast(2).s("supersaw").spread("<0 .3 1>")

                                                                                                                                                                                                                                                                                              square

                                                                                                                                                                                                                                                                                              A square signal between 0 and 1.

                                                                                                                                                                                                                                                                                                n(square.segment(4).range(0,7)).scale("C:minor")

                                                                                                                                                                                                                                                                                                square2

                                                                                                                                                                                                                                                                                                A square signal between -1 and 1 (like square, but bipolar).

                                                                                                                                                                                                                                                                                                  squeeze

                                                                                                                                                                                                                                                                                                  Pick from the list of values (or patterns of values) via the index using the given pattern of integers. The selected pattern will be compressed to fit the duration of the selecting event

                                                                                                                                                                                                                                                                                                  • pat (Pattern):
                                                                                                                                                                                                                                                                                                  • xs (*):
                                                                                                                                                                                                                                                                                                  note(squeeze("<0@2 [1!2] 2>", ["g a", "f g f g" , "g a c d"]))

                                                                                                                                                                                                                                                                                                  stack

                                                                                                                                                                                                                                                                                                  Synonyms: polyrhythm, pr

                                                                                                                                                                                                                                                                                                  The given items are played at the same time at the same length.

                                                                                                                                                                                                                                                                                                  • pats (any):
                                                                                                                                                                                                                                                                                                  stack("g3", "b3", ["e4", "d4"]).note()
                                                                                                                                                                                                                                                                                                  // "g3,b3,[e4 d4]".note()
                                                                                                                                                                                                                                                                                                  // As a chained function:
                                                                                                                                                                                                                                                                                                  s("hh*4").stack(
                                                                                                                                                                                                                                                                                                    note("c4(5,8)")
                                                                                                                                                                                                                                                                                                  )

                                                                                                                                                                                                                                                                                                  stackCenter

                                                                                                                                                                                                                                                                                                  Synonyms: stackCentre

                                                                                                                                                                                                                                                                                                  The input patterns are aligned to the right, with silence padded to the shorter pattern(s) in the initial steps if there's a stepcount disparity. See also stackLeft and stackRight

                                                                                                                                                                                                                                                                                                  • pats (any):
                                                                                                                                                                                                                                                                                                  stackCenter("0 1 2 3", "3 4", "[4 5 6] 7 8 9 10").scale("c:minor").note()
                                                                                                                                                                                                                                                                                                  // chainable
                                                                                                                                                                                                                                                                                                  "0 1 2 3".stackCenter("3 4", "[4 5 6] 7 8 9 10").scale("c:minor").note()

                                                                                                                                                                                                                                                                                                  stackLeft

                                                                                                                                                                                                                                                                                                  The input patterns are aligned to the left, with silence padded to the shorter pattern(s) in the final steps if there's a stepcount disparity. See also stackRight and stackCenter/stackCentre

                                                                                                                                                                                                                                                                                                  • pats (any):
                                                                                                                                                                                                                                                                                                  stackLeft("0 1 2 3", "3 4", "[4 5 6] 7 8 9 10").scale("c:minor").note()
                                                                                                                                                                                                                                                                                                  // chainable
                                                                                                                                                                                                                                                                                                  "0 1 2 3".stackLeft("3 4", "[4 5 6] 7 8 9 10").scale("c:minor").note()

                                                                                                                                                                                                                                                                                                  stackRepeat

                                                                                                                                                                                                                                                                                                  Shorthand for pm(patterns).pace(m) where m is the max step count in the input patterns

                                                                                                                                                                                                                                                                                                  • pats (any):
                                                                                                                                                                                                                                                                                                  stackRepeat("0 1 2 3", "3 4", "[4 5 6] 7 8 9 10").scale("c:minor").note()
                                                                                                                                                                                                                                                                                                  // chainable
                                                                                                                                                                                                                                                                                                  "0 1 2 3".stackRepeat("3 4", "[4 5 6] 7 8 9 10").scale("c:minor").note()

                                                                                                                                                                                                                                                                                                  stackRight

                                                                                                                                                                                                                                                                                                  The input patterns are aligned to the right, with silence padded to the shorter pattern(s) in the initial steps if there's a stepcount disparity. See also stackLeft and stackCenter/stackCentre

                                                                                                                                                                                                                                                                                                  • pats (any):
                                                                                                                                                                                                                                                                                                  stackRight("0 1 2 3", "3 4", "[4 5 6] 7 8 9 10").scale("c:minor").note()
                                                                                                                                                                                                                                                                                                  // chainable
                                                                                                                                                                                                                                                                                                  "0 1 2 3".stackRight("3 4", "[4 5 6] 7 8 9 10").scale("c:minor").note()

                                                                                                                                                                                                                                                                                                  stepalt

                                                                                                                                                                                                                                                                                                  Experimental

                                                                                                                                                                                                                                                                                                  Concatenates patterns stepwise, according to an inferred 'steps per cycle'. Similar to stepcat, but if an argument is a list, the whole pattern will alternate between the elements in the list.

                                                                                                                                                                                                                                                                                                  • groups (any):
                                                                                                                                                                                                                                                                                                  stepalt(["bd cp", "mt"], "bd").sound()
                                                                                                                                                                                                                                                                                                  // The same as "bd cp bd mt bd".sound()

                                                                                                                                                                                                                                                                                                  stepcat

                                                                                                                                                                                                                                                                                                  Synonyms: timeCat, timecat

                                                                                                                                                                                                                                                                                                  'Concatenates' patterns like fastcat, but proportional to a number of steps per cycle. The steps can either be inferred from the pattern, or provided as a [length, pattern] pair. Has the alias timecat.

                                                                                                                                                                                                                                                                                                  • timepats (any):
                                                                                                                                                                                                                                                                                                  stepcat([3,"e3"],[1, "g3"]).note()
                                                                                                                                                                                                                                                                                                  // the same as "e3@3 g3".note()
                                                                                                                                                                                                                                                                                                  stepcat("bd sd cp","hh hh").sound()
                                                                                                                                                                                                                                                                                                  // the same as "bd sd cp hh hh".sound()

                                                                                                                                                                                                                                                                                                  stretch

                                                                                                                                                                                                                                                                                                  Changes the pitch of the sample without changing its speed. The frequencies are multiplied by (factor + 1) for positive numbers and by max(factor / 4 + 1, 0) for negative numbers. So tuning up by octaves can be done with 1, 3, 7, ... and tuning down by octaves with -2, -3, -3.5...

                                                                                                                                                                                                                                                                                                  • factor (number|Pattern): between -4 and inf. Positive increases pitch, 0 does nothing, negative decreases the pitch.
                                                                                                                                                                                                                                                                                                  s("gm_flute").stretch("<2 1 0 -2>")

                                                                                                                                                                                                                                                                                                  striate

                                                                                                                                                                                                                                                                                                  Cuts each sample into the given number of parts, triggering progressive portions of each sample at each loop.

                                                                                                                                                                                                                                                                                                    s("numbers:0 numbers:1 numbers:2").striate(6).slow(3)

                                                                                                                                                                                                                                                                                                    stripContext

                                                                                                                                                                                                                                                                                                    Returns a new pattern with the context field of every hap set to an empty object.

                                                                                                                                                                                                                                                                                                      struct

                                                                                                                                                                                                                                                                                                      Applies the given structure to the pattern:

                                                                                                                                                                                                                                                                                                      • args (any):
                                                                                                                                                                                                                                                                                                      note("c,eb,g")
                                                                                                                                                                                                                                                                                                        .struct("x ~ x ~ ~ x ~ x ~ ~ ~ x ~ x ~ ~")
                                                                                                                                                                                                                                                                                                        .slow(2)

                                                                                                                                                                                                                                                                                                      stut

                                                                                                                                                                                                                                                                                                      Deprecated. Like echo, but the last 2 parameters are flipped.

                                                                                                                                                                                                                                                                                                      • times (number): how many times to repeat
                                                                                                                                                                                                                                                                                                      • feedback (number): velocity multiplicator for each iteration
                                                                                                                                                                                                                                                                                                      • time (number): cycle offset between iterations
                                                                                                                                                                                                                                                                                                      s("bd sd").stut(3, .8, 1/6)

                                                                                                                                                                                                                                                                                                      sub

                                                                                                                                                                                                                                                                                                      Like add, but the given numbers are subtracted.

                                                                                                                                                                                                                                                                                                        n("0 2 4".sub("<0 1 2 3>")).scale("C4:minor")
                                                                                                                                                                                                                                                                                                        // See add for more information.

                                                                                                                                                                                                                                                                                                        superimpose

                                                                                                                                                                                                                                                                                                        Superimposes the result of the given function(s) on top of the original pattern:

                                                                                                                                                                                                                                                                                                        • funcs (any):
                                                                                                                                                                                                                                                                                                        "<0 2 4 6 ~ 4 ~ 2 0!3 ~!5>*8"
                                                                                                                                                                                                                                                                                                          .superimpose(x=>x.add(2))
                                                                                                                                                                                                                                                                                                          .scale('C minor').note()

                                                                                                                                                                                                                                                                                                        sustain

                                                                                                                                                                                                                                                                                                        Synonyms: sus

                                                                                                                                                                                                                                                                                                        Amplitude envelope sustain level: The level which is reached after attack / decay, being sustained until the offset.

                                                                                                                                                                                                                                                                                                        • gain (number|Pattern): sustain level between 0 and 1
                                                                                                                                                                                                                                                                                                        note("c3 e3 f3 g3").decay(.2).sustain("<0 .1 .4 .6 1>")

                                                                                                                                                                                                                                                                                                        swing

                                                                                                                                                                                                                                                                                                        Shorthand for swingBy with 1/3:

                                                                                                                                                                                                                                                                                                        • subdivision (number):
                                                                                                                                                                                                                                                                                                        s("hh*8").swing(4)
                                                                                                                                                                                                                                                                                                        // s("hh*8").swingBy(1/3, 4)

                                                                                                                                                                                                                                                                                                        swingBy

                                                                                                                                                                                                                                                                                                        The function swingBy x n breaks each cycle into n slices, and then delays events in the second half of each slice by the amount x, which is relative to the size of the (half) slice. So if x is 0 it does nothing, 0.5 delays for half the note duration, and 1 will wrap around to doing nothing again. The end result is a shuffle or swing-like rhythm

                                                                                                                                                                                                                                                                                                        • subdivision (number):
                                                                                                                                                                                                                                                                                                        • offset (number):
                                                                                                                                                                                                                                                                                                        s("hh*8").swingBy(1/3, 4)

                                                                                                                                                                                                                                                                                                        sysex

                                                                                                                                                                                                                                                                                                        MIDI sysex: Sends a MIDI sysex message.

                                                                                                                                                                                                                                                                                                        • id (number|Pattern): Sysex ID
                                                                                                                                                                                                                                                                                                        • data (number|Pattern): Sysex data
                                                                                                                                                                                                                                                                                                        note("c4").sysex(["0x77", "0x01:0x02:0x03:0x04"]).midichan(1).midi()

                                                                                                                                                                                                                                                                                                        sysexdata

                                                                                                                                                                                                                                                                                                        MIDI sysex data: Sends a MIDI sysex message.

                                                                                                                                                                                                                                                                                                        • data (number|Pattern): Sysex data
                                                                                                                                                                                                                                                                                                        note("c4").sysexid("0x77").sysexdata("0x01:0x02:0x03:0x04").midichan(1).midi()

                                                                                                                                                                                                                                                                                                        sysexid

                                                                                                                                                                                                                                                                                                        MIDI sysex ID: Sends a MIDI sysex identifier message.

                                                                                                                                                                                                                                                                                                        • id (number|Pattern): Sysex ID
                                                                                                                                                                                                                                                                                                        note("c4").sysexid("0x77").sysexdata("0x01:0x02:0x03:0x04").midichan(1).midi()

                                                                                                                                                                                                                                                                                                        tables

                                                                                                                                                                                                                                                                                                        Loads a collection of wavetables to use with s

                                                                                                                                                                                                                                                                                                        • url (string):
                                                                                                                                                                                                                                                                                                        • frameLen (*):
                                                                                                                                                                                                                                                                                                        • json (string):
                                                                                                                                                                                                                                                                                                        • options (object):

                                                                                                                                                                                                                                                                                                        tag

                                                                                                                                                                                                                                                                                                        Tags each Hap with an identifier. Good for filtering. The function populates Hap.context.tags (Array).

                                                                                                                                                                                                                                                                                                        • tag (string): anything unique
                                                                                                                                                                                                                                                                                                        s("saw!16").note("F1")
                                                                                                                                                                                                                                                                                                          .lpf(tri.range(40, 80).slow(4)).lpenv(5).lpq(4).lpd(0.15)
                                                                                                                                                                                                                                                                                                          .when(rand.late(0.1).gte(0.5), x => x.transpose("12").tag('altered'))
                                                                                                                                                                                                                                                                                                          .when(rand.late(0.2).gte(0.5), x => x.s("square").tag('altered'))
                                                                                                                                                                                                                                                                                                          .when("<0 1>", x => x.filter((hap) => hap.hasTag('altered')))

                                                                                                                                                                                                                                                                                                        take

                                                                                                                                                                                                                                                                                                        Experimental

                                                                                                                                                                                                                                                                                                        Takes the given number of steps from a pattern (dropping the rest). A positive number will take steps from the start of a pattern, and a negative number from the end.

                                                                                                                                                                                                                                                                                                          "bd cp ht mt".take("2").sound()
                                                                                                                                                                                                                                                                                                          // The same as "bd cp".sound()
                                                                                                                                                                                                                                                                                                          "bd cp ht mt".take("1 2 3").sound()
                                                                                                                                                                                                                                                                                                          // The same as "bd bd cp bd cp ht".sound()
                                                                                                                                                                                                                                                                                                          "bd cp ht mt".take("-1 -2 -3").sound()
                                                                                                                                                                                                                                                                                                          // The same as "mt ht mt cp ht mt".sound()

                                                                                                                                                                                                                                                                                                          time

                                                                                                                                                                                                                                                                                                          A signal representing the cycle time.

                                                                                                                                                                                                                                                                                                            toBipolar

                                                                                                                                                                                                                                                                                                            Assumes a numerical pattern, containing unipolar values in the range 0 ..

                                                                                                                                                                                                                                                                                                            1. Returns a new pattern with values scaled to the bipolar range -1 .. 1

                                                                                                                                                                                                                                                                                                              tour

                                                                                                                                                                                                                                                                                                              Experimental

                                                                                                                                                                                                                                                                                                              Inserts a pattern into a list of patterns. On the first repetition it will be inserted at the end of the list, then moved backwards through the list on successive repetitions. The patterns are added together stepwise, with all repetitions taking place over a single cycle. Using pace to set the number of steps per cycle is therefore usually recommended.

                                                                                                                                                                                                                                                                                                              • pat (Pattern):
                                                                                                                                                                                                                                                                                                              • many (any):
                                                                                                                                                                                                                                                                                                              "[c g]".tour("e f", "e f g", "g f e c").note()
                                                                                                                                                                                                                                                                                                              .sound("folkharp")
                                                                                                                                                                                                                                                                                                              .pace(8)

                                                                                                                                                                                                                                                                                                              transient

                                                                                                                                                                                                                                                                                                              Transient shaper. Gives independent control over the emphasis on transients and sustains

                                                                                                                                                                                                                                                                                                              • attack (number|Pattern): Emphasis on transients; between -1 (deaccentuate) and 1 (accentuate)
                                                                                                                                                                                                                                                                                                              • sustain (number|Pattern): Emphasis on the sustains; between -1 (deaccentuate) and 1 (accentuate)
                                                                                                                                                                                                                                                                                                              s("bd").transient("<-1 -0.5 0 0.5 1>")
                                                                                                                                                                                                                                                                                                              s("hh*16").bank("tr909").transient("<-1:1 1:-1>")

                                                                                                                                                                                                                                                                                                              transpose

                                                                                                                                                                                                                                                                                                              Synonyms: trans

                                                                                                                                                                                                                                                                                                              Change the pitch of each value by the given amount. Expects numbers or note strings as values. The amount can be given as a number of semitones or as a string in interval short notation. If you don't care about enharmonic correctness, just use numbers. Otherwise, pass the interval of the form: ST where S is the degree number and T the type of interval with

                                                                                                                                                                                                                                                                                                              • M = major
                                                                                                                                                                                                                                                                                                              • m = minor
                                                                                                                                                                                                                                                                                                              • P = perfect
                                                                                                                                                                                                                                                                                                              • A = augmented
                                                                                                                                                                                                                                                                                                              • d = diminished

                                                                                                                                                                                                                                                                                                              Examples intervals:

                                                                                                                                                                                                                                                                                                              • 1P = unison
                                                                                                                                                                                                                                                                                                              • 3M = major third
                                                                                                                                                                                                                                                                                                              • 3m = minor third
                                                                                                                                                                                                                                                                                                              • 4P = perfect fourth
                                                                                                                                                                                                                                                                                                              • 4A = augmented fourth
                                                                                                                                                                                                                                                                                                              • 5P = perfect fifth
                                                                                                                                                                                                                                                                                                              • 5d = diminished fifth
                                                                                                                                                                                                                                                                                                              • amount (string|number): Either number of semitones or interval string.
                                                                                                                                                                                                                                                                                                              "c2 c3".fast(2).transpose("<0 -2 5 3>".slow(2)).note()
                                                                                                                                                                                                                                                                                                              "c2 c3".fast(2).transpose("<1P -2M 4P 3m>".slow(2)).note()

                                                                                                                                                                                                                                                                                                              tremolo

                                                                                                                                                                                                                                                                                                              Synonyms: trem

                                                                                                                                                                                                                                                                                                              Modulate the amplitude of a sound with a continuous waveform

                                                                                                                                                                                                                                                                                                              • speed (number|Pattern): modulation speed in HZ
                                                                                                                                                                                                                                                                                                              note("d d d# d".fast(4)).s("supersaw").tremolo("<3 2 100> ").tremoloskew("<.5>")

                                                                                                                                                                                                                                                                                                              tremolodepth

                                                                                                                                                                                                                                                                                                              Synonyms: tremdepth

                                                                                                                                                                                                                                                                                                              Depth of amplitude modulation

                                                                                                                                                                                                                                                                                                              • depth (number|Pattern):
                                                                                                                                                                                                                                                                                                              note("a1 a1 a#1 a1".fast(4)).s("pulse").tremsync(4).tremolodepth("<1 2 .7>")

                                                                                                                                                                                                                                                                                                              tremolophase

                                                                                                                                                                                                                                                                                                              Synonyms: tremphase

                                                                                                                                                                                                                                                                                                              Alter the phase of the modulation waveform

                                                                                                                                                                                                                                                                                                              • offset (number|Pattern): the offset in cycles of the modulation
                                                                                                                                                                                                                                                                                                              note("{f a c e}%16").s("sawtooth").tremsync(4).tremolophase("<0 .25 .66>")

                                                                                                                                                                                                                                                                                                              tremoloshape

                                                                                                                                                                                                                                                                                                              Synonyms: tremshape

                                                                                                                                                                                                                                                                                                              Shape of amplitude modulation

                                                                                                                                                                                                                                                                                                              • shape (number|Pattern): tri | square | sine | saw | ramp
                                                                                                                                                                                                                                                                                                              note("{f g c d}%16").tremsync(4).tremoloshape("<sine tri square>").s("sawtooth")

                                                                                                                                                                                                                                                                                                              tremoloskew

                                                                                                                                                                                                                                                                                                              Synonyms: tremskew

                                                                                                                                                                                                                                                                                                              Alter the shape of the modulation waveform

                                                                                                                                                                                                                                                                                                              • amount (number|Pattern): between 0 &amp; 1, the shape of the waveform
                                                                                                                                                                                                                                                                                                              note("{f a c e}%16").s("sawtooth").tremsync(4).tremoloskew("<.5 0 1>")

                                                                                                                                                                                                                                                                                                              tremolosync

                                                                                                                                                                                                                                                                                                              Synonyms: tremsync

                                                                                                                                                                                                                                                                                                              Modulate the amplitude of a sound with a continuous waveform

                                                                                                                                                                                                                                                                                                              • cycles (number|Pattern): modulation speed in cycles
                                                                                                                                                                                                                                                                                                              note("d d d# d".fast(4)).s("supersaw").tremolosync("4").tremoloskew("<1 .5 0>")

                                                                                                                                                                                                                                                                                                              tri

                                                                                                                                                                                                                                                                                                              A triangle signal between 0 and 1.

                                                                                                                                                                                                                                                                                                                n(tri.segment(8).range(0,7)).scale("C:minor")

                                                                                                                                                                                                                                                                                                                tri2

                                                                                                                                                                                                                                                                                                                A triangle signal between -1 and 1 (like tri, but bipolar).

                                                                                                                                                                                                                                                                                                                  tune

                                                                                                                                                                                                                                                                                                                  Deprecated.

                                                                                                                                                                                                                                                                                                                  Assumes pattern contains numerical scale degrees on the i control (see examples below). Accepts a scale name or list of frequencies (see all available names at the link on the reference). Returns a new pattern with all values mapped to a frequency ratio. Similar to xen.

                                                                                                                                                                                                                                                                                                                  • scale (string|Array.<number>):
                                                                                                                                                                                                                                                                                                                  i("0 1 2 3 4 5").tune("hexany15").mul("220").freq()
                                                                                                                                                                                                                                                                                                                  // You can set your root to be a
                                                                                                                                                                                                                                                                                                                  // particular note with getFreq:
                                                                                                                                                                                                                                                                                                                  i("4 8 9 10 - - 5 7 9 11 - -").tune("tranh3")
                                                                                                                                                                                                                                                                                                                    .mul(getFreq('c3'))
                                                                                                                                                                                                                                                                                                                    .freq().clip(.5).room(1)
                                                                                                                                                                                                                                                                                                                  // You can also give tune a list of
                                                                                                                                                                                                                                                                                                                  // frequencies to use as the scale:
                                                                                                                                                                                                                                                                                                                  i("0 1 2 3 4").tune([
                                                                                                                                                                                                                                                                                                                    261.6255653006,
                                                                                                                                                                                                                                                                                                                    302.72962012827,
                                                                                                                                                                                                                                                                                                                    350.29154279212,
                                                                                                                                                                                                                                                                                                                    405.32593044476,
                                                                                                                                                                                                                                                                                                                    469.00678383895,
                                                                                                                                                                                                                                                                                                                    523.2511306012
                                                                                                                                                                                                                                                                                                                  ]).mul(220).freq();

                                                                                                                                                                                                                                                                                                                  undegrade

                                                                                                                                                                                                                                                                                                                  Inverse of degrade: Randomly removes 50% of events from the pattern. Shorthand for .undegradeBy(0.5) Events that would be removed by degrade are let through by undegrade and vice versa (see second example).

                                                                                                                                                                                                                                                                                                                    s("hh*8").undegrade()
                                                                                                                                                                                                                                                                                                                    s("hh*10").layer(
                                                                                                                                                                                                                                                                                                                      x => x.degrade().pan(0),
                                                                                                                                                                                                                                                                                                                      x => x.undegrade().pan(1)
                                                                                                                                                                                                                                                                                                                    )

                                                                                                                                                                                                                                                                                                                    undegradeBy

                                                                                                                                                                                                                                                                                                                    Inverse of degradeBy: Randomly removes events from the pattern by a given amount. 0 = 100% chance of removal 1 = 0% chance of removal Events that would be removed by degradeBy are let through by undegradeBy and vice versa (see second example).

                                                                                                                                                                                                                                                                                                                    • amount (number): a number between 0 and 1
                                                                                                                                                                                                                                                                                                                    s("hh*8").undegradeBy(0.2)
                                                                                                                                                                                                                                                                                                                    s("hh*10").layer(
                                                                                                                                                                                                                                                                                                                      x => x.degradeBy(0.2).pan(0),
                                                                                                                                                                                                                                                                                                                      x => x.undegradeBy(0.8).pan(1)
                                                                                                                                                                                                                                                                                                                    )

                                                                                                                                                                                                                                                                                                                    unison

                                                                                                                                                                                                                                                                                                                    Set number of stacked voices for supported oscillators.

                                                                                                                                                                                                                                                                                                                    • numvoices (number|Pattern):
                                                                                                                                                                                                                                                                                                                    note("d f a a# a d3").fast(2).s("supersaw").unison("<1 2 7>")

                                                                                                                                                                                                                                                                                                                    useRNG

                                                                                                                                                                                                                                                                                                                    Sets which random number generator to use. Historically Strudel would use useRNG('legacy'), which remains the default. To use a new more statistically precise RNG, try useRNG('precise').

                                                                                                                                                                                                                                                                                                                    • mode (string): One of 'legacy', 'precise'
                                                                                                                                                                                                                                                                                                                    useRNG('legacy')
                                                                                                                                                                                                                                                                                                                    // Repeats every 300 cycles
                                                                                                                                                                                                                                                                                                                    $: n(irand(50)).seg(16).scale("C:minor").ribbon(88, 32)
                                                                                                                                                                                                                                                                                                                    $: n(irand(50)).seg(16).scale("C:minor").ribbon(388, 32)

                                                                                                                                                                                                                                                                                                                    velocity

                                                                                                                                                                                                                                                                                                                    Synonyms: vel

                                                                                                                                                                                                                                                                                                                    Sets the velocity from 0 to 1. Is multiplied together with gain.

                                                                                                                                                                                                                                                                                                                      s("hh*8")
                                                                                                                                                                                                                                                                                                                      .gain(".4!2 1 .4!2 1 .4 1")
                                                                                                                                                                                                                                                                                                                      .velocity(".4 1")

                                                                                                                                                                                                                                                                                                                      vib

                                                                                                                                                                                                                                                                                                                      Synonyms: vibrato, v

                                                                                                                                                                                                                                                                                                                      Applies a vibrato to the frequency of the oscillator.

                                                                                                                                                                                                                                                                                                                      • frequency (number|Pattern): of the vibrato in hertz
                                                                                                                                                                                                                                                                                                                      note("a e")
                                                                                                                                                                                                                                                                                                                      .vib("<.5 1 2 4 8 16>")
                                                                                                                                                                                                                                                                                                                      ._scope()
                                                                                                                                                                                                                                                                                                                      // change the modulation depth with ":"
                                                                                                                                                                                                                                                                                                                      note("a e")
                                                                                                                                                                                                                                                                                                                      .vib("<.5 1 2 4 8 16>:12")
                                                                                                                                                                                                                                                                                                                      ._scope()

                                                                                                                                                                                                                                                                                                                      vibmod

                                                                                                                                                                                                                                                                                                                      Synonyms: vmod

                                                                                                                                                                                                                                                                                                                      Sets the vibrato depth in semitones. Only has an effect if vibrato | vib | v is is also set

                                                                                                                                                                                                                                                                                                                      • depth (number|Pattern): of vibrato (in semitones)
                                                                                                                                                                                                                                                                                                                      note("a e").vib(4)
                                                                                                                                                                                                                                                                                                                      .vibmod("<.25 .5 1 2 12>")
                                                                                                                                                                                                                                                                                                                      ._scope()
                                                                                                                                                                                                                                                                                                                      // change the vibrato frequency with ":"
                                                                                                                                                                                                                                                                                                                      note("a e")
                                                                                                                                                                                                                                                                                                                      .vibmod("<.25 .5 1 2 12>:8")
                                                                                                                                                                                                                                                                                                                      ._scope()

                                                                                                                                                                                                                                                                                                                      voicing

                                                                                                                                                                                                                                                                                                                      Turns chord symbols into voicings. You can use the following control params:

                                                                                                                                                                                                                                                                                                                      • chord: Note, followed by chord symbol, e.g. C Am G7 Bb^7
                                                                                                                                                                                                                                                                                                                      • dict: voicing dictionary to use, falls back to default dictionary
                                                                                                                                                                                                                                                                                                                      • anchor: the note that is used to align the chord
                                                                                                                                                                                                                                                                                                                      • mode: how the voicing is aligned to the anchor
                                                                                                                                                                                                                                                                                                                        • below: top note <= anchor
                                                                                                                                                                                                                                                                                                                        • duck: top note <= anchor, anchor excluded
                                                                                                                                                                                                                                                                                                                        • above: bottom note >= anchor
                                                                                                                                                                                                                                                                                                                        • root: bottom note is the lowest root of the chord >= anchor
                                                                                                                                                                                                                                                                                                                        • oldabove : old (buggy) behavior of above, kept for legacy reason
                                                                                                                                                                                                                                                                                                                        • oldroot : old (buggy) behavior of root, kept for legacy reason
                                                                                                                                                                                                                                                                                                                      • offset: whole number that shifts the voicing up or down to the next voicing
                                                                                                                                                                                                                                                                                                                      • n: if set, the voicing is played like a scale. Overshooting numbers will be octaved

                                                                                                                                                                                                                                                                                                                      All of the above controls are optional, except chord. If you pass a pattern of strings to voicing, they will be interpreted as chords.

                                                                                                                                                                                                                                                                                                                        n("0 1 2 3").chord("<C Am F G>").voicing()

                                                                                                                                                                                                                                                                                                                        voicings

                                                                                                                                                                                                                                                                                                                        DEPRECATED: still works, but it is recommended you use .voicing instead (without s). Turns chord symbols into voicings, using the smoothest voice leading possible. Uses chord-voicings package.

                                                                                                                                                                                                                                                                                                                        • dictionary (string): which voicing dictionary to use.
                                                                                                                                                                                                                                                                                                                        stack("<C^7 A7 Dm7 G7>".voicings('lefthand'), "<C3 A2 D3 G2>").note()

                                                                                                                                                                                                                                                                                                                        vowel

                                                                                                                                                                                                                                                                                                                        Formant filter to make things sound like vowels.

                                                                                                                                                                                                                                                                                                                        • vowel (string|Pattern): You can use a e i o u ae aa oe ue y uh un en an on, corresponding to [a] [e] [i] [o] [u] [æ] [É‘] [ø] [y] [ɯ] [ÊŒ] [œ̃] [ɛ̃] [ɑ̃] [ɔ̃]. Aliases: aa = Ã¥ = É‘, oe = ø = ö, y = ı, ae = æ.
                                                                                                                                                                                                                                                                                                                        note("[c2 <eb2 <g2 g1>>]*2").s('sawtooth')
                                                                                                                                                                                                                                                                                                                        .vowel("<a e i <o u>>")
                                                                                                                                                                                                                                                                                                                        s("bd sd mt ht bd [~ cp] ht lt").vowel("[a|e|i|o|u]")

                                                                                                                                                                                                                                                                                                                        warp

                                                                                                                                                                                                                                                                                                                        Synonyms: wavetableWarp

                                                                                                                                                                                                                                                                                                                        Amount of warp (alteration of the waveform) to apply to the wavetable oscillator

                                                                                                                                                                                                                                                                                                                        • amount (number|Pattern): Warp of the wavetable from 0 to 1
                                                                                                                                                                                                                                                                                                                        s("basique").bank("wt_digital").seg(8).note("F1").warp("0 0.25 0.5 0.75 1")
                                                                                                                                                                                                                                                                                                                          .warpmode("spin")

                                                                                                                                                                                                                                                                                                                        warpattack

                                                                                                                                                                                                                                                                                                                        Synonyms: warpatt

                                                                                                                                                                                                                                                                                                                        Attack time of the wavetable oscillator's warp envelope

                                                                                                                                                                                                                                                                                                                        • time (number|Pattern): attack time in seconds

                                                                                                                                                                                                                                                                                                                        warpdc

                                                                                                                                                                                                                                                                                                                        DC offset of the LFO for the wavetable oscillator's warp

                                                                                                                                                                                                                                                                                                                        • dcoffset (number|Pattern): dc offset. set to 0 for unipolar

                                                                                                                                                                                                                                                                                                                        warpdecay

                                                                                                                                                                                                                                                                                                                        Synonyms: warpdec

                                                                                                                                                                                                                                                                                                                        Decay time of the wavetable oscillator's warp envelope

                                                                                                                                                                                                                                                                                                                        • time (number|Pattern): decay time in seconds

                                                                                                                                                                                                                                                                                                                        warpdepth

                                                                                                                                                                                                                                                                                                                        Depth of the LFO for the wavetable oscillator's warp

                                                                                                                                                                                                                                                                                                                        • depth (number|Pattern): depth of modulation

                                                                                                                                                                                                                                                                                                                        warpenv

                                                                                                                                                                                                                                                                                                                        Amount of envelope applied wavetable oscillator's position envelope

                                                                                                                                                                                                                                                                                                                        • amount (number|Pattern): between 0 and 1

                                                                                                                                                                                                                                                                                                                        warpmode

                                                                                                                                                                                                                                                                                                                        Synonyms: wavetableWarpMode

                                                                                                                                                                                                                                                                                                                        Type of warp (alteration of the waveform) to apply to the wavetable oscillator.

                                                                                                                                                                                                                                                                                                                        The current options are: none, asym, bendp, bendm, bendmp, sync, quant, fold, pwm, orbit, spin, chaos, primes, binary, brownian, reciprocal, wormhole, logistic, sigmoid, fractal, flip

                                                                                                                                                                                                                                                                                                                        • mode (number|string|Pattern): Warp mode
                                                                                                                                                                                                                                                                                                                        s("morgana").bank("wt_digital").seg(8).note("F1").warp("0 0.25 0.5 0.75 1")
                                                                                                                                                                                                                                                                                                                          .warpmode("<asym bendp spin logistic sync wormhole brownian>*2")

                                                                                                                                                                                                                                                                                                                        warprate

                                                                                                                                                                                                                                                                                                                        Rate of the LFO for the wavetable oscillator's warp

                                                                                                                                                                                                                                                                                                                        • rate (number|Pattern): rate in hertz

                                                                                                                                                                                                                                                                                                                        warprelease

                                                                                                                                                                                                                                                                                                                        Synonyms: warprel

                                                                                                                                                                                                                                                                                                                        Release time of the wavetable oscillator's warp envelope

                                                                                                                                                                                                                                                                                                                        • time (number|Pattern): release time in seconds

                                                                                                                                                                                                                                                                                                                        warpshape

                                                                                                                                                                                                                                                                                                                        Shape of the LFO for the wavetable oscillator's warp

                                                                                                                                                                                                                                                                                                                        • shape (number|Pattern): Shape of the lfo (0, 1, 2, ..)

                                                                                                                                                                                                                                                                                                                        warpskew

                                                                                                                                                                                                                                                                                                                        Skew of the LFO for the wavetable oscillator's warp

                                                                                                                                                                                                                                                                                                                        • skew (number|Pattern): How much to bend the LFO shape

                                                                                                                                                                                                                                                                                                                        warpsustain

                                                                                                                                                                                                                                                                                                                        Synonyms: warpsus

                                                                                                                                                                                                                                                                                                                        Sustain time of the wavetable oscillator's warp envelope

                                                                                                                                                                                                                                                                                                                        • gain (number|Pattern): sustain level (0 to 1)

                                                                                                                                                                                                                                                                                                                        warpsync

                                                                                                                                                                                                                                                                                                                        cycle synced rate of the LFO for the wavetable warp position

                                                                                                                                                                                                                                                                                                                        • rate (number|Pattern): rate in cycles

                                                                                                                                                                                                                                                                                                                        wchoose

                                                                                                                                                                                                                                                                                                                        Chooses randomly from the given list of elements by giving a probability to each element

                                                                                                                                                                                                                                                                                                                        • pairs (any): arrays of value and weight
                                                                                                                                                                                                                                                                                                                        note("c2 g2!2 d2 f1").s(wchoose(["sine",10], ["triangle",1], ["bd:6",1]))

                                                                                                                                                                                                                                                                                                                        wchooseCycles

                                                                                                                                                                                                                                                                                                                        Synonyms: wrandcat

                                                                                                                                                                                                                                                                                                                        Picks one of the elements at random each cycle by giving a probability to each element

                                                                                                                                                                                                                                                                                                                        • pairs (any):
                                                                                                                                                                                                                                                                                                                        wchooseCycles(["bd",10], ["hh",1], ["sd",1]).s().fast(8)
                                                                                                                                                                                                                                                                                                                        wchooseCycles(["c c c",5], ["a a a",3], ["f f f",1]).fast(4).note()
                                                                                                                                                                                                                                                                                                                        // The probability can itself be a pattern
                                                                                                                                                                                                                                                                                                                        wchooseCycles(["bd(3,8)","<5 0>"], ["hh hh hh",3]).fast(4).s()

                                                                                                                                                                                                                                                                                                                        when

                                                                                                                                                                                                                                                                                                                        Applies the given function whenever the given pattern is in a true state.

                                                                                                                                                                                                                                                                                                                        • binary_pat (Pattern):
                                                                                                                                                                                                                                                                                                                        • func (function):
                                                                                                                                                                                                                                                                                                                        "c3 eb3 g3".when("<0 1>/2", x=>x.sub("5")).note()

                                                                                                                                                                                                                                                                                                                        whenKey

                                                                                                                                                                                                                                                                                                                        Do something on a keypress, or array of keypresses Key name reference

                                                                                                                                                                                                                                                                                                                          s("bd(5,8)").whenKey("Control:j", x => x.segment(16).color("red")).whenKey("Control:i", x => x.fast(2).color("blue"))

                                                                                                                                                                                                                                                                                                                          withBase

                                                                                                                                                                                                                                                                                                                          Assumes pattern of frequencies tuned to some base frequency, such as the output of xen Because xen defaults to 220Hz, so will withBase. but you can specify a different original base with the standard optional array syntax ':'

                                                                                                                                                                                                                                                                                                                          • base (number):
                                                                                                                                                                                                                                                                                                                          • originalBase (number):
                                                                                                                                                                                                                                                                                                                          i("[0 1 2 3] [3 4] [4 3 2 1]").xen("hexany23").withBase("<220 [300 200]>")
                                                                                                                                                                                                                                                                                                                          mini([1 / 1, 16 / 15, 9 / 8, 6 / 5, 5 / 4].join(' ')).withBase("220:1")
                                                                                                                                                                                                                                                                                                                          // mini([1 / 1, 16 / 15, 9 / 8, 6 / 5, 5 / 4].join(' ')).mul(220).freq()

                                                                                                                                                                                                                                                                                                                          withContext

                                                                                                                                                                                                                                                                                                                          Returns a new pattern with the given function applied to the context field of every hap.

                                                                                                                                                                                                                                                                                                                          • func (function):

                                                                                                                                                                                                                                                                                                                          withHap

                                                                                                                                                                                                                                                                                                                          As with withHaps, but applies the function to every hap, rather than every list of haps.

                                                                                                                                                                                                                                                                                                                          As an end user, you will most likely not need to use this; look at withContext, withHapSpan, etc. instead.

                                                                                                                                                                                                                                                                                                                          • func (function):
                                                                                                                                                                                                                                                                                                                          note("c a f e").withHap(x=>{
                                                                                                                                                                                                                                                                                                                            if (x.value.note == 'c') {
                                                                                                                                                                                                                                                                                                                              x.value.s = 'gm_piano'
                                                                                                                                                                                                                                                                                                                            }
                                                                                                                                                                                                                                                                                                                            else {
                                                                                                                                                                                                                                                                                                                              x.value.s = 'gm_piano'
                                                                                                                                                                                                                                                                                                                              x.value.n = 2
                                                                                                                                                                                                                                                                                                                            }
                                                                                                                                                                                                                                                                                                                            return x
                                                                                                                                                                                                                                                                                                                          })

                                                                                                                                                                                                                                                                                                                          withHaps

                                                                                                                                                                                                                                                                                                                          Returns a new pattern with the given function applied to the list of haps returned by every query.

                                                                                                                                                                                                                                                                                                                          As an end user, you will most likely not need to use this; look at withContext, withHapSpan, etc. instead.

                                                                                                                                                                                                                                                                                                                          • func (function):
                                                                                                                                                                                                                                                                                                                          note("[a b, c d] a b c d").s("gm_piano").withHaps(x=>{
                                                                                                                                                                                                                                                                                                                            if (x.length > 1) {
                                                                                                                                                                                                                                                                                                                              x = x.map(hap => hap.withValue(val => {
                                                                                                                                                                                                                                                                                                                                return {
                                                                                                                                                                                                                                                                                                                                  n: 1,
                                                                                                                                                                                                                                                                                                                                  // select gm_piano:1 sample
                                                                                                                                                                                                                                                                                                                                  ...val
                                                                                                                                                                                                                                                                                                                                }
                                                                                                                                                                                                                                                                                                                              }));
                                                                                                                                                                                                                                                                                                                            }
                                                                                                                                                                                                                                                                                                                            return x
                                                                                                                                                                                                                                                                                                                          })

                                                                                                                                                                                                                                                                                                                          withHapSpan

                                                                                                                                                                                                                                                                                                                          Similar to withQuerySpan, but the function is applied to the timespans of all haps returned by pattern queries (both part timespans, and where present, whole timespans).

                                                                                                                                                                                                                                                                                                                          • func (function):

                                                                                                                                                                                                                                                                                                                          withHapTime

                                                                                                                                                                                                                                                                                                                          As with withHapSpan, but the function is applied to both the begin and end time of the hap timespans.

                                                                                                                                                                                                                                                                                                                          • func (function): the function to apply

                                                                                                                                                                                                                                                                                                                          within

                                                                                                                                                                                                                                                                                                                          Use within to apply a function to only a part of a pattern.

                                                                                                                                                                                                                                                                                                                          • start (number): start within cycle (0 - 1)
                                                                                                                                                                                                                                                                                                                          • end (number): end within cycle (0 - 1). Must be &gt; start
                                                                                                                                                                                                                                                                                                                          • func (function): function to be applied to the sub-pattern

                                                                                                                                                                                                                                                                                                                          withLoc

                                                                                                                                                                                                                                                                                                                          Returns a new pattern with the given location information added to the context of every hap.

                                                                                                                                                                                                                                                                                                                          • start (number): start offset
                                                                                                                                                                                                                                                                                                                          • end (number): end offset

                                                                                                                                                                                                                                                                                                                          withQuerySpan

                                                                                                                                                                                                                                                                                                                          Returns a new pattern, where the given function is applied to the query timespan before passing it to the original pattern.

                                                                                                                                                                                                                                                                                                                          • func (function): the function to apply

                                                                                                                                                                                                                                                                                                                          withQueryTime

                                                                                                                                                                                                                                                                                                                          As with withQuerySpan, but the function is applied to both the begin and end time of the query timespan.

                                                                                                                                                                                                                                                                                                                          • func (function): the function to apply

                                                                                                                                                                                                                                                                                                                          withSeed

                                                                                                                                                                                                                                                                                                                          Modify a pattern by applying a function to the randomSeed control if present

                                                                                                                                                                                                                                                                                                                          • func (function): Function from seed (or undefined) to seed (or undefined)
                                                                                                                                                                                                                                                                                                                          • pat (Pattern): Pattern to update

                                                                                                                                                                                                                                                                                                                          withValue

                                                                                                                                                                                                                                                                                                                          Synonyms: fmap

                                                                                                                                                                                                                                                                                                                          Returns a new pattern, with the function applied to the value of each hap. It has the alias fmap.

                                                                                                                                                                                                                                                                                                                          • func (function): to to apply to the value
                                                                                                                                                                                                                                                                                                                          "0 1 2".withValue(v => v + 10).log()

                                                                                                                                                                                                                                                                                                                          wordfall

                                                                                                                                                                                                                                                                                                                          Displays a vertical pianoroll with event labels. Supports all the same options as pianoroll.

                                                                                                                                                                                                                                                                                                                          • options (object):
                                                                                                                                                                                                                                                                                                                          • options.vertical (number):
                                                                                                                                                                                                                                                                                                                          • options.labels (number):
                                                                                                                                                                                                                                                                                                                          • options.stroke (number):
                                                                                                                                                                                                                                                                                                                          • options.fillActive (number):
                                                                                                                                                                                                                                                                                                                          • options.active (string):

                                                                                                                                                                                                                                                                                                                          worklet

                                                                                                                                                                                                                                                                                                                          Creates a worklet effect. Typically derived by writing K(...) in the REPL which will parse Kabelsalat code.

                                                                                                                                                                                                                                                                                                                          • src (string): Source code of the worklet update function
                                                                                                                                                                                                                                                                                                                          • inputs (number|Pattern): Worklet inputs

                                                                                                                                                                                                                                                                                                                          writeOutputs

                                                                                                                                                                                                                                                                                                                          Write next web audio block from output buffers

                                                                                                                                                                                                                                                                                                                          • outputs (*):

                                                                                                                                                                                                                                                                                                                          wt

                                                                                                                                                                                                                                                                                                                          Synonyms: wavetablePosition

                                                                                                                                                                                                                                                                                                                          Position in the wavetable of the wavetable oscillator

                                                                                                                                                                                                                                                                                                                          • position (number|Pattern): Position in the wavetable from 0 to 1
                                                                                                                                                                                                                                                                                                                          s("wt_digital").seg(8).note("F1").wt("0 0.25 0.5 0.75 1")

                                                                                                                                                                                                                                                                                                                          wtattack

                                                                                                                                                                                                                                                                                                                          Synonyms: wtatt

                                                                                                                                                                                                                                                                                                                          Attack time of the wavetable oscillator's position envelope

                                                                                                                                                                                                                                                                                                                          • time (number|Pattern): attack time in seconds

                                                                                                                                                                                                                                                                                                                          wtdc

                                                                                                                                                                                                                                                                                                                          DC offset of the LFO for the wavetable oscillator's position

                                                                                                                                                                                                                                                                                                                          • dcoffset (number|Pattern): dc offset. set to 0 for unipolar

                                                                                                                                                                                                                                                                                                                          wtdecay

                                                                                                                                                                                                                                                                                                                          Synonyms: wtdec

                                                                                                                                                                                                                                                                                                                          Decay time of the wavetable oscillator's position envelope

                                                                                                                                                                                                                                                                                                                          • time (number|Pattern): decay time in seconds

                                                                                                                                                                                                                                                                                                                          wtdepth

                                                                                                                                                                                                                                                                                                                          Depth of the LFO for the wavetable oscillator's position

                                                                                                                                                                                                                                                                                                                          • depth (number|Pattern): depth of modulation

                                                                                                                                                                                                                                                                                                                          wtenv

                                                                                                                                                                                                                                                                                                                          Amount of envelope applied wavetable oscillator's position envelope

                                                                                                                                                                                                                                                                                                                          • amount (number|Pattern): between 0 and 1

                                                                                                                                                                                                                                                                                                                          wtphaserand

                                                                                                                                                                                                                                                                                                                          Synonyms: wavetablePhaseRand

                                                                                                                                                                                                                                                                                                                          Amount of randomness of the initial phase of the wavetable oscillator.

                                                                                                                                                                                                                                                                                                                          • amount (number|Pattern): Randomness of the initial phase. Between 0 (not random) and 1 (fully random)
                                                                                                                                                                                                                                                                                                                          s("basique").bank("wt_digital").seg(16).wtphaserand("<0 1>")

                                                                                                                                                                                                                                                                                                                          wtrate

                                                                                                                                                                                                                                                                                                                          Rate of the LFO for the wavetable oscillator's position

                                                                                                                                                                                                                                                                                                                          • rate (number|Pattern): rate in hertz

                                                                                                                                                                                                                                                                                                                          wtrelease

                                                                                                                                                                                                                                                                                                                          Synonyms: wtrel

                                                                                                                                                                                                                                                                                                                          Release time of the wavetable oscillator's position envelope

                                                                                                                                                                                                                                                                                                                          • time (number|Pattern): release time in seconds

                                                                                                                                                                                                                                                                                                                          wtshape

                                                                                                                                                                                                                                                                                                                          Shape of the LFO for the wavetable oscillator's position

                                                                                                                                                                                                                                                                                                                          • shape (number|Pattern): Shape of the lfo (0, 1, 2, ..)

                                                                                                                                                                                                                                                                                                                          wtskew

                                                                                                                                                                                                                                                                                                                          Skew of the LFO for the wavetable oscillator's position

                                                                                                                                                                                                                                                                                                                          • skew (number|Pattern): How much to bend the LFO shape

                                                                                                                                                                                                                                                                                                                          wtsustain

                                                                                                                                                                                                                                                                                                                          Synonyms: wtsus

                                                                                                                                                                                                                                                                                                                          Sustain time of the wavetable oscillator's position envelope

                                                                                                                                                                                                                                                                                                                          • gain (number|Pattern): sustain level (0 to 1)

                                                                                                                                                                                                                                                                                                                          wtsync

                                                                                                                                                                                                                                                                                                                          cycle synced rate of the LFO for the wavetable oscillator's position

                                                                                                                                                                                                                                                                                                                          • rate (number|Pattern): rate in cycles

                                                                                                                                                                                                                                                                                                                          xen

                                                                                                                                                                                                                                                                                                                          Assumes a numerical pattern of scale steps, and a scale. Scales accepted are all preset scale names of tune, arbitrary edos such as 31edo, or an array of frequency ratios. Assumes scales repeat at octave (2/1). Returns a new pattern with all values mapped to their associated frequency, assuming a base frequency of 220hz. See first 4 examples for the different ways you can input a scale into xen

                                                                                                                                                                                                                                                                                                                          • scaleNameOrRatios (string|Array.<number>):
                                                                                                                                                                                                                                                                                                                          // A minor triad in 31edo:
                                                                                                                                                                                                                                                                                                                          i("0 8 18").xen("31edo").piano()
                                                                                                                                                                                                                                                                                                                          // You can also use xen with frequency ratios.
                                                                                                                                                                                                                                                                                                                          // This is equivalent to the above:
                                                                                                                                                                                                                                                                                                                          i("0 1 2").xen([
                                                                                                                                                                                                                                                                                                                            Math.pow(2, 0/31),
                                                                                                                                                                                                                                                                                                                            Math.pow(2, 8/31),
                                                                                                                                                                                                                                                                                                                            Math.pow(2, 18/31),
                                                                                                                                                                                                                                                                                                                          ]).piano()
                                                                                                                                                                                                                                                                                                                          // However, with the above you won't get highlighting of the scale indices,
                                                                                                                                                                                                                                                                                                                          // instead you could do something like:
                                                                                                                                                                                                                                                                                                                          i("[<2 ->, 0 1 <- 2> 3]*2").xen([
                                                                                                                                                                                                                                                                                                                            "1:1", // tonic
                                                                                                                                                                                                                                                                                                                            "5:4", // Major 3rd
                                                                                                                                                                                                                                                                                                                            "[3:2 4:3]", // Perfect 5th, 4th
                                                                                                                                                                                                                                                                                                                            "5:3" // Major 6th
                                                                                                                                                                                                                                                                                                                          ]).s("tri")
                                                                                                                                                                                                                                                                                                                          // xen also supports all scale names that
                                                                                                                                                                                                                                                                                                                          // tune does:
                                                                                                                                                                                                                                                                                                                          i("0 1 2 3 4 5").xen("hexany15")
                                                                                                                                                                                                                                                                                                                          // equiv to:
                                                                                                                                                                                                                                                                                                                          // "0 1 2 3 4 5".tune("hexany15").mul("220").freq()
                                                                                                                                                                                                                                                                                                                          i("0 1 2 3 4 5 6 7").xen("<5edo 10edo 15edo hexany15>")

                                                                                                                                                                                                                                                                                                                          xfade

                                                                                                                                                                                                                                                                                                                          Cross-fades between left and right from 0 to 1:

                                                                                                                                                                                                                                                                                                                          • 0 = (full left, no right)
                                                                                                                                                                                                                                                                                                                          • .5 = (both equal)
                                                                                                                                                                                                                                                                                                                          • 1 = (no left, full right)
                                                                                                                                                                                                                                                                                                                          • a (Pattern):
                                                                                                                                                                                                                                                                                                                          • pos (Pattern):
                                                                                                                                                                                                                                                                                                                          • b (Pattern):
                                                                                                                                                                                                                                                                                                                          xfade(s("bd*2"), "<0 .25 .5 .75 1>", s("hh*8"))

                                                                                                                                                                                                                                                                                                                          zip

                                                                                                                                                                                                                                                                                                                          Experimental

                                                                                                                                                                                                                                                                                                                          'zips' together the steps of the provided patterns. This can create a long repetition, taking place over a single, dense cycle. Using pace to set the number of steps per cycle is therefore usually recommended.

                                                                                                                                                                                                                                                                                                                          • pats (any):
                                                                                                                                                                                                                                                                                                                          zip("e f", "e f g", "g [f e] a f4 c").note()
                                                                                                                                                                                                                                                                                                                          .sound("folkharp")
                                                                                                                                                                                                                                                                                                                          .pace(8)

                                                                                                                                                                                                                                                                                                                          zoom

                                                                                                                                                                                                                                                                                                                          Plays a portion of a pattern, specified by the beginning and end of a time span. The new resulting pattern is played over the time period of the original pattern:

                                                                                                                                                                                                                                                                                                                            s("bd*2 hh*3 [sd bd]*2 perc").zoom(0.25, 0.75)
                                                                                                                                                                                                                                                                                                                            // s("hh*3 [sd bd]*2") // equivalent