知识库
特殊 | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | 全部
S |
---|
strudelAPI ReferenceThis is the long list 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! accelerateA pattern of numbers that speed up (or slow down) samples while they play. Currently only supported by osc / superdirt. s("sax").accelerate("<0 1 2 4 8 16>").slow(2).osc() addAssumes 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 "0 2 4".add("<0 3 4 0>").scale('C major').note() // Without add, the equivalent would be: // "<[0 2 4] [3 5 7] [4 6 8] [0 2 4]>".scale('C major').note() // You can also use add with notes: "c3 e3 g3".add("<0 5 7 0>").note() // Behind the scenes, the notes are converted to midi numbers: // "48 52 55".add("<0 5 7 0>").note() addVoicingsAdds a new custom voicing dictionary. 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() almostAlwaysShorthand for s("hh*8").almostAlways(x=>x.speed("0.5")) almostNeverShorthand for s("hh*8").almostNever(x=>x.speed("0.5")) alwaysShorthand for s("hh*8").always(x=>x.speed("0.5")) ampLike {@link gain}, but linear. s("bd*8").amp(".1*2 .5 .1*2 .5 .1 .5").osc() appBothWhen 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 appLeftAs with {@link Pattern#appBoth}, but the applyLike layer, but with a single function: "<c3 eb3 g3>".scale('C minor').apply(scaleTranspose("0,2,4")).note() appRightAs with {@link Pattern#appLeft}, but appWholeAssumes 'this' is a pattern of functions, and given a function to resolve wholes, applies a given pattern of values to that pattern of functions. arpSelects indices in in stacked notes. note("<[c,eb,g]!2 [c,f,ab] [d,f,ab]>") .arp("0 [0,2] 1 [0,2]").slow(2) arpWithSelects indices in in stacked notes. note("<[c,eb,g]!2 [c,f,ab] [d,f,ab]>") .arpWith(haps => haps[2]) arrangeAllows 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. arrange([4, "<c a f e>(3,8)"],[2, "<g a>(5,8)"]).note() attackAmplitude envelope attack time: Specifies how long it takes for the sound to reach its peak value, relative to the onset. note("c3 e3").attack("<0 .1 .5>") bankSelect the sound bank to use. To be used together with s("bd sd").bank('RolandTR909') // = s("RolandTR909_bd RolandTR909_sd") begina pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. samples({ rave: 'rave/AREUREADY.wav' }, 'github:tidalcycles/Dirt-Samples/master/') s("rave").begin("<0 .25 .5 .75>") bpfSets the center frequency of the band-pass filter. When using mininotation, you can also optionally supply the 'bpq' parameter separated by ':'. s("bd sd,hh*3").bpf("<1000 2000 4000 8000>") bpqSets the band-pass q-factor (resonance). s("bd sd").bpf(500).bpq("<0 1 2 3>") brakReturns 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. catAppends the given pattern(s) to the next cycle. s("hh*2").cat( note("c2(3,8)") ) catThe given items are concatenated, where each one takes one cycle. cat(e5, b4, [d5, c5]).note() // "<e5 b4 [d5 c5]>".note() ceilAssumes a numerical pattern. Returns a new pattern with all values set to their mathematical ceiling. E.g. "42 42.1 42.5 43".ceil().note() channelchoose the channel the pattern is sent to in superdirt chooseChooses randomly from the given list of elements. chooseChooses from the given list of values (or patterns of values), according to the pattern that the method is called on. The pattern should be in the range 0 .. 1. choose2As with choose, but the pattern that this method is called on should be in the range -1 .. 1 chooseCyclesPicks one of the elements at random each cycle. chooseCycles("bd", "hh", "sd").s().fast(4) "bd | hh | sd".s().fast(4) chooseInWithAs with {chooseWith}, but the structure comes from the chosen values, rather than the pattern you're using to choose with. chooseWithChoose from the list of values (or patterns of values) using the given pattern of numbers, which should be in the range of 0..1 chopCuts 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(4) // fit sample into 4 cycles chunkDivides 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). "0 1 2 3".chunk(4, x=>x.add(7)).scale('A minor').note() chunkBackLike "0 1 2 3".chunkBack(4, x=>x.add(7)).scale('A minor').note() clipMultiplies the duration with the given number. Also cuts samples off at the end if they exceed the duration. In tidal, this would be done with legato, which has a complicated history in strudel. For now, if you're coming from tidal, just think clip = legato. note("c a f e").s("piano").clip("<.5 1 2>") coarsefake-resampling for lowering the sample rate. Caution: This effect seems to only work in chromium based browsers s("bd sd,hh*4").coarse("<1 4 8 16 32>") compressCompress each cycle into the given timespan, leaving a gap cat( s("bd sd").compress(.25,.75), s("~ bd sd ~") ) cosineA cosine signal between 0 and 1. stack(sine,cosine).segment(16).range(0,15).slow(2).scale('C minor').note() cpmPlays the pattern at the given cycles per minute. s("<bd sd>,hh*2").cpm(90) // = 90 bpm crushbit crusher effect. s("<bd sd>,hh*3").fast(2).crush("<16 8 7 6 5 4 3 2>") csoundmSends 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. cutIn the style of classic drum-machines, s("rd*4").cut(1) decayAmplitude 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. note("c3 e3").decay("<.1 .2 .3 .4>").sustain(0) defragmentHapsCombines adjacent haps with the same value and whole. Only intended for use in tests. degradeRandomly removes 50% of events from the pattern. Shorthand for s("hh*8").degrade() s("[hh?]*8") degradeByRandomly removes events from the pattern by a given amount. 0 = 0% chance of removal 1 = 100% chance of removal s("hh*8").degradeBy(0.2) s("[hh?0.2]*8") delaySets the level of the delay signal. When using mininotation, you can also optionally add the 'delaytime' and 'delayfeedback' parameter, separated by ':'. s("bd").delay("<0 .25 .5 1>") s("bd bd").delay("0.65:0.25:0.9 0.65:0.125:0.7") delayfeedbackSets 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 s("bd").delay(.25).delayfeedback("<.25 .5 .75 1>").slow(2) delaytimeSets the time of the delay effect. s("bd").delay(.25).delaytime("<.125 .25 .5 1>").slow(2) detuneSet detune of oscillators. Works only with some synths, see tidal doc n("0 3 7").s('superzow').octave(3).detune("<0 .25 .5 1 2>").osc() discreteOnlyReturns a new pattern, with 'continuous' haps (those without 'whole' timespans) removed from query results. divDivides each number by the given factor. djfDJ filter, below 0.5 is low pass filter, above is high pass filter. n("0 3 7 [10,24]").s('superzow').octave(3).djf("<.5 .25 .5 .75>").osc() drawLineIntended 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:
const line = drawLine("0 [1 2 3]", 10); // |0--123|0--123 console.log(line); silence; drySet dryness of reverb. See {@link room} and {@link size} for more information about reverb. n("[0,3,7](3,8)").s("superpiano").room(.7).dry("<0 .5 .75 1>").osc() earlyNudge a pattern to start earlier in time. Equivalent of Tidal's <~ operator "bd ~".stack("hh ~".early(.1)).s() echoSuperimpose and offset multiple times, gradually decreasing the velocity s("bd sd").echo(3, 1/6, .8) echoWithSuperimpose and offset multiple times, applying the given function each time. "<0 [2 4]>" .echoWith(4, 1/8, (p,n) => p.add(n*2)) .scale('C minor').note().clip(.2) endThe same as .begin, but cuts off the end off each sample. s("bd*2,oh*4").end("<.1 .2 .5 1>") euclidChanges the structure of the pattern to form an euclidean rhythm. Euclidian rhythms are rhythms obtained using the greatest common divisor of two numbers. They were described in 2004 by Godfried Toussaint, a canadian computer scientist. Euclidian rhythms are really useful for computer/algorithmic music because they can describe a large number of rhythms with a couple of numbers. // The Cuban tresillo pattern. note("c3").euclid(3,8) euclidLegatoSimilar to n("g2").decay(.1).sustain(.3).euclidLegato(3,8) euclidRotLike // A Samba rhythm necklace from Brazil note("c3").euclidRot(3,16,14) everyAn alias for {@link firstOf} note("c3 d3 e3 g3").every(4, x=>x.rev()) fastSpeed up a pattern by the given factor. Used by "*" in mini notation. s("<bd sd> hh").fast(2) // s("[<bd sd> hh]*2") fastGapspeeds 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) filterHapsReturns a new Pattern, which only returns haps that meet the given test. filterValuesAs with {@link Pattern#filterHaps}, but the function is applied to values inside haps. firstCycleQueries the pattern for the first cycle, returning Haps. Mainly of use when debugging a pattern. firstCycleValuesAccessor for a list of values returned by querying the first cycle. firstOfApplies the given function every n cycles, starting from the first cycle. note("c3 d3 e3 g3").firstOf(4, x=>x.rev()) floorAssumes a numerical pattern. Returns a new pattern with all values set to their mathematical floor. E.g. "42 42.1 42.5 43".floor().note() fmapsee {@link Pattern#withValue} focusSimilar 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) freqSet frequency of sound. freq("220 110 440 110").s("superzow").osc() freq("110".mul.out(".5 1.5 .6 [2 3]")).s("superzow").osc() fromBipolarAssumes a numerical pattern, containing bipolar values in the range -1 .. 1 Returns a new pattern with values scaled to the unipolar range 0 .. 1 gainControls the gain by an exponential amount. s("hh*8").gain(".4!2 1 .4!2 1 .4 1") hpfApplies the cutoff frequency of the high-pass filter. When using mininotation, you can also optionally add the 'hpq' parameter, separated by ':'. s("bd sd,hh*4").hpf("<4000 2000 1000 500 200 100>") s("bd sd,hh*4").hpf("<2000 2000:25>") hpqControls the high-pass q-value. s("bd sd,hh*4").hpf(2000).hpq("<0 10 20 30>") hurryBoth speeds up the pattern (like 'fast') and the sample playback (like 'speed'). s("bd sd:2").hurry("<1 2 4 3>").slow(1.5) hushSilences a pattern. stack( s("bd").hush(), s("hh*3") ) insideCarries 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() invertSwaps 1s and 0s in a binary pattern. s("bd").struct("1 0 0 1 0 0 1 0".lastOf(4, invert)) irandA continuous pattern of random integers, between 0 and n-1. // randomly select scale notes from 0 - 7 (= C to C) irand(8).struct("x(3,8)").scale('C minor').note() iterDivides 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) iterBackLike note("0 1 2 3".scale('A minor')).iterBack(4) juxThe jux function creates strange stereo effects, by applying a function to a pattern, but only in the right-hand channel. s("lt ht mt ht hh").jux(rev) juxByJux with adjustable stereo width. 0 = mono, 1 = full stereo. s("lt ht mt ht hh").juxBy("<0 .5 1>/2", rev) lastOfApplies the given function every n cycles, starting from the last cycle. note("c3 d3 e3 g3").lastOf(4, x=>x.rev()) lateNudge a pattern to start later in time. Equivalent of Tidal's ~> operator "bd ~".stack("hh ~".late(.1)).s() layerLayers the result of the given function(s). Like {@link Pattern.superimpose}, but without the original pattern: "<0 2 4 6 ~ 4 ~ 2 0!3 ~!5>*4" .layer(x=>x.add("0,2")) .scale('C minor').note() legatoa pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. "c4 eb4 g4 bb4".legato("<0.125 .25 .5 .75 1 2 4>") legatoMultiplies the hap duration with the given factor. With samples, note("c3 eb3 g3 c4").legato("<.25 .5 1 2>") leslieEmulation of a Leslie speaker: speakers rotating in a wooden amplified cabinet. n("0,4,7").s("supersquare").leslie("<0 .4 .6 1>").osc() lingerSelects the given fraction of the pattern and repeats that part to fill the remainder of the cycle. s("lt ht mt cp, [hh oh]*2").linger("<1 .5 .25 .125>") loopLoops the sample (from s("bd").loop("<1 2 3 4>").osc() loopAtMakes the sample fit the given number of cycles by changing the speed. samples({ rhodes: 'https://cdn.freesound.org/previews/132/132051_316502-lq.mp3' }) s("rhodes").loopAt(4) loopAtCpsMakes the sample fit the given number of cycles and cps value, by changing the speed. Please note that at some point cps will be given by a global clock and this function will be deprecated/removed. samples({ rhodes: 'https://cdn.freesound.org/previews/132/132051_316502-lq.mp3' }) s("rhodes").loopAtCps(4,1.5).cps(1.5) lpfApplies the cutoff frequency of the low-pass filter. When using mininotation, you can also optionally add the 'lpq' parameter, separated by ':'. s("bd sd,hh*3").lpf("<4000 2000 1000 500 200 100>") s("bd*8").lpf("1000:0 1000:10 1000:20 1000:30") lpqControls the low-pass q-value. s("bd sd,hh*4").lpf(2000).lpq("<0 10 20 30>") lrateRate of modulation / rotation for leslie effect n("0,4,7").s("supersquare").leslie(1).lrate("<1 2 4 8>").osc() lsizePhysical size of the cabinet in meters. Be careful, it might be slightly larger than your computer. Affects the Doppler amount (pitch warble) n("0,4,7").s("supersquare").leslie(1).lrate(2).lsize("<.1 .5 1>").osc() maskReturns silence when mask is 0 or "~" note("c [eb,g] d [eb,g]").mask("<1 [0 1]>").slow(2) mulMultiplies each number by the given factor. "1 1.5 [1.66, <2 2.33>]".mul(150).freq() nSelects the given index from the sample map. Numbers too high will wrap around. s("bd sd,hh*3").n("<0 1>") neverShorthand for s("hh*8").never(x=>x.speed("0.5")) notePlays the given note name or midi number. A note name consists of
Examples of valid note names: 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") octaveSets the default octave of a synth. n("0,4,7").s('supersquare').octave("<3 4 5 6>").osc() offSuperimposes the function result on top of the original pattern, delayed by the given time. "c3 eb3 g3".off(1/8, x=>x.add(7)).note() oftenShorthand for s("hh*8").often(x=>x.speed("0.5")) onsetsOnlyReturns a new pattern, with all haps without onsets filtered out. A hap with an onset is one with a orbitAn stack( s("hh*3").delay(.5).delaytime(.25).orbit(1), s("~ sd").delay(.5).delaytime(.125).orbit(2) ) oscSends 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 outsideCarries 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() palindromeApplies note("c d e g").palindrome() panSets position in stereo. s("[bd hh]*2").pan("<.5 1 .5 0>") PatternCreate a pattern. As an end user, you will most likely not create a Pattern directly. perlinGenerates a continuous pattern of perlin noise, in the range 0..1. // randomly change the cutoff s("bd sd,hh*4").cutoff(perlin.range(500,2000)) plyThe ply function repeats each event the given number of times. s("bd ~ sd cp").ply("<1 2 3>") polymeterCombines the given lists of patterns with the same pulse. This will create so called polymeters when different sized sequences are used. polymeter(["c", "eb", "g"], ["c2", "g2"]).note() // "{c eb g, c2 g2}".note() polymeterStepsAligns one or more given sequences to the given number of steps per cycle. polymeterSteps(2, ["c", "d", "e", "f", "g", "f", "e", "d"]) .note().stack(s("bd")) // 1 cycle = 1 bd = 2 notes // note("{c d e f g f e d}%2").stack(s("bd")) pressSyncopates a rhythm, by shifting each event halfway into its timespan. stack(s("hh*4"), s("bd mt sd ht").every(4, press) ).slow(2) pressByLike 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) pureA discrete value that repeats once per cycle. pure('e4') // "e4" queryArcQuery haps inside the given time span. const pattern = sequence('a', ['b', 'c']) const haps = pattern.queryArc(0, 1) console.log(haps) silence randA continuous pattern of random numbers, between 0 and 1. // randomly change the cutoff s("bd sd,hh*4").cutoff(rand.range(500,2000)) rand2A continuous pattern of random numbers, between -1 and 1 rangeAssumes 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,hh*4").cutoff(sine.range(500,2000).slow(4)) range2Assumes 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,hh*4").cutoff(sine2.range2(500,2000).slow(4)) rangexAssumes 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,hh*4").cutoff(sine.rangex(500,2000).slow(4)) rarelyShorthand for s("hh*8").rarely(x=>x.speed("0.5")) ratioAllows dividing numbers via list notation using ":". Returns a new pattern with just numbers. ratio("1, 5:4, 3:2").mul(110).freq().s("piano").slow(2) registerRegisters a new pattern method. The method is added to the Pattern class + the standalone function is returned from register. releaseAmplitude envelope release time: The time it takes after the offset to go from sustain level to zero. note("c3 e3 g3 c4").release("<0 .1 .4 .6 1>/2") removeUndefinedsReturns a new pattern, with haps containing undefined values removed from query results. resetResets the pattern to the start of the cycle for each onset of the reset pattern. s("<bd lt> sd, hh*4").reset("<x@3 x(3,8)>") restartRestarts the pattern for each onset of the restart pattern. While reset will only reset the current cycle, restart will start from cycle 0. s("<bd lt> sd, hh*4").restart("<x@3 x(3,8)>") revReverse all haps in a pattern note("c3 d3 e3 g3").rev() ribbonLoops the pattern inside at // Looping a portion of randomness note(irand(8).segment(4).scale('C3 minor')).ribbon(1337, 2) roomSets the level of reverb. When using mininotation, you can also optionally add the 'size' parameter, separated by ':'. s("bd sd").room("<0 .2 .4 .6 .8 1>") s("bd sd").room("<0.9:1 0.9:4>") roomsizeSets the room size of the reverb, see {@link room}. s("bd sd").room(.8).roomsize("<0 1 2 4 8>") rootNotesMaps the chords of the incoming pattern to root notes in the given octave. "<C^7 A7 Dm7 G7>".rootNotes(2).note() roundAssumes a numerical pattern. Returns a new pattern with all values rounded to the nearest integer. "0.5 1.5 2.5".round().scale('C major').note() runA discrete pattern of numbers from 0 to n-1 run(4).scale('C4 major').note() // "0 1 2 3".scale('C4 major').note() sSelect a sound / sample by name. When using mininotation, you can also optionally supply 'n' and 'gain' parameters separated by ':'. s("bd hh") s("bd:0 bd:1 bd:0:0.3 bd:1:1.4") samplesLoads a collection of samples to use with samples('github:tidalcycles/Dirt-Samples/master'); 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") sawA sawtooth signal between 0 and 1. "c3 [eb3,g3] g2 [g3,bb3]".note().clip(saw.slow(4)) saw.range(0,8).segment(8).scale('C major').slow(4).note() scaleTurns numbers into notes in the scale (zero indexed). Also sets scale for other scale operations, like {@link Pattern#scaleTranspose}. A scale consists of a root note (e.g. The root note defaults to octave 3, if no octave number is given. 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).round()) .scale("C:ritusen") .s("folkharp") scaleTransposeTransposes notes inside the scale by the number of steps. Expected to be called on a Pattern which already has a {@link Pattern#scale} "-8 [2,4,6]" .scale('C4 bebop major') .scaleTranspose("<0 -1 -2 -3 -4 -5 -6 -4>") .note() segmentSamples the pattern at a rate of n events per cycle. Useful for turning a continuous pattern into a discrete one. note(saw.range(0,12).segment(24)).add(40) seqAppends the given pattern(s) to the current pattern. s("hh*2").seq( note("c2(3,8)") ) seqLike cat, but the items are crammed into one cycle. seq(e5, b4, [d5, c5]).note() // "e5 b4 [d5 c5]".note() sequenceSee {@link fastcat} setContextReturns a new pattern with the context field set to every hap set to the given value. shapeWave shaping distortion. CAUTION: it might get loud s("bd sd,hh*4").shape("<0 .2 .4 .6 .8>") showFirstCycleMore human-readable version of the {@link Pattern#firstCycleValues} accessor. silenceDoes absolutely nothing.. silence // "~" sineA sine signal between 0 and 1. sine.segment(16).range(0,15).slow(2).scale('C minor').note() sliceChops 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. await samples('github:tidalcycles/Dirt-Samples/master') s("breaks165").slice(8, "0 1 <2 2*2> 3 [4 0] 5 6 7".every(3, rev)).slow(1.5) await samples('github:tidalcycles/Dirt-Samples/master') s("breaks125/2").fit().slice([0,.25,.5,.75], "0 1 1 <2 3>") slowSlow down a pattern over the given number of cycles. Like the "/" operator in mini notation. s("<bd sd> hh").slow(2) // s("[<bd sd> hh]/2") slowcatConcatenation: combines a list of patterns, switching between them successively, one per cycle: synonyms: {@link cat} slowcat(e5, b4, [d5, c5]) slowcatPrimeConcatenation: combines a list of patterns, switching between them successively, one per cycle. Unlike slowcat, this version will skip cycles. someCyclesShorthand for s("hh(3,8)").someCycles(x=>x.speed("0.5")) someCyclesByRandomly applies the given function by the given probability on a cycle by cycle basis. Similar to {@link Pattern#sometimesBy} s("hh(3,8)").someCyclesBy(.3, x=>x.speed("0.5")) sometimesApplies the given function with a 50% chance s("hh*4").sometimes(x=>x.speed("0.5")) sometimesByRandomly applies the given function by the given probability. Similar to {@link Pattern#someCyclesBy} s("hh(3,8)").sometimesBy(.4, x=>x.speed("0.5")) sortHapsByPartReturns a new pattern, which returns haps sorted in temporal order. Mainly of use when comparing two patterns for equality, in tests. sourceDefine a custom webaudio node to use as a sound source. speedChanges the speed of sample playback, i.e. a cheap way of changing pitch. s("bd").speed("<1 2 4 1 -2 -4>") speed("1 1.5*2 [2 1.1]").s("piano").clip(1) splitQueriesReturns 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. squareA square signal between 0 and 1. square.segment(2).range(0,7).scale('C minor').note() squizMade by Calum Gunn. Reminiscent of some weird mixture of filter, ring-modulator and pitch-shifter. The SuperCollider manual defines Squiz as: "A simplistic pitch-raising algorithm. It's not meant to sound natural; its sound is reminiscent of some weird mixture of filter, ring-modulator and pitch-shifter, depending on the input. The algorithm works by cutting the signal into fragments (delimited by upwards-going zero-crossings) and squeezing those fragments in the time domain (i.e. simply playing them back faster than they came in), leaving silences inbetween. All the parameters apart from memlen can be modulated." squiz("2 4/2 6 [8 16]").s("bd").osc() stackStacks the given pattern(s) to the current pattern. s("hh*2").stack( note("c2(3,8)") ) stackThe given items are played at the same time at the same length. stack(g3, b3, [e4, d4]).note() // "g3,b3,[e4,d4]".note() stripContextReturns a new pattern with the context field of every hap set to an empty object. structApplies the given structure to the pattern: note("c3,eb3,g3") .struct("x ~ x ~ ~ x ~ x ~ ~ ~ x ~ x ~ ~") .slow(4) stutDeprecated. Like echo, but the last 2 parameters are flipped. s("bd sd").stut(3, .8, 1/6) subLike add, but the given numbers are subtracted. "0 2 4".sub("<0 1 2 3>").scale('C4 minor').note() // See add for more information. superimposeSuperimposes the result of the given function(s) on top of the original pattern: "<0 2 4 6 ~ 4 ~ 2 0!3 ~!5>*4" .superimpose(x=>x.add(2)) .scale('C minor').note() sustainAmplitude envelope sustain level: The level which is reached after attack / decay, being sustained until the offset. note("c3 e3").decay(.2).sustain("<0 .1 .4 .6 1>") timeCatLike {@link Pattern.seq}, but each step has a length, relative to the whole. timeCat([3,e3],[1, g3]).note() // "e3@3 g3".note() toBipolarAssumes a numerical pattern, containing unipolar values in the range 0 ..
transposeChange 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
Examples intervals:
"c2 c3".fast(2).transpose("<0 -2 5 3>".slow(2)).note() "c2 c3".fast(2).transpose("<1P -2M 4P 3m>".slow(2)).note() triA triangle signal between 0 and 1. tri.segment(8).range(0,7).scale('C minor').note() undegradeByInverse of {@link Pattern#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). s("hh*8").undegradeBy(0.2) unitUsed in conjunction with {@link speed}, accepts values of "r" (rate, default behavior), "c" (cycles), or "s" (seconds). Using speed("1 2 .5 3").s("bd").unit("c").osc() velocitySets 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") voicingTurns chord symbols into voicings. You can use the following control params:
All of the above controls are optional, except voicing("<C Am F G>") n("0 1 2 3 4 5 6 7").chord("<C Am F G>").voicing() voicingsDEPRECATED: 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. stack("<C^7 A7 Dm7 G7>".voicings('lefthand'), "<C3 A2 D3 G2>").note() vowelFormant filter to make things sound like vowels. note("c2 <eb2 <g2 g1>>").s('sawtooth') .vowel("<a e i <o u>>") whenApplies the given function whenever the given pattern is in a true state. "c3 eb3 g3".when("<0 1>/2", x=>x.sub(5)).note() withContextReturns a new pattern with the given function applied to the context field of every hap. withHapAs with {@link Pattern#withHaps}, but applies the function to every hap, rather than every list of haps. withHapsReturns a new pattern with the given function applied to the list of haps returned by every query. withHapSpanSimilar to {@link Pattern#withQuerySpan}, but the function is applied to the timespans of all haps returned by pattern queries (both withHapTimeAs with {@link Pattern#withHapSpan}, but the function is applied to both the begin and end time of the hap timespans. withLocReturns a new pattern with the given location information added to the context of every hap. withQuerySpanReturns a new pattern, where the given function is applied to the query timespan before passing it to the original pattern. withQueryTimeAs with {@link Pattern#withQuerySpan}, but the function is applied to both the begin and end time of the query timespan. withValueReturns a new pattern, with the function applied to the value of each hap. It has the alias {@link Pattern#fmap}. "0 1 2".withValue(v => v + 10).log() zoomPlays 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 | ||
Superformula超级方程式 📖算法说明 ▶️曲线绘制过程演示 超级公式是超椭圆的推广,由 Johan Gielis 在 2000 年左右提出。 Gielis 认为该公式可以用来描述自然界中存在的许多复杂形状和曲线。Gielis 已提交与超级公式生成的模式合成相关的专利申请,该专利于 2020 年 5 月 10 日到期。 在极坐标中,有半径和角度,超级公式为: 通过为参数选择不同的值和可以生成不同的形状。 该公式是对超椭圆进行推广得到的,由丹麦数学家皮特·海因命名并推广。 在以下示例中,每个图上方显示的值应为m、n 1、n 2和n 3。 通过超级公式的球积,可以将公式扩展到 3、4 或n维。例如,通过将两个超级公式r 1和r 2相乘获得3D参数化表面。坐标由以下关系定义: (纬度)在 − π /2 和π /2 之间变化,θ(经度)在 − π和π之间变化。 3D超级公式:a = b = 1;m、n 1、n 2和n 3显示在图片中。 可以通过在超级公式的两项中允许不同的m个参数来概括超级公式。通过替换第一个参数{\displaystyle m}带有y和第二个参数{\displaystyle m}与z : 这允许创建旋转不对称和嵌套结构。在下面的例子中 a, b、和是 1: | |