Skip to content

Instantly share code, notes, and snippets.

@jhw
Last active June 7, 2020 15:17
Show Gist options
  • Save jhw/142a25e7a99c2ff58dd63fdb87089b8b to your computer and use it in GitHub Desktop.
Save jhw/142a25e7a99c2ff58dd63fdb87089b8b to your computer and use it in GitHub Desktop.
Parsing Tidal tutorial samples
bin/
include/
lib/
share/
let b = swap [("bd1", "defult:1"),
("bd2", "defult:2"),
("cp1", "defult:28"),
("cp2", "defult:29"),
("hh1", "defult:51")]
d1 $ stack [s (b $ "[bd1 bd2?]*4") # speed 0.7,
s (b $ "[~ ~ cp1 cp2?]*2") # speed 1.3,
s (b $ "hh1*8") # gain rand # pan rand]
d1 $ silence
d1 $ stack [
degradeBy 0.1 $ s "defult*16" # n (every 3 (rev) (2+run 4)) # speed rand,
degradeBy 0.0 $ s "[~ defult:28]*2" # gain 0.8,
degradeBy 0.8 $ s "defult*8" # n (40+(irand 5))
] # room 0.1 # sz 0.25 # pan rand
d1 $ silence
# https://tidalcycles.org/index.php/Building_up_patterns
d1 $ jux' [id, rev, (# speed 2)] $ every 2 ("<0.25 0.125 0.5>" <~) $ sound "picoib:1*2 [[~ picoib:42] picoib:20:3] picoib:29:1 [picoib:40*2 picoib:45*8]"
# squiz "<1 2.5 2>"
# room 0.1
# sz 0.5
# orbit 1
d1 $ silence
  • virtualenv -p /usr/bin/python3.6 .
  • . bin/activate
  • pip install -U -r requirements.txt
  • {...}
  • deactivate
import lxml.html as html, re
def parse_pre(pre):
class Buf(list):
def __init__(self):
list.__init__(self)
self.spawn()
def spawn(self):
self.append([])
def add(self, expr):
if re.search("d\\d+ \\$", expr):
self.spawn()
self[-1].append(expr)
def flatten(self):
return "\n\n".join(["\n".join(chunk)
for chunk in self
if chunk!=[]])
buf=Buf()
def is_valid(expr):
return expr!=''
for _expr in pre.split("\n"):
expr=re.sub("\\s*d", "d", _expr)
if is_valid(expr):
buf.add(expr)
return buf.flatten()
def interleave_silence(fn):
class Buf(list):
def __init__(self):
list.__init__(self)
def flatten(self):
return "\n\n".join(self)
def add(self, chunk):
self.append(chunk)
head=chunk.split(" ")[0]
if re.search("^d\\d", head):
self.append("%s $ silence" % head)
def wrapped(doc):
buf=Buf()
for chunk in fn(doc).split("\n\n"):
buf.add(chunk)
return buf.flatten()
return wrapped
@interleave_silence
def parse_tutorial(doc):
return ("\n\n".join([parse_pre(pre.text_content())
for pre in doc.xpath("//pre")]))
if __name__=="__main__":
doc=html.fromstring(open("tutorial.html").read())
with open("tutorial.tidal", 'w') as f:
f.write(parse_tutorial(doc))
#!/usr/bin/env bash
export PYTHONPATH=.
(
s.options.numBuffers = 1024 * 256;
s.options.memSize = 8192 * 32;
s.options.maxNodes = 1024 * 32;
s.options.numOutputBusChannels = 2;
s.options.numInputBusChannels = 2;
s.waitForBoot {
~dirt = SuperDirt(2, s);
~dirt.loadSoundFiles;
~dirt.start(57120, 0 ! 12);
};
s.latency = 0.3;
);
(
s.waitForBoot {
~dirt = SuperDirt(2, s);
~dirt.loadSoundFiles("~/samples/*");
s.sync;
~dirt.start(57120, [0, 0]);
};
);
<!DOCTYPE html>
<html class="client-nojs" lang="en-GB" dir="ltr">
<head>
<meta charset="UTF-8"/>
<title>Tutorial - TidalCycles userbase</title>
<script>document.documentElement.className = document.documentElement.className.replace( /(^|\s)client-nojs(\s|$)/, "$1client-js$2" );</script>
<script>(window.RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"Tutorial","wgTitle":"Tutorial","wgCurRevisionId":7536,"wgRevisionId":7536,"wgArticleId":436,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["Pages with syntax highlighting errors","Functions"],"wgBreakFrames":false,"wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"dmy","wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgMonthNamesShort":["","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],"wgRelevantPageName":"Tutorial","wgRelevantArticleId":436,"wgRequestId":"c585d3b5542e1ac894fdc56b","wgCSPNonce":false,"wgIsProbablyEditable":false,"wgRelevantPageIsProbablyEditable":false,"wgRestrictionEdit":[],"wgRestrictionMove":[],"wgMediaViewerOnClick":true,"wgMediaViewerEnabledByDefault":true,"wgWikiEditorEnabledModules":[],"wgULSAcceptLanguageList":["en-gb","en","ru","ru-ru"],"wgULSCurrentAutonym":"British English","wgTranslatePageTranslation":"source"});mw.loader.state({"site.styles":"ready","noscript":"ready","user.styles":"ready","user":"ready","user.options":"ready","user.tokens":"loading","ext.translate":"ready","ext.translate.tag.languages":"ready","ext.pygments":"ready","mediawiki.legacy.shared":"ready","mediawiki.legacy.commonPrint":"ready","mediawiki.toc.styles":"ready","ext.uls.pt":"ready","skins.tweeki.bootstrap.styles":"ready","skins.tweeki.styles":"ready","skins.tweeki.corrections.styles":"ready","skins.tweeki.externallinks.styles":"ready","skins.tweeki.awesome.styles":"ready","skins.tweeki.bootstraptheme.styles":"ready"});mw.loader.implement("user.tokens@0tffind",function($,jQuery,require,module){/*@nomin*/mw.user.tokens.set({"editToken":"+\\","patrolToken":"+\\","watchToken":"+\\","csrfToken":"+\\"});
});RLPAGEMODULES=["site","mediawiki.page.startup","mediawiki.user","mediawiki.page.ready","mediawiki.toc","mediawiki.searchSuggest","ext.uls.init","ext.uls.interface","skins.tweeki.scripts"];mw.loader.load(RLPAGEMODULES);});</script>
<link rel="stylesheet" href="/load.php?debug=false&amp;lang=en-gb&amp;modules=ext.pygments%2Ctranslate%7Cext.translate.tag.languages%7Cext.uls.pt%7Cmediawiki.legacy.commonPrint%2Cshared%7Cmediawiki.toc.styles%7Cskins.tweeki.awesome.styles%7Cskins.tweeki.bootstrap.styles%7Cskins.tweeki.bootstraptheme.styles%7Cskins.tweeki.corrections.styles%7Cskins.tweeki.externallinks.styles%7Cskins.tweeki.styles&amp;only=styles&amp;skin=tweeki"/>
<script async="" src="/load.php?debug=false&amp;lang=en-gb&amp;modules=startup&amp;only=scripts&amp;skin=tweeki"></script>
<meta name="ResourceLoaderDynamicStyles" content=""/>
<meta name="generator" content="MediaWiki 1.32.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="shortcut icon" href="/favicon.ico"/>
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch_desc.php" title="TidalCycles userbase (en)"/>
<link rel="EditURI" type="application/rsd+xml" href="https://tidalcycles.org/api.php?action=rsd"/>
<link rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/"/>
<link rel="alternate" type="application/atom+xml" title="TidalCycles userbase Atom feed" href="/index.php?title=Special:RecentChanges&amp;feed=atom"/>
<!--[if lt IE 9]><script src="/load.php?debug=false&amp;lang=en&amp;modules=html5shiv&amp;only=scripts&amp;skin=tweeki&amp;sync=1"></script><![endif]-->
</head>
<body class="mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Tutorial rootpage-Tutorial skin-tweeki action-view tweeki-animateLayout"> <!-- navbar -->
<div id="mw-navigation" class="navbar navbar-default navbar-fixed-top" role="navigation">
<h2>Navigation menu</h2>
<div id="mw-head" class="navbar-inner">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="/index.php/Welcome" class="navbar-brand">TidalCycles userbase</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="nav"><a href="/index.php/Welcome" id="n-Welcome">TidalCycles</a></li><li class="nav"><a href="http://blog.tidalcycles.org/" id="n-http:.2F.2Fblog.tidalcycles.org.2F" rel="nofollow">News</a></li><li class="nav"><a href="/index.php/Userbase" id="n-Userbase">Documentation</a></li><li class="nav"><a href="/index.php/Showcase" id="n-Showcase">Showcase</a></li><li class="nav"><a href="/index.php/Community" id="n-Community">Community</a></li> </ul>
<ul class="nav navbar-nav navbar-right">
</ul>
<form class="navbar-form navbar-right" action="/index.php" id="searchform">
<div class="form-group"><input type="search" name="search" placeholder="Search" title="Search TidalCycles userbase [f]" accesskey="f" id="searchInput" class="search-query form-control"/><input type="submit" name="go" value="Go" title="Go to a page with this exact name if it exists" id="mw-searchButton" class="searchButton btn hidden"/>
</div>
</form><ul class="nav navbar-nav navbar-right"> </ul>
</div>
</div>
</div>
</div>
<!-- /navbar -->
<div id="mw-page-base"></div>
<div id="mw-head-base"></div>
<a id="top"></a>
<!-- content -->
<div id="contentwrapper" class="user-loggedout not-editable container with-navbar with-navbar-fixed">
<div class="row">
<div class="col-md-offset-0 col-md-9" role="main">
<div class="mw-body" id="content">
<div id="mw-js-message" style="display:none;" lang="en-GB" dir="ltr"></div>
<h1 id="firstHeading" class="firstHeading page-header" lang="en"><span dir="auto">Tutorial</span></h1>
<!-- bodyContent -->
<div id="bodyContent">
<div id="siteSub">From TidalCycles userbase</div>
<div id="contentSub" lang="en-GB" dir="ltr"></div>
<div id="jump-to-nav" class="mw-jump">
Jump to: <a href="#mw-navigation">navigation</a>, <a href="#p-search">search</a>
</div>
<div id="mw-content-text" lang="en" dir="ltr" class="mw-content-ltr"><div class="mw-pt-translate-header noprint nomobile" dir="ltr" lang="en-GB">This page contains <span class="plainlinks"><a rel="nofollow" class="external text" href="https://tidalcycles.org/index.php?title=Tutorial&amp;oldid=5968&amp;diff=7536">changes</a></span> which are not marked for translation.</div><hr/><div class="mw-parser-output"><div class="mw-pt-languages noprint" lang="en-GB" dir="ltr"><div class="mw-pt-languages-label">Other languages:</div><div class="mw-pt-languages-list autonym"><a href="/index.php/Tutorial/de" class="mw-pt-progress mw-pt-progress--stub" title="Tutorial/de (0% translated)" lang="de">Deutsch</a>&#160;• ‎<span class="mw-pt-languages-selected mw-pt-progress mw-pt-progress--complete" lang="en">English</span>&#160;• ‎<a href="/index.php/Tutorial/fr" class="mw-pt-progress mw-pt-progress--stub" title="Guide (0% translated)" lang="fr">français</a>&#160;• ‎<a href="/index.php?title=Special:Translate&amp;group=page-Tutorial&amp;language=zh&amp;task=view" class="new" title="Start translation for this language">中文</a></div></div>
<p>You’ve installed TidalCycles and (Super)Dirt, maybe even made a few sounds, but now you’re ready to get to business and start really learning. This guide will help you get started with simple patterns and walk you through all the way to complex compositions. If you want a super quick run-down of the syntax in patterns check <a href="/index.php?title=Sequence_parser_syntax&amp;action=edit&amp;redlink=1" class="new" title="Sequence parser syntax (page does not exist)">Sequence parser syntax</a>
</p><p>Why not play with the code as you read, running your own experiments by changing the examples, and seeing where they take you?
</p>
<div id="toc" class="toc"><input type="checkbox" role="button" id="toctogglecheckbox" class="toctogglecheckbox" style="display:none" /><div class="toctitle" lang="en-GB" dir="ltr"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
<ul>
<li class="toclevel-1 tocsection-1"><a href="#Creating_Rhythmic_Sequences"><span class="tocnumber">1</span> <span class="toctext">Creating Rhythmic Sequences</span></a>
<ul>
<li class="toclevel-2 tocsection-2"><a href="#Play_a_Single_Sample"><span class="tocnumber">1.1</span> <span class="toctext">Play a Single Sample</span></a></li>
<li class="toclevel-2 tocsection-3"><a href="#Sequences_From_Multiple_Samples"><span class="tocnumber">1.2</span> <span class="toctext">Sequences From Multiple Samples</span></a></li>
<li class="toclevel-2 tocsection-4"><a href="#Playing_More_Than_One_Sequence"><span class="tocnumber">1.3</span> <span class="toctext">Playing More Than One Sequence</span></a></li>
<li class="toclevel-2 tocsection-5"><a href="#What_is_a_Cycle.3F"><span class="tocnumber">1.4</span> <span class="toctext">What is a Cycle?</span></a></li>
</ul>
</li>
<li class="toclevel-1 tocsection-6"><a href="#Silence"><span class="tocnumber">2</span> <span class="toctext">Silence</span></a></li>
<li class="toclevel-1 tocsection-7"><a href="#Patterns_Within_Patterns"><span class="tocnumber">3</span> <span class="toctext">Patterns Within Patterns</span></a>
<ul>
<li class="toclevel-2 tocsection-8"><a href="#Layering_.28Polyrhythms.29_Instead_of_Grouping"><span class="tocnumber">3.1</span> <span class="toctext">Layering (Polyrhythms) Instead of Grouping</span></a></li>
<li class="toclevel-2 tocsection-9"><a href="#Playing_one_step_per_cycle"><span class="tocnumber">3.2</span> <span class="toctext">Playing one step per cycle</span></a></li>
</ul>
</li>
<li class="toclevel-1 tocsection-10"><a href="#Pattern_Repetition_and_Speed"><span class="tocnumber">4</span> <span class="toctext">Pattern Repetition and Speed</span></a>
<ul>
<li class="toclevel-2 tocsection-11"><a href="#Repetition"><span class="tocnumber">4.1</span> <span class="toctext">Repetition</span></a></li>
<li class="toclevel-2 tocsection-12"><a href="#Using_.2A_and_.2F_on_Groups"><span class="tocnumber">4.2</span> <span class="toctext">Using * and / on Groups</span></a></li>
</ul>
</li>
<li class="toclevel-1 tocsection-13"><a href="#Modifying_Sequences_With_Functions"><span class="tocnumber">5</span> <span class="toctext">Modifying Sequences With Functions</span></a>
<ul>
<li class="toclevel-2 tocsection-14"><a href="#Where_are_all_the_functions.3F"><span class="tocnumber">5.1</span> <span class="toctext">Where are all the functions?</span></a></li>
</ul>
</li>
<li class="toclevel-1 tocsection-15"><a href="#Applying_effects_with_control_patterns"><span class="tocnumber">6</span> <span class="toctext">Applying effects with control patterns</span></a>
<ul>
<li class="toclevel-2 tocsection-16"><a href="#Control_values_are_patterns_too"><span class="tocnumber">6.1</span> <span class="toctext">Control values are patterns too</span></a></li>
<li class="toclevel-2 tocsection-17"><a href="#Control_pattern_order"><span class="tocnumber">6.2</span> <span class="toctext">Control pattern order</span></a></li>
<li class="toclevel-2 tocsection-18"><a href="#Modifying_control_values"><span class="tocnumber">6.3</span> <span class="toctext">Modifying control values</span></a></li>
<li class="toclevel-2 tocsection-19"><a href="#Some_Common_Effects"><span class="tocnumber">6.4</span> <span class="toctext">Some Common Effects</span></a></li>
</ul>
</li>
<li class="toclevel-1 tocsection-20"><a href="#Shorthand_for_numerical_patterns"><span class="tocnumber">7</span> <span class="toctext">Shorthand for numerical patterns</span></a></li>
<li class="toclevel-1 tocsection-21"><a href="#Sample_Playback_Speed_.28and_Pitch.29"><span class="tocnumber">8</span> <span class="toctext">Sample Playback Speed (and Pitch)</span></a>
<ul>
<li class="toclevel-2 tocsection-22"><a href="#Play_a_sample_at_multiple_speeds_simultaneously"><span class="tocnumber">8.1</span> <span class="toctext">Play a sample at multiple speeds simultaneously</span></a></li>
<li class="toclevel-2 tocsection-23"><a href="#12-tone_scale_speeds"><span class="tocnumber">8.2</span> <span class="toctext">12-tone scale speeds</span></a></li>
</ul>
</li>
<li class="toclevel-1 tocsection-24"><a href="#Euclidean_Sequences"><span class="tocnumber">9</span> <span class="toctext">Euclidean Sequences</span></a></li>
<li class="toclevel-1 tocsection-25"><a href="#Tempo"><span class="tocnumber">10</span> <span class="toctext">Tempo</span></a></li>
<li class="toclevel-1 tocsection-26"><a href="#The_Run_Function"><span class="tocnumber">11</span> <span class="toctext">The Run Function</span></a></li>
<li class="toclevel-1 tocsection-27"><a href="#.28Algorithmically.29_Selecting_Samples"><span class="tocnumber">12</span> <span class="toctext">(Algorithmically) Selecting Samples</span></a></li>
<li class="toclevel-1 tocsection-28"><a href="#Combining_Types_of_Patterns"><span class="tocnumber">13</span> <span class="toctext">Combining Types of Patterns</span></a></li>
<li class="toclevel-1 tocsection-29"><a href="#Oscillation_with_Continuous_Patterns"><span class="tocnumber">14</span> <span class="toctext">Oscillation with Continuous Patterns</span></a>
<ul>
<li class="toclevel-2 tocsection-30"><a href="#Scaling_Oscillation"><span class="tocnumber">14.1</span> <span class="toctext">Scaling Oscillation</span></a></li>
</ul>
</li>
<li class="toclevel-1 tocsection-31"><a href="#Rests"><span class="tocnumber">15</span> <span class="toctext">Rests</span></a></li>
<li class="toclevel-1 tocsection-32"><a href="#Polymeters"><span class="tocnumber">16</span> <span class="toctext">Polymeters</span></a></li>
<li class="toclevel-1 tocsection-33"><a href="#Shifting_Time"><span class="tocnumber">17</span> <span class="toctext">Shifting Time</span></a></li>
<li class="toclevel-1 tocsection-34"><a href="#Introducing_Randomness"><span class="tocnumber">18</span> <span class="toctext">Introducing Randomness</span></a>
<ul>
<li class="toclevel-2 tocsection-35"><a href="#Random_Decimal_Patterns"><span class="tocnumber">18.1</span> <span class="toctext">Random Decimal Patterns</span></a></li>
<li class="toclevel-2 tocsection-36"><a href="#Random_Integer_Patterns"><span class="tocnumber">18.2</span> <span class="toctext">Random Integer Patterns</span></a></li>
<li class="toclevel-2 tocsection-37"><a href="#Removing_or_.E2.80.9CDegrading.E2.80.9D_Pattern_events"><span class="tocnumber">18.3</span> <span class="toctext">Removing or “Degrading” Pattern events</span></a></li>
</ul>
</li>
<li class="toclevel-1 tocsection-38"><a href="#Creating_Variation_in_Patterns"><span class="tocnumber">19</span> <span class="toctext">Creating Variation in Patterns</span></a></li>
<li class="toclevel-1 tocsection-39"><a href="#Creating_.22Fills.22_and_using_.22const.22"><span class="tocnumber">20</span> <span class="toctext">Creating "Fills" and using "const"</span></a></li>
<li class="toclevel-1 tocsection-40"><a href="#Composing_Multi-Part_Patterns"><span class="tocnumber">21</span> <span class="toctext">Composing Multi-Part Patterns</span></a>
<ul>
<li class="toclevel-2 tocsection-41"><a href="#Concatenating_patterns_in_serial"><span class="tocnumber">21.1</span> <span class="toctext">Concatenating patterns in serial</span></a></li>
<li class="toclevel-2 tocsection-42"><a href="#Playing_patterns_together_in_parallel"><span class="tocnumber">21.2</span> <span class="toctext">Playing patterns together in parallel</span></a></li>
</ul>
</li>
<li class="toclevel-1 tocsection-43"><a href="#Truncating_samples_with_.22cut.22"><span class="tocnumber">22</span> <span class="toctext">Truncating samples with "cut"</span></a></li>
<li class="toclevel-1 tocsection-44"><a href="#Transitions_Between_Patterns"><span class="tocnumber">23</span> <span class="toctext">Transitions Between Patterns</span></a></li>
<li class="toclevel-1 tocsection-45"><a href="#Samples"><span class="tocnumber">24</span> <span class="toctext">Samples</span></a></li>
<li class="toclevel-1 tocsection-46"><a href="#Synths"><span class="tocnumber">25</span> <span class="toctext">Synths</span></a></li>
</ul>
</div>
<h1><span class="mw-headline" id="Creating_Rhythmic_Sequences">Creating Rhythmic Sequences</span></h1>
<h2><span class="mw-headline" id="Play_a_Single_Sample">Play a Single Sample</span></h2>
<p>Tidal provides 16 'connections' to the SuperDirt synthesiser, named from d1 to d16. Here’s a minimal example, that plays a kick drum every cycle:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre> d1 $ sound "bd"</pre></div>
<p>Evaluate the above code in the Atom (or Emacs) editor by pressing Ctrl+Enter. If you want to stop the sound again, look ahead to the section on silence.
</p><p>In the code above, <code class="mw-highlight" dir="ltr">sound</code> tells us we’re making a pattern of sound samples, and <code class="mw-highlight" dir="ltr">"bd"</code> is a pattern that contains a single sound. bd is a sample of a kick drum. Samples live inside the Dirt-Samples folder which came with SuperDirt, and each sub-folder under that corresponds to a sample name (like bd).
</p><p>To find the SuperDirt samples on your system, in the SuperCollider IDE select the File &gt; Open User Support Directory menu item. From there, open downloaded-quarks and finally Dirt-Samples in there. You should find a lot of folders, each one is a sample bank containing standard wav files. Feel free to make new folders and add your own sounds to it, see the <a href="/index.php/Custom_Samples" title="Custom Samples">Custom Samples</a> userbase page for more info.
</p><p>We can pick a different sample in the bd folder by adding a colon (:) then a number. For example, this picks the fourth kick drum (it counts from zero, so :3 gives you the fourth sound in the folder):
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre> d1 $ sound "bd:3"</pre></div>
<p>If you specify a number greater than the number of samples in a folder, then Tidal just “wraps” around back to the first sample again (it starts counting at zero, e.g. in a folder with five samples, “bd:5” would play “bd:0”).
</p><p>It’s also possible to specify the sample number separately:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd" # n "3"</pre></div>
<p>The usefulness of doing this will become apparent later.
</p>
<h2><span class="mw-headline" id="Sequences_From_Multiple_Samples">Sequences From Multiple Samples</span></h2>
<p>Putting things in quotes allows you to define a sequence. For example, the following gives you a pattern of kick drum then snare:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd sd:1"</pre></div>
<p>When you run the code above, you are replacing the previous pattern with another one on-the-fly. Congratulations, you’re live coding.
</p>
<h2><span class="mw-headline" id="Playing_More_Than_One_Sequence">Playing More Than One Sequence</span></h2>
<p>The easiest way to play multiple sequences at the same time is to use two or more connections to the synthesizer:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd sd:1"
d2 $ sound "hh hh hh hh"
d3 $ sound "arpy"</pre></div>
<p>NOTE: each connection must be evaluated separately in your text editor. That is, you must press Ctrl+Enter three times, once for each line above. <i>Make sure that there is a blank line between them each pattern</i>, or Tidal will evaluate them together and get confused (if you want to evaluate just one line, you can press shift-enter).
</p><p>ANOTHER NOTE: If you prefer to refer to patterns by name, rather than by number, you can do that with <code class="mw-highlight" dir="ltr">p</code>, for example:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>p "susan" $ sound "bd sd:1"
p "gerard" $ sound "hh hh hh hh"</pre></div>
<h2><span id="What_is_a_Cycle?"></span><span class="mw-headline" id="What_is_a_Cycle.3F">What is a Cycle?</span></h2>
<p>A cycle is the main “loop” of time in Tidal. The cycle repeats forever in the background, even when you’ve stopped samples from playing. The cycle’s duration always stays the same unless you modify it with setcps, we’ll cover this later. By default, there is one cycle per second.
</p><p>Note that this omniprescent cyclic looping doesn’t necessary constrain you, for example it’s common to stretch a pattern outside of a single loop, and vary patterns from one loop to the next. We’ll see several ways to do this later, as well.
</p><p>All of the samples inside of a pattern get squashed into a single cycle. The patterns below all loop over the same amount of time:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd sd"
d1 $ sound "bd sd hh cp mt arpy drum"
d1 $ sound "bd sd hh cp mt arpy drum odx bd arpy bass2 feel future"</pre></div>
<p>Note how the more steps you add to the pattern, the faster it plays them, in order to fit them all in. No matter how many samples you put in a pattern in this way, they will always be distributed evenly within a single cycle.
</p>
<h1><span class="mw-headline" id="Silence">Silence</span></h1>
<p>At this point you probably want to know how to stop the patterns you started. An empty pattern is defined as silence, so if you want to ‘switch off’ a pattern, you can just set it to that:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 silence</pre></div>
<p>If you want to set all the connections (from d1 to d9) to be silent at once, there’s a single-word shortcut for that:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>hush</pre></div>
<p>You can also isolate a single connection and silence all others with the <code class="mw-highlight" dir="ltr">solo</code> function. You can do this like so:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd"
d2 $ sound "~ cp"
-- run this and only the bd plays
solo 1
-- unsolo it and the cp plays again
unsolo 1</pre></div>
<h1><span class="mw-headline" id="Patterns_Within_Patterns">Patterns Within Patterns</span></h1>
<p>You can use Tidal’s square brackets syntax to create a pattern grouping:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "[bd sd sd] cp"</pre></div>
<p>Square brackets allow several events to be played inside of a single step. You can think of the above pattern as having two steps, with the first step broken down into a subpattern, which has three steps. Practically, this means you can create denser sub-divisions of cycles:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd [sd sd]"
d1 $ sound "bd [sd sd sd]"
d1 $ sound "bd [sd sd sd sd]"
d1 $ sound "[bd bd] [sd sd sd sd]"
d1 $ sound "[bd bd bd] [sd sd]"
d1 $ sound "[bd bd bd bd] [sd]"</pre></div>
<p>You can even nest groups inside groups to create increasingly dense and complex patterns:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "[bd bd] [bd [sd [sd sd] sd] sd]"</pre></div>
<p>A shorthand for this kind of grouping is to place a period . between groups, rather than surrounding them in square brackets. We call this technique ‘marking out feet’. For example these two patterns are equivalent:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd bd . sd sd sd . bd sd"
d1 $ sound "[bd bd] [sd sd sd] [bd sd]"</pre></div>
<p>The former approach is often easier to type, but is a relatively new addition to TidalCycles, and so many examples will use the square brackets.
</p>
<h2><span id="Layering_(Polyrhythms)_Instead_of_Grouping"></span><span class="mw-headline" id="Layering_.28Polyrhythms.29_Instead_of_Grouping">Layering (Polyrhythms) Instead of Grouping</span></h2>
<p>You can also layer up several loops, by using commas to separate the different parts:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "[bd bd bd, sd cp sd cp]"</pre></div>
<p>This would play the sequence bd bd bd at the same time as sd cp sd cp. Note that the first sequence only has three events, and the second one has four. Because tidal ensures both loops fit inside the same cyclic duration, you end up with a polyrhythm.
</p><p>You can layer any number of these subpatterns to create many polyrhythms:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "[bd bd bd, sd cp sd cp, arpy arpy, odx]"</pre></div>
<p>And of course you can use groupings inside of the layers:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "[bd bd bd, [sd sd] cp, arpy [arpy [arpy arpy] arpy arpy], odx]"</pre></div>
<h2><span class="mw-headline" id="Playing_one_step_per_cycle">Playing one step per cycle</span></h2>
<p>To specify a group where only one step is played per cycle, use angle brackets. For example:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd &lt;arpy:1 arpy:2 arpy:3&gt;"</pre></div>
<p>The above will result in the sequence <code>bd arpy:1 bd arpy:2 bd arpy:3</code>, over three cycles.
</p>
<h1><span class="mw-headline" id="Pattern_Repetition_and_Speed">Pattern Repetition and Speed</span></h1>
<h2><span class="mw-headline" id="Repetition">Repetition</span></h2>
<p>There are two short-hand symbols you can use inside patterns to speed things up or slow things down: * and /. You could think of these like multiplication and division.
</p><p>Use the * symbol to make a pattern, or part of a pattern, repeat as many times as you’d like:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd*2"</pre></div>
<p>This is the same as doing <code>d1 $ sound "bd bd"</code>
</p><p>The code above uses *2 to make a sample play twice.
</p><p>You can use the / symbol to make a part of a pattern slow down, or occur less often:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd/2"</pre></div>
<p>The code above uses /2 to make a sample play half as often, or once every 2nd cycle.
</p><p>Using different numbers works as you’d expect:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd*3" -- plays the bd sample three times each cycle
d1 $ sound "bd/3" -- plays the bd samples only once each third cycle</pre></div>
<h2><span id="Using_*_and_/_on_Groups"></span><span class="mw-headline" id="Using_.2A_and_.2F_on_Groups">Using * and / on Groups</span></h2>
<p>You can apply the * and / symbols on groups of patterns:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "[bd sn]*2 cp"
d1 $ sound "[bd sn] cp/2"
d1 $ sound "[[bd sn] cp]*2" -- speeds up the entire pattern by 2
d1 $ sound "[[bd sn] cp]/2" -- slows down the entire pattern by 2</pre></div>
<p>You can also use the symbols on nested groups to create more complex rhythms:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "[bd sn sn*3]/2 [bd sn*3 bd*4]/3"
d1 $ sound "[bd [sn sn]*2]/2 [bd [sn bd]/2]*2"</pre></div>
<h1><span class="mw-headline" id="Modifying_Sequences_With_Functions">Modifying Sequences With Functions</span></h1>
<p>Tidal comes into its own when you start building things up with functions which transform the patterns in various ways.
</p><p>For example, <code>rev</code> reverses a pattern:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ rev (sound "bd*2 [bd [sn sn*2 sn] sn]")</pre></div>
<p>That’s not so exciting, but things get more interesting when this is used in combination with another function. For example every takes three parameters:
a number, a function and a pattern to apply the function to. The number specifies how often the function is applied to the pattern. For example, the
following reverses the pattern every fourth repetition:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ every 4 (rev) (sound "bd*2 [bd [sn sn*2 sn] sn]")</pre></div>
<p>It takes a while to get used to how we’re using parenthesis here. In the previous example, rev takes one parameter, a pattern, and we had to ‘wrap up’ the
pattern sound <code>"[bd bd] [bd [sn [sn sn] sn] sn]"</code> in brackets to pass it to rev. In the above example every takes three parameters: a number,
a function and a pattern. We had to wrap up the pattern as before, but also rev in order to give it to every. This should become clearer with practice.
</p><p>You can also slow down or speed up the playback of a pattern, this makes it a quarter of the speed:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ slow 4 $ sound "bd*2 [bd [sn sn*2 sn] sn]"</pre></div>
<p>And this four times the speed:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ fast 4 $ sound "bd*2 [bd [sn sn*2 sn] sn]"</pre></div>
<p>Note that slow 0.25 would do exactly the same as fast 4.
</p><p>Again, this can be applied selectively:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ every 4 (fast 4) $ sound "bd*2 [bd [sn sn*2 sn] sn]"</pre></div>
<p>Note again the use of parenthesis, around fast 4. This is needed, to group together the function fast with its parameter 4, before being passed as a parameter to the function every.
</p><p>In the examples above, the sound function takes a pattern of sample names, and turns it into a pattern of synthesizer triggers.
This might take a while to fully understand, but the important thing to remember is that “it’s patterns all the way down”.
In this case, this means that you can operate on the inner pattern of sample names, instead of the outer pattern of synthesizer triggers that sound gives you:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound (every 4 (fast 4) "bd*2 [bd [sn sn*2 sn] sn]")</pre></div>
<p>The fast function is also known as density, which is actually the older name, so a lot of examples will use it instead of the
(slightly quicker to type) fast. They do exactly the same thing.
</p>
<h2><span id="Where_are_all_the_functions?"></span><span class="mw-headline" id="Where_are_all_the_functions.3F">Where are all the functions?</span></h2>
<p>There are many types of functions that help you change patterns. Some of them re-order sequences, some alter time, some provide conditional logic, and some can help compose more complex patterns.
</p><p>We’ll introduce many of the core functions in this introduction, and a more complete list of functions available in Tidal can be found on the page.
</p>
<h1><span class="mw-headline" id="Applying_effects_with_control_patterns">Applying effects with control patterns</span></h1>
<p>TidalCycles has a number of effects that you can apply to sounds. Some of them do simple things like change volume, and others do more complex things like add delay or distortion. This is done with what we call <i>control patterns</i>. In fact <code class="mw-highlight" dir="ltr">sound</code> itself creates a control pattern, and we apply effects by combining control patterns together.
</p><p>You can combine control patterns by adding the # operator between them:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd*4" # crush "4"</pre></div>
<p>The above code uses <code class="mw-highlight" dir="ltr">crush</code> to create a bitcrushing control pattern with a value of 4 (which sounds really grungy), and uses <code class="mw-highlight" dir="ltr">#</code> to join that with the <code class="mw-highlight" dir="ltr">sound</code> control pattern.
</p><p>You can combine multiple control patterns together, with the # operator:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd*4" # crush "4" # speed "2"</pre></div>
<p>The code above both bitcrushes and speeds up sample playback (which increases the ‘pitch’).
</p>
<h2><span class="mw-headline" id="Control_values_are_patterns_too">Control values are patterns too</span></h2>
<p>You may notice that the values of effects are specified in double quotes. This means that you can pattern the effect values too:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd*4" # gain "1 0.8 0.5 0.7"</pre></div>
<p>The above <code class="mw-highlight" dir="ltr">gain</code> effect changes how loud the sample is, good for patterns of emphasis as above. Other control patterns follow all the same grouping rules as sound patterns:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd*4 sn*4" # gain "[[1 0.8]*2 [0.5 0.7]]/2"</pre></div>
<p>And you can also apply functions to control patterns:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd*4" # (every 3 (rev) $ gain "1 0.8 0.5 0.7")</pre></div>
<p>Like with the sound example earlier, you must use parenthesis after gain in order to specify a function on the gain pattern.
</p><p>This works too:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd*4" # gain (every 3 (rev) $ "1 0.8 0.5 0.7")</pre></div>
<p>In the above example, <code class="mw-highlight" dir="ltr">every 3 (rev)</code> is being applied to <code class="mw-highlight" dir="ltr">"1 0.8 0.5 0.7"</code>, which is a pattern of numbers. In the example preceding it, the same function was applied to <code class="mw-highlight" dir="ltr">gain "1 0.8 0.5 0.7"</code>, which is a pattern of gain controls. In this case, whether you apply the function before or after the numbers are turned into controls doesn't matter too much, the outcome is exactly the same.
</p>
<h2><span class="mw-headline" id="Control_pattern_order">Control pattern order</span></h2>
<p>You can specify the effect control <i>before</i> the sound control:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ gain "1 0.8 0.5 0.7" # sound "bd"</pre></div>
<p>The order that you put things matters; with <code class="mw-highlight" dir="ltr">#</code>the structure of the pattern is given by the pattern on the <i>left</i>. In this case, only one bd sound is given, but you hear four, because the structure comes from the gain pattern on the left.
</p>
<h2><span class="mw-headline" id="Modifying_control_values">Modifying control values</span></h2>
<p>The # operator is just a shortcut to a longer form of operator called <code class="mw-highlight" dir="ltr">|&gt;</code>. The <code class="mw-highlight" dir="ltr">|&gt;</code> operator is part of a family of operators, and means something special about combining patterns, which we’ll cover shortly. All you need to know right now is that <code class="mw-highlight" dir="ltr">|&gt;</code> is used to combine patterns.
</p><p>You can use <code class="mw-highlight" dir="ltr">|&gt;</code> to combine patterns conditionally:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ every 2 (|&gt; speed "2") $ sound "arpy*4" |&gt; speed "1"</pre></div>
<p>There are other types of operators that allow you to perform arithmetic:
</p>
<pre>|+
|-
|*
|/
</pre>
<p>For example, using <code class="mw-highlight" dir="ltr">|+</code> will perform an addition operation and add to an original value:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ every 2 (|+ speed "1") $ sound "arpy*4" |&gt; speed "1"</pre></div>
<p>The code above results in a speed of “2” every other cycle.
</p><p>The following will multiply values:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ every 2 (|* speed "1.5") $ sound "arpy*4" |&gt; speed "1"</pre></div>
<p>More complex patterns and chaining can be done, and with any effect, of course:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ every 3 (|- note "3") $ every 2 (|+ up "5") $ sound "arpy*4" |&gt; note "0 2 4 5"</pre></div>
<p>It might be worth sticking to just these ways of combining control patterns for now, but if you are curious, you can look into the <a href="/index.php/Combining_pattern_structure" title="Combining pattern structure">others that are available</a>.
</p>
<h2><span class="mw-headline" id="Some_Common_Effects">Some Common Effects</span></h2>
<p>Here is a quick list of some effects you can use in Tidal (the full list is available in the Reference section):
</p>
<ul><li>gain - changes volume, values from 0 to 1</li>
<li>pan - pans sound right and left, values from 0 to 1</li>
<li>shape - a type of amplifier, values from 0 to 1</li>
<li>vowel - a vowel formant filter, values include a, e, i, o, and u</li>
<li>speed - changes playback speed of a sample, see below</li></ul>
<h1><span class="mw-headline" id="Shorthand_for_numerical_patterns">Shorthand for numerical patterns</span></h1>
<p>From version 0.9 of Tidal, there are some nice ways of saving on keypresses when working with numerical patterns.
</p><p>For example, when specifying patterns of single numbers, such as:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "arpy(3,8)" # n "2"</pre></div>
<p>you can miss off the double quotes, so this works fine:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "arpy(3,8)" # n 2</pre></div>
<p>However, if you wanted more than one value in that n pattern, you’d have to put the quotes in:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "arpy(3,8)" # n "2 5"</pre></div>
<p>You can also treat patterns of numbers as simple numbers in other ways. For example doing algebra:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "arpy(3,8)" # n ("0 2" * 2)
d1 $ sound "arpy(3,8)" # n (every 4 (* 2) "0 2")
d1 $ n (off 0.125 (+12) $ off 0.25 (+7) $ slow 2 $ "0(3,8) [5 7]") # sound "supergong"</pre></div>
<p>(The <code class="mw-highlight" dir="ltr">supergong</code> sound requires <code class="mw-highlight" dir="ltr">sc3-plugins</code> to be installed.)
</p><p>This is still quite new to everyone, so you will not see it used much in the documentation yet.
</p><p>You can also now specify increasing or decreasing numbers with a range, for example this:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre> d1 $ n "[0 .. 7] [3 .. 1]" # sound "supergong"</pre></div>
<p>... is shorthand for:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ n "[0 1 2 3 4 5 6 7] [3 2 1]" # sound "supergong"</pre></div>
<h1><span id="Sample_Playback_Speed_(and_Pitch)"></span><span class="mw-headline" id="Sample_Playback_Speed_.28and_Pitch.29">Sample Playback Speed (and Pitch)</span></h1>
<p>You can change the playback speed of a sample in TidalCycles by using the speed effect. You can use speed to change pitches, to create a weird effect, or to match the length of a sample to a specific period of the cycle time (but see the loopAt function for an easy way of doing the latter).
</p><p>You can set a sample’s speed by using the speed effect with a number.
</p>
<ul><li>speed "1" plays a sample at its original speed</li>
<li>speed "0.5" plays a sample at half of its original speed</li>
<li>speed "2" plays a sample at double its original speed</li></ul>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "arpy" # speed "1"
d1 $ sound "arpy" # speed "0.5"
d1 $ sound "arpy" # speed "2"</pre></div>
<p>Just like other effects, you can specify a pattern for speed:
</p>
<pre>d1 $ speed "1 0.5 2 1.5" # sound "arpy"
</pre>
<p>You can also reverse a sample by specifying negative values:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ speed "-1 -0.5 -2 -1.5" # sound "arpy"</pre></div>
<h2><span class="mw-headline" id="Play_a_sample_at_multiple_speeds_simultaneously">Play a sample at multiple speeds simultaneously</span></h2>
<p>Use the pattern grouping syntax with a comma to cause speed to play a sample back at multiple speeds at the same time:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "arpy" # speed "[1, 1.5]"
d1 $ speed "[1 0.5, 1.5 2 3 4]" # sound "arpy"</pre></div>
<h2><span class="mw-headline" id="12-tone_scale_speeds">12-tone scale speeds</span></h2>
<p>You can also use the up function to change playback speed. up is a shortcut effect that matches speeds to half steps on a 12-tone scale. For example, the following plays a chromatic scale:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ up "0 1 2 3 4 5 6 7 8 9 10 11" # sound "arpy"</pre></div>
<p>You can also use the run function to create an incrementing pattern of integers:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ up (run 12) # sound "arpy".</pre></div>
<p>The <code>run</code> function will be discussed later.
</p>
<h1><span class="mw-headline" id="Euclidean_Sequences">Euclidean Sequences</span></h1>
<p>If you give two numbers in parenthesis after an element in a pattern, then Tidal will distribute the first number of sounds equally across the second number of steps:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd(5,8)"</pre></div>
<p>You can also use the <a href="/index.php/euclid" title="euclid">euclid</a> function to do this. <a href="/index.php/euclid" title="euclid">euclid</a> takes the same two arguments as what is used in the parenthesis above:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ euclid 5 8 $ sound "bd"</pre></div>
<p>You can use the parenthesis notation within a single element of a pattern:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd(3,8) sn*2"</pre></div>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd(3,8) sn(5,8)"</pre></div>
<p>You can also add a third parameter, which ‘rotates’ the pattern so it starts on a different step:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd(5,8,2)"</pre></div>
<p>You can also use the euclid function to apply a Euclidean algorithm over a complex pattern, although the structure of that pattern will be lost:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ euclid 3 8 $ sound "bd*2 [sn cp]"</pre></div>
<p>In the above, three sounds are picked from the pattern on the right according to the structure given by the euclid 3 8. It ends up picking two bd sounds, a cp and missing the sn entirely.
</p><p>As a bonus, it is possible to pattern the parameters within the parenthesis, for example to alternate between 3 and 5 elements:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd([5 3]/2,8)"</pre></div>
<p>These types of sequences use “Bjorklund’s algorithm”, which wasn’t made for music but for an application in nuclear physics, which is exciting. More exciting still is that it is very similar in structure to the one of the first known algorithms written in Euclid’s book of elements in 300 BC. You can read more about this in the paper The Euclidean Algorithm Generates Traditional Musical Rhythms by Toussaint. Some examples from this paper are included below, including rotation in some cases.
</p>
<ul><li>(2,5)&#160;: A thirteenth century Persian rhythm called Khafif-e-ramal.</li>
<li>(3,4)&#160;: The archetypal pattern of the Cumbia from Colombia, as well as a Calypso rhythm from Trinidad.</li>
<li>(3,5,2)&#160;: Another thirteenth century Persian rhythm by the name of Khafif-e-ramal, as well as a Rumanian folk-dance rhythm.</li>
<li>(3,7)&#160;: A Ruchenitza rhythm used in a Bulgarian folk-dance.</li>
<li>(3,8)&#160;: The Cuban tresillo pattern.</li>
<li>(4,7)&#160;: Another Ruchenitza Bulgarian folk-dance rhythm.</li>
<li>(4,9)&#160;: The Aksak rhythm of Turkey.</li>
<li>(4,11)&#160;: The metric pattern used by Frank Zappa in his piece titled Outside Now.</li>
<li>(5,6)&#160;: Yields the York-Samai pattern, a popular Arab rhythm.</li>
<li>(5,7)&#160;: The Nawakhat pattern, another popular Arab rhythm.</li>
<li>(5,8)&#160;: The Cuban cinquillo pattern.</li>
<li>(5,9)&#160;: A popular Arab rhythm called Agsag-Samai.</li>
<li>(5,11)&#160;: The metric pattern used by Moussorgsky in Pictures at an Exhibition.</li>
<li>(5,12)&#160;: The Venda clapping pattern of a South African children’s song.</li>
<li>(5,16)&#160;: The Bossa-Nova rhythm necklace of Brazil.</li>
<li>(7,8)&#160;: A typical rhythm played on the Bendir (frame drum).</li>
<li>(7,12)&#160;: A common West African bell pattern.</li>
<li>(7,16,14)&#160;: A Samba rhythm necklace from Brazil.</li>
<li>(9,16)&#160;: A rhythm necklace used in the Central African Republic.</li>
<li>(11,24,14)&#160;: A rhythm necklace of the Aka Pygmies of Central Africa.</li>
<li>(13,24,5)&#160;: Another rhythm necklace of the Aka Pygmies of the upper Sangha.</li></ul>
<h1><span class="mw-headline" id="Tempo">Tempo</span></h1>
<p>If you’ve made it this far without changing the tempo in all these examples, then you’re probably ready to change it up.
</p><p>Tidal’s core unit of time is cycles per second. By default it is set to 0.5625 (or 135 BPM) It can be set with the <code class="mw-highlight" dir="ltr">setcps</code> function:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>setcps 1</pre></div>
<p>You can execute setcps just like a pattern (using Shift+Enter in your editor).
</p><p><code class="mw-highlight" dir="ltr">setcps</code> accepts a positive numeric value that can include a decimal:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>setcps 1.5
setcps 0.75
setcps 10</pre></div>
<p>Tidal’s timing is based on cycles, rather than beats, however it is more common for people to think in terms of beats per minute (BPM). If you prefer to think in this way, you have to decide how many beats you want to have per cycle, and divide accordingly. For example if you wanted to play at 140 bpm, with four beats per cycle, then you could do:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>setcps (140/60/4)</pre></div>
<p>You can also pattern the tempo with the <code class="mw-highlight" dir="ltr">cps</code> control function, for example:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "cp(3,8)"
# cps (slow 8 $ range 0.8 1.6 saw)</pre></div>
<h1><span class="mw-headline" id="The_Run_Function">The Run Function</span></h1>
<p>There is a special utility function called run which will return a pattern of integers up to a specified maximum. You can use run with effects to aid in automatically generating a linear pattern:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "arpy*8" # up (run 8)
d1 $ sound "arpy*8" # speed (run 8)</pre></div>
<p>In the above we’re specifying the number of sounds twice - in the sound pattern as well as the up or speed pattern. There’s actually a neat way of only having to specify this once, simply by switching them round, so the effect parameter is on the left:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ up (run 8) # sound "arpy"</pre></div>
<p>This works because TidalCycles always takes the structure of a pattern from the parameter that’s on the left. We usually want the structure to come from the sound parameter, but not always.
</p><p>Because run returns a pattern, you can apply functions to its result:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "arpy*8" # up (every 2 (rev) $ run 8)</pre></div>
<p>For a more practical example of using run, read below about selecting samples from folders.
</p>
<h1><span id="(Algorithmically)_Selecting_Samples"></span><span class="mw-headline" id=".28Algorithmically.29_Selecting_Samples">(Algorithmically) Selecting Samples</span></h1>
<p>The sound parameter we’ve been using up to now can actually be broken into two separate parameters, making it easy to select samples with a pattern. These parameters are s that gives the name of the sample set, and n which gives the number of the sample within that set. For example, the following two patterns do exactly the same:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "arpy:0 arpy:2 arpy:3"
d1 $ n "0 2 3" # s "arpy"</pre></div>
<p>It’s possible to break the sound parameter into two different patterns, namely s that gives the name of the sample set, and n which gives the index of the sample within that set. For example, the following two patterns are the same:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "arpy:0 arpy:2 arpy:3"
d1 $ n "0 2 3" # s "arpy"</pre></div>
<p>This allows us to separate the sample folder name from the index inside the folder, possibly with surprising results!
</p><p>There is also special function called samples that lets you do the same using the sound parameter.
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound $ samples "drum*4" "0 1 2 3"</pre></div>
<p>the code above is the same as this:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "drum:0 drum:1 drum:2 drum:3"</pre></div>
<p>Whether you use n and s together, or sound with samples is up to you, although you might find the former to be more flexible.
</p><p>Remember the run function? Since run generates a pattern of integers, it can be used with n to automatically “run” through the sample indices of a folder:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ n (run 4) # s "drum"
d1 $ sound $ samples "drum*4" (run 4) -- or with samples</pre></div>
<p>And of course you can specify a different pattern of sample names:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ s "drum arpy cp hh" # n (run 10)</pre></div>
<p>Again, by swapping the order of the s and n parameters, you can hear the difference between taking the structure from one or the other:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ n (run 10) # s "drum arpy cp hh"</pre></div>
<p>NOTE: if you specify a run value that is greater than the number of samples in a folder, then the higher number index will “wrap” to the beginning of the samples in the folder (just like with the colon notation).
</p><p>You might sometimes see the samples function wrapped in parenthesis:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound (samples "drum arpy cp hh" (run 10))</pre></div>
<h1><span class="mw-headline" id="Combining_Types_of_Patterns">Combining Types of Patterns</span></h1>
<p>Ok, remember when we started adding effects:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd sn drum arpy" # pan "0 1 0.25 0.75"</pre></div>
<p>What we’re actually doing in the code above is combining two patterns together: the sound pattern, and the pan pattern. The special pipe operators (|&gt;, |+, |-, |*, |/, |&gt;, and so on), allow us to combine two patterns. Remember that # is shorthand for |&gt;.
</p><p>We can actually swap sides and it sounds the same:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ pan "0 1 0.25 0.75" # sound "bd sn drum arpy"</pre></div>
<p>As we touched on earlier, the main thing to know when combining patterns like this is that the left-most pattern determines the rhythmic structure of the result. Removing one of the elements from the pan pattern on the left results in a cycle with three samples played:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ pan "0 1 0.25" # sound "bd sn drum arpy"</pre></div>
<p>In the code above, the pan pattern determines the rhythm because it is the left-most pattern. The sound pattern now only determines what samples are played at what time. The sound pattern gets mapped onto the pan pattern.
</p><p>You might be wondering how TidalCycles decides which sound values get matched with which pan values in the above. (If not, there is no need to read the rest of this paragraph just now!) The rule is, for each value in the pattern on the left, values from the right are matched where the start (or onset) of the left value, fall within the timespan of the value on the right. For example, the second pan value of 1 starts one third into its pattern, and the second sound value of sn starts one quarter into its pattern, and ends at the halfway point. Because the former onset (one third) falls inside the timespan of the latter timespan (from one quarter until one half), they are matched. The timespan of arpy doesn’t contain any onsets from the pan pattern, and so it doesn’t match with anything, and isn’t played.
</p><p>The rule described above may seem like a lot to keep in mind while composing patterns, but in practice there is no need. Our advice is to not worry, write some patterns and get a feel for how they fit together.
</p><p>Anyway, this composition of pattern parameters allows us to do some unique things:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ up "0 0*2 0*4 1" # sound "[arpy, bass2, bd]"</pre></div>
<p>Above, the sound pattern is merely specifying three samples to play on every note. Both the rhythm and pitch of these notes is defined by the up pattern.
</p><p>It's also possible to switch things around so that structure comes from the right, by using the operators &gt;|, *|, +|, /| and -|, instead of |&gt;, |*, |+ and |-, for example:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "drum" &gt;| n "0 1*2 ~ 3"</pre></div>
<p>The side of the operator that the | is on, is where the structure comes from. In fact, if you put the bar on both sides, structure comes from both sides:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "drum cp" &gt;| n "0 1 2"</pre></div>
<h1><span class="mw-headline" id="Oscillation_with_Continuous_Patterns">Oscillation with Continuous Patterns</span></h1>
<p>So far we’ve only been working with discrete patterns, by which we mean patterns which containing events which begin and end. Tidal also supports continuous patterns which instead vary continually over time. You can create continuous patterns using functions which give sine, saw, triangle, and square waves:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd*16" # pan sine</pre></div>
<p>The code above uses the sine pattern to specify a sine wave oscillation of values between 0 and 1 for the pan values, so the bass drum moves smoothly between the left and right speakers.
</p><p>Tidal used to have sine and sine1 patterns with different ranges, but now they are aliases, with both giving a range from 0 to 1.
</p><p>In addition to the sine pattern, Tidal also has saw, tri, and square, for sawtooth, triangle and square waves respectively.
</p><p>Just like discrete patterns, you can control the speed of continuous patterns with slow or density:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd*16" # pan (slow 8 $ saw)
d1 $ sound "bd*8 sn*8" # pan (density 1.75 $ tri)
d1 $ sound "bd*8 sn*8" # speed (density 2 $ tri)</pre></div>
<p>You can also combine them in different ways:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd*16" # pan (slowcat [sine, saw, square, tri])
d1 $ sound "sn:2*16" # speed ((range 0.5 3 sine) * (slow 4 saw))</pre></div>
<h2><span class="mw-headline" id="Scaling_Oscillation">Scaling Oscillation</span></h2>
<p>You can tell the oscillation functions to scale themselves and oscillate between two values using range:
</p><p>A recent change in tidal repurposed the old scale function to range, to free scale to be used for other purposes.
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd*8 sn*8" # speed (range 1 3 $ tri)
d1 $ sound "bd*8 sn*8" # speed (slow 4 $ range 1 3 $ tri)</pre></div>
<p>You can also scale to negative values, but make sure to wrap negative values in parens (otherwise the interpreter thinks you’re trying to subtract 2 from something):
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd*8 sn*8" # speed (range (-2) 3 $ tri)</pre></div>
<p>This technique works well for a slow low-pass filter cutoff:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "hh*32" # cutoff (range 300 1000 $ slow 4 $ sine) # resonance "0.4"</pre></div>
<p><b>NOTE</b>: Despite the fact that these oscillator patterns produce continuous values, you still need to combine them with discrete sound patterns.
</p>
<h1><span class="mw-headline" id="Rests">Rests</span></h1>
<p>So far we have produced patterns that keep producing more and more sound. What if you want a rest, or gap of silence, in your pattern? You can use the “tilde” ~ character to do so:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd bd ~ bd"</pre></div>
<p>Think of the <code>~</code> as an ‘empty’ step in a sequence, that just produces silence.
</p>
<h1><span class="mw-headline" id="Polymeters">Polymeters</span></h1>
<p>We talked about polyrhythms earlier, but Tidal can also produce polymeter sequences. A polymeter pattern is one where two patterns have different sequence lengths, but share the same pulse or tempo.
</p><p>You use curly brace syntax to create a polymeter rhythm:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "{bd hh sn cp, arpy bass2 drum notes can}"</pre></div>
<p>The code above results in a five-note rhythm being played at the pulse of a four-note rhythm. If you switch the groups around, it results in a four-note rhythm over a five-note rhythm:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "{arpy bass2 drum notes can, bd hh sn cp}"</pre></div>
<p>Sometimes you might want to create an odd polymeter rhythm without having to explicitly create a base rhythm. You could do this with rests:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "{~ ~ ~ ~, arpy bass2 drum notes can}"</pre></div>
<p>But a more efficient way is to use the&#160;% symbol after the closing curly brace to specify the number of notes in the base pulse:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "{arpy bass2 drum notes can}%4"</pre></div>
<p>the above is the same as this:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "{~ ~ ~ ~, arpy bass2 drum notes can}"</pre></div>
<p>If “polymeter” sounds a bit confusing, there’s a good explanation here: <a rel="nofollow" class="external free" href="http://music.stackexchange.com/questions/10488/polymeter-vs-polyrhythm">http://music.stackexchange.com/questions/10488/polymeter-vs-polyrhythm</a>
</p>
<h1><span class="mw-headline" id="Shifting_Time">Shifting Time</span></h1>
<p>You can use the <code>~&gt;</code> and <code>&lt;~</code> functions to shift patterns forwards or backwards in time, respectively. With each of these functions, you can specify an amount, in cycle units.
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ (0.25 &lt;~) $ sound "bd*2 cp*2 hh sn"
d1 $ (0.25 ~&gt;) $ sound "bd*2 cp*2 hh sn"</pre></div>
<p>The above code shifts the patterns over by one quarter of a cycle.
</p><p>You can hear this shifting effect best when applying it conditionally. For example, the below shifts the pattern every third cycle:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ every 3 (0.25 &lt;~) $ sound "bd*2 cp*2 hh sn"
d1 $ every 3 (0.25 ~&gt;) $ sound "bd*2 cp*2 hh sn"</pre></div>
<p>You can shift patterns as little or as much as you’d like:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ every 3 (0.0625 &lt;~) $ sound "bd*2 cp*2 hh sn"
d1 $ every 3 (1000 ~&gt;) $ sound "bd*2 cp*2 hh sn"
d1 $ every 3 (1000.125 ~&gt;) $ sound "bd*2 cp*2 hh sn"</pre></div>
<p>However, in the above case every cycle is the same, so you won’t here a difference between shifting it 1 or 1000 cycles.
</p><p>You can also specify a pattern for the shift amount:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ "[0 0.25]/4" &lt;~ (sound "bd*2 cp*2 hh sn")</pre></div>
<h1><span class="mw-headline" id="Introducing_Randomness">Introducing Randomness</span></h1>
<p>Tidal can produce random patterns of integers and decimals. It can also introduce randomness into patterns by removing random events.
</p>
<h2><span class="mw-headline" id="Random_Decimal_Patterns">Random Decimal Patterns</span></h2>
<p>You can use the rand function to create a random value between 0 and 1. This is useful for effects:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "arpy*4" # pan (rand)</pre></div>
<p>As with run and all numeric patterns, the values that rand give you can be scaled, for example the below gives random numbers between 0.25 and 0.75:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "arpy*4" # pan (range 0.25 0.75 $ rand)</pre></div>
<h2><span class="mw-headline" id="Random_Integer_Patterns">Random Integer Patterns</span></h2>
<p>Use the irand function to create a random integer up to a given maximum. The most common usage of irand is to produce a random pattern of sample indices (similar to run):
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ s "arpy*8" # n (irand 30)</pre></div>
<p>The code above randomly chooses from 30 samples in the “arpy” folder.
</p><p>Hairy detail: rand and irand are actually continuous patterns, which in practical terms means they have infinite detail - you can treat them as pure information! As with all patterns they are also deterministic, stateless functions of time, so that if you retriggered a pattern from the same logical time point, exactly the same numbers would be produced. Furthermore, if you use a rand or irand in two different places, you would get the same ‘random’ pattern - if this isn’t what you want, you can simply shift or slow down time a little for one of them, e.g. slow 0.3 rand.
</p>
<h2><span id="Removing_or_“Degrading”_Pattern_events"></span><span class="mw-headline" id="Removing_or_.E2.80.9CDegrading.E2.80.9D_Pattern_events">Removing or “Degrading” Pattern events</span></h2>
<p>Tidal has a few ways to randomly remove events from patterns. You can use the shorthand&#160;? symbol if you want to give an event a 50/50 chance of happening or not on every cycle:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd? sd? sd? sd?"</pre></div>
<p>In the code above, the whole sample has a 50% chance if it will be played or if the whole cycle will be silent.
</p><p>You can add the&#160;? after the completion of any event or group in a pattern:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd*16?"
d1 $ sound "bd sn? cp hh?"
d1 $ sound "[bd sn cp hh]?"</pre></div>
<p>The <code>?</code> symbol is shorthand for the degrade function. The two lines below are equivalent:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "bd*16?"
d1 $ degrade $ sound "bd*16"</pre></div>
<p>Related to degrade is the degradeBy function, where you can specify the probability (from 0 to 1) that events will be removed from a pattern:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ degradeBy 0.25 $ sound "bd*16"</pre></div>
<p>There is also sometimesBy, which executes a function based on a probability:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sometimesBy 0.75 (# crush 4) $ sound "bd arpy sn ~"</pre></div>
<p>The code above has a 75% chance of applying the bitcrush effect pattern # crush 4 on every event in the sound pattern.
</p><p>There are other aliases for sometimesBy:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>sometimes = sometimesBy 0.5
often = sometimesBy 0.75
rarely = sometimesBy 0.25
almostNever = sometimesBy 0.1
almostAlways = sometimesBy 0.9</pre></div>
<p>e.g.:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ rarely (# crush 4) $ sound "bd*8"</pre></div>
<h1><span class="mw-headline" id="Creating_Variation_in_Patterns">Creating Variation in Patterns</span></h1>
<p>You can create a lot of cyclic variations in patterns by layering conditional logic:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ every 5 (|+| speed "0.5") $ every 4 (0.25 &lt;~) $ every 3 (rev) $
sound "bd sn arpy*2 cp"
# speed "[1 1.25 0.75 -1.5]/3"</pre></div>
<p>In addition to every you can also use the whenmod conditional function. whenmod takes two parameters; it executes a function when the remainder of the current loop number divided by the first parameter is greater or equal than the second parameter.
</p><p>For example, the following will play a pattern normally for cycles 1-6, then play it in reverse for cycles 7-8. Then normally again for six cycles, then in reverse for two, and so on:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ whenmod 8 6 (rev) $ sound "bd*2 arpy*2 cp hh*4"</pre></div>
<h1><span id="Creating_&quot;Fills&quot;_and_using_&quot;const&quot;"></span><span class="mw-headline" id="Creating_.22Fills.22_and_using_.22const.22">Creating "Fills" and using "const"</span></h1>
<p>You can think of a “fill” as a change to a regular pattern that happens regularly. e.g. every 4 cycles do “xya”, or every 8 cycles do “abc”.
</p><p>We’ve already been using every and whenmod to do pattern function fills:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ every 8 (rev) $ every 4 (density 2) $ sound "bd hh sn cp"
d1 $ whenmod 16 14 (# speed "2") $ sound "bd arpy*2 cp bass2"</pre></div>
<p>However, what if you wanted to conditionally replace the pattern with a new one? You can use the const function to completely replace a playing pattern.
</p><p>Let’s start with a trivial example where we use const to replace an entire pattern all the time:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ const (sound "arpy*3") $ sound "bd sn cp hh"</pre></div>
<p>In the code above, we’ve completely replaced the “bd sn cp hh” pattern with an “arpy” pattern. const specifies the new pattern.
</p><p>We can conditionally apply const using every or whenmod:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ whenmod 8 6 (const $ sound "arpy(3,8) bd*4") $ sound "bd sn bass2 sn"
d1 $ every 12 (const $ sound "bd*4 sn*2") $ sound "bd sn bass2 sn"</pre></div>
<h1><span class="mw-headline" id="Composing_Multi-Part_Patterns">Composing Multi-Part Patterns</span></h1>
<p>There are a few ways that you can compose new patterns from multiple other patterns. You can concatenate or “append” patterns in serial, or you can “stack” them and play them together in parallel.
</p>
<h2><span class="mw-headline" id="Concatenating_patterns_in_serial">Concatenating patterns in serial</span></h2>
<p>You can use the <code>fastcat</code> function to add patterns one after another:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ fastcat [sound "bd sn:2" # vowel "[a o]/2",
sound "casio casio:1 casio:2*2"
]</pre></div>
<p>The <code>fastcat</code> function squeezes all the patterns into the space of one. The more patterns you add to the list, the faster each pattern will be played so that all patterns can fit into a single cycle.
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ fastcat [sound "bd sn:2" # vowel "[a o]/2",
sound "casio casio:1 casio:2*2",
sound "drum drum:2 drum:3 drum:4*2"
]</pre></div>
<p><code>cat</code> (also known as <code>slowcat</code>), will maintain the original playback speed of the patterns:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ cat [sound "bd sn:2" # vowel "[a o]/2",
sound "casio casio:1 casio:2*2",
sound "drum drum:2 drum:3 drum:4*2"
]</pre></div>
<p><code>cat</code> is a great way to create a linear sequence of patterns (a sequence of sequences), giving a larger form to multiple patterns.
</p><p>There’s also <code>randcat</code>, which will play a random pattern from the list.
</p>
<h2><span class="mw-headline" id="Playing_patterns_together_in_parallel">Playing patterns together in parallel</span></h2>
<p>The <code>stack</code> function takes a list of patterns and combines them into a new pattern by playing all of the patterns in the list simultaneously.
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ stack [
sound "bd bd*2",
sound "hh*2 [sn cp] cp future*4",
sound (samples "arpy*8" (run 16))
]</pre></div>
<p>This is useful if you want to apply functions or effects on the entire stack:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ every 4 (slow 2) $ whenmod 5 3 (# speed "0.75 1.5") $ stack [
sound "bd bd*2",
sound "hh*2 [sn cp] cp future*4",
sound (samples "arpy*8" (run 16))
] # speed "[[1 0.8], [1.5 2]*2]/3"</pre></div>
<h1><span id="Truncating_samples_with_&quot;cut&quot;"></span><span class="mw-headline" id="Truncating_samples_with_.22cut.22">Truncating samples with "cut"</span></h1>
<p>So far, all of our examples have used short samples. However, maybe you’ve experimented with some long samples. Maybe you’ve noticed that really long samples can cause a lot of bleed and unwanted sound.
</p><p>With Tidal’s cut effect, you can “choke” a sound and stop it from playing when a new sample is triggered.
</p><p>Consider the following example where we have a pattern of “arpy” sounds, played at a low speed, so there is a lot of bleed into each sample:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound (samples "arpy*8" (run 8)) # speed "0.25"</pre></div>
<p>We can stop this bleed by using cut and assigning the pattern a cut group of “1”:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound (samples "arpy*8" (run 8)) # speed "0.25" # cut "1"</pre></div>
<p>No more bleed!
</p><p>You can use any number for the cut group.
</p><p>Cut groups are global, to the Tidal process, so if you have two Dirt connections, use two different cut group values to make sure the patterns don’t choke each other:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound (samples "arpy*8" (run 8)) # speed "0.25" # cut "1"
d2 $ sound (samples "bass2*6" (run 6)) # speed "0.5" # cut "2"</pre></div>
<p>This also works in a stack:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ stack [
sound (samples "arpy*8" (run 8)) # speed "0.25" # cut "1",
sound (samples "bass2*6" (run 6)) # speed "0.5" # cut "2" ]</pre></div>
<h1><span class="mw-headline" id="Transitions_Between_Patterns">Transitions Between Patterns</span></h1>
<p>Changing the pattern on a channel takes effect (almost) immediately. This may not be what you want, especially when performing live!
</p><p>That’s why Tidal allows you to choose a transition that will introduce another pattern, eventually replacing the current one.
</p><p>So once we have something running on d1, we can use the same channel number (1), passed to a nice transition function:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound (samples "hc*8" (iter 4 $ run 4))</pre></div>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>anticipate 1 $ sound (samples "bd(3,8)" (run 3))</pre></div>
<p>To transition from here, simply change the pattern, and in this case also change the transition function:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>xfadeIn 1 16 $ sound "bd(5,8)"</pre></div>
<p>The above will fade over 16 cycles from the former pattern to the given new one.
</p><p>Apart from <code>anticipate</code> and <code>xfadeIn</code> there are a lot more transition functions
e.g. some that will force you to keep changing your patterns to avoid repetitive performances.
</p>
<h1><span class="mw-headline" id="Samples">Samples</span></h1>
<p>If you’re using SuperDirt, all the default samples can be found in the Dirt-Samples folder - you can open it by running Quarks.gui in SuperCollider,
clicking on “Dirt-Samples” and then “open folder”. If you’re using classic dirt, look in its samples subfolder. Here’s some you could try:
</p>
<pre>flick sid can metal future gabba sn mouth co gretsch mt arp h cp
cr newnotes bass crow hc tabla bass0 hh bass1 bass2 oc bass3 ho
odx diphone2 house off ht tink perc bd industrial pluck trump
printshort jazz voodoo birds3 procshort blip drum jvbass psr
wobble drumtraks koy rave bottle kurt latibro rm sax lighter lt
arpy feel less stab ul
</pre>
<p>Each one is a folder containing one or more wav files. For example when you put bd:1 in a sequence, you’re picking up the second wav file in the bd folder. If you ask for the ninth sample and there are only seven in the folder, it’ll wrap around and play the second one.
</p><p>If you want to add your own samples, just create a new folder in the samples folder, and put wav files in it.
</p>
<h1><span class="mw-headline" id="Synths">Synths</span></h1>
<p>For this section to work, you need to have installed the SuperCollider sc3-plugins. You can either install the latest version from git, or if you are using Linux, you may find it in your package manager. On Fedora the package is called supercollider-sc3-plugins.
</p><p>SuperDirt is created with SuperCollider, a fantastic synthesis engine and language with huge sonic possibilities. You can trigger custom SuperCollider synths from TidalCycles in much the same way as you trigger samples. For example:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ midinote "60 62*2" # s "supersaw"</pre></div>
<p>The above plays note 60 and 62 of the MIDI scale, using the midinote parameter. You can alternatively specify notes by name, using n:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ n "c5 d5*2" # s "supersaw"</pre></div>
<p>For half tones you add the suffixes “f” or “s” (flat or sharp) to the note in question.
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ n "&lt;[a5,cs5,e5,g5]*3 [d5,fs5,g5,c5]&gt;" # s "supersquare" # gain "0.7"</pre></div>
<p>Above is a two chord progression A7 D7. Notice cs5 and fs5 as C#5 and F#5, respectively.
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d2 $ every 4 (rev) $ n "&lt;[g5 df5 e5 a5] [gf5 d5 c5 g5]*3&gt;" # s "supersaw"</pre></div>
<p>Now the same chords (A7 D7) this time played as ascending and descending arpeggios and cs5 written as df5and fs5 as gf5. Play both examples together for more fun!
</p><p>You can also specify note numbers with n, but where 0 is middle c (rather than 60 with midinote).
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ n "0 5" # s "supersaw"</pre></div>
<p>The default sustain length is a bit long so the sounds will overlap, you can adjust this using the sustain parameter
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ n "c5 d5*2" # s "supersaw" # sustain "0.4 0.2"</pre></div>
<p>Many example synths can be found in the default-synths-extra.scd file in the SuperDirt/library folder or in default-synths.scd and tutorial-synths.scd in the SuperDirt/synths folder. These include:
</p>
<ul><li>a series of tutorials: tutorial1, tutorial2, tutorial3, tutorial4, tutorial5</li>
<li>examples of modulating with the cursor or sound input: pmsin, in, inr</li>
<li>physical modeling synths: supermandolin, supergong, superpiano, superhex</li>
<li>a basic synth drumkit: superkick, superhat, supersnare, superclap, super808</li>
<li>four analogue-style synths: supersquare, supersaw, superpwm, supercomparator</li>
<li>two digital-style synths: superchip, supernoise</li></ul>
<p>To find the SuperDirt folder, simply run Quarks.folder in supercollider. The full folder location should appear in the postwindow (which is usually in the bottom right).
</p><p>Many of the above synths accept additional Tidal Parameters or interpret the usual parameters in a slightly different way. For complete documentation, see default-synths.scd, but here are some examples to try:
</p>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ jux (# accelerate "-0.1") $ s "supermandolin*8" # midinote "[80!6 78]/8"
# sustain "1 0.25 2 1"</pre></div>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ midinote (slow 2 $ (run 8) * 7 + 50) # s "supergong" # decay "[1 0.2]/4"
# voice "[0.5 0]/8" # sustain (slow 16 $ range 5 0.5 $ saw1)</pre></div>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ sound "superhat:0*8" # sustain "0.125!6 1.2" # accelerate "[0.5 -0.5]/4"</pre></div>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ s "super808 supersnare" # n (irand 5)
# voice "0.2" # decay "[2 0.5]/4" # accelerate "-0.1" # sustain "0.5" # speed "[0.5 2]/4"</pre></div>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ n (slow 8 "[[c5 e5 g5 c6]*4 [b4 e5 g5 b5]*4]") # s "superpiano"
# velocity "[1.20 0.9 0.8 1]"</pre></div>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ n (slow 8 $ "[[c4,e4,g4,c5]*4 [e4,g4,b5,e5]*4]" + "&lt;12 7&gt;") # s "superpiano"
# velocity (slow 8 $ range 0.8 1.1 sine) # sustain "8"</pre></div>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ n "[c2 e3 g4 c5 c4 c3]/3" # s "[superpwm supersaw supersquare]/24" # sustain "0.5"
# voice "0.9" # semitone "7.9" # resonance "0.3" # lfo "3" # pitch1 "0.5" # speed "0.25 1"</pre></div>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ every 16 (density 24 . (|+| midinote "24") . (# sustain "0.3") . (# attack "0.05"))
$ s "supercomparator/4" # midinote ((irand 24) + 24)
# sustain "8" # attack "0.5" # hold "4" # release "4"
# voice "0.5" # resonance "0.9" # lfo "1" # speed "30" # pitch1 "4"</pre></div>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ n "[c2 e3 g4 c5 c4 c3]*4/3" # s "superchip" # sustain "0.1"
# pitch2 "[1.2 1.5 2 3]" # pitch3 "[1.44 2.25 4 9]"
# voice (slow 4 "0 0.25 0.5 0.75") # slide "[0 0.1]/8" # speed "-4"</pre></div>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d2 $ every 4 (echo (negate 3/32)) $ n "c5*4" # s "supernoise"
# accelerate "-2" # speed "1" # sustain "0.1 ! ! 1" # voice "0.0"</pre></div>
<div class="mw-highlight mw-content-ltr" dir="ltr"><pre>d1 $ s "supernoise/8" # midinote ((irand 10) + 30) # sustain "8"
# accelerate "0.5" # voice "0.5" # pitch1 "0.15" # slide "-0.5" # resonance "0.7"
# attack "1" # release "20" # room "0.9" # size "0.9" # orbit "1"</pre></div>
<p>This is all quite new and under ongoing development, but you can read about modifying and adding your own synths to SuperDirt at its github repository.
</p>
<!--
NewPP limit report
Cached time: 20200522093343
Cache expiry: 86400
Dynamic content: false
CPU time usage: 0.110 seconds
Real time usage: 0.122 seconds
Preprocessor visited node count: 1553/1000000
Preprocessor generated node count: 3460/1000000
Post‐expand include size: 0/2097152 bytes
Template argument size: 0/2097152 bytes
Highest expansion depth: 2/40
Expensive parser function count: 0/100
Unstrip recursion depth: 0/20
Unstrip post‐expand size: 27810/5000000 bytes
-->
<!--
Transclusion expansion time report (%,ms,calls,template)
100.00% 0.000 1 -total
-->
<!-- Saved in parser cache with key tub-tub_:pcache:idhash:436-0!userlang=en-gb and timestamp 20200522093343 and revision id 7536
-->
</div></div> <div class="printfooter">
Retrieved from ‘<a dir="ltr" href="https://tidalcycles.org/index.php?title=Tutorial&amp;oldid=7536">https://tidalcycles.org/index.php?title=Tutorial&amp;oldid=7536</a>’ </div>
<div id="catlinks" class="catlinks" data-mw="interface"><div id="mw-normal-catlinks" class="mw-normal-catlinks"><a href="/index.php/Special:Categories" title="Special:Categories">Categories</a>: <ul><li><a href="/index.php?title=Category:Pages_with_syntax_highlighting_errors&amp;action=edit&amp;redlink=1" class="new" title="Category:Pages with syntax highlighting errors (page does not exist)">Pages with syntax highlighting errors</a></li><li><a href="/index.php/Category:Functions" title="Category:Functions">Functions</a></li></ul></div></div> <div class="visualClear"></div>
</div>
<!-- /bodyContent -->
</div>
</div>
</div>
</div>
<!-- /content -->
<!-- sidebar-right -->
<div class="sidebar-wrapper sidebar-right-wrapper">
<div class="sidebar-container container">
<div class="row">
<div id="sidebar-right" class="col-md-3 col-md-offset-9">
<div class="btn-group btn-block"><a href="/index.php?title=Tutorial&amp;action=edit" id="ca-edit" class="btn btn-primary btn-block" title="Edit this page [e]" accesskey="e"><span class="glyphicon glyphicon-pencil"></span> Edit </a></div><div id="tweekiTOC"></div> </div>
</div>
</div>
</div>
<!-- /sidebar-right -->
<!-- footer -->
<div id="footer" role="contentinfo" class="footer container footer-sticky" lang="en-GB" dir="ltr">
<ul id="footer-places"><li id="footer-places-privacy"><a href="/index.php/TidalCycles_userbase:Privacy_policy" title="TidalCycles userbase:Privacy policy">Privacy policy</a></li><li id="footer-places-about"><a href="/index.php/TidalCycles_userbase:About" title="TidalCycles userbase:About">About TidalCycles userbase</a></li><li id="footer-places-disclaimer"><a href="/index.php/TidalCycles_userbase:General_disclaimer" title="TidalCycles userbase:General disclaimer">Disclaimers</a></li></ul><ul id="footer-custom"><li class="dropup"><a href="/index.php?title=Special:UserLogin&amp;returnto=Tutorial" title="You are encouraged to log in; however, it is not mandatory [o]" accesskey="o">Login / Create Account</a></li></ul><ul id="footer-icons"><li id="footer-copyrightico"><span><a href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike</a></span></li><li id="footer-poweredbyico"><span><a href="//www.mediawiki.org/">Powered by MediaWiki</a></span></li></ul><div style="clear:both"></div> </div>
<!-- /footer -->
<script>(window.RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgPageParseReport":{"limitreport":{"cputime":"0.110","walltime":"0.122","ppvisitednodes":{"value":1553,"limit":1000000},"ppgeneratednodes":{"value":3460,"limit":1000000},"postexpandincludesize":{"value":0,"limit":2097152},"templateargumentsize":{"value":0,"limit":2097152},"expansiondepth":{"value":2,"limit":40},"expensivefunctioncount":{"value":0,"limit":100},"unstrip-depth":{"value":0,"limit":20},"unstrip-size":{"value":27810,"limit":5000000},"timingprofile":["100.00% 0.000 1 -total"]},"cachereport":{"timestamp":"20200522093343","ttl":86400,"transientcontent":false}}});mw.config.set({"wgBackendResponseTime":242});});</script> </body>
</html>
d1 $ sound "bd"
d1 $ silence
d1 $ sound "bd:3"
d1 $ silence
d1 $ sound "bd" # n "3"
d1 $ silence
d1 $ sound "bd sd:1"
d1 $ silence
d1 $ sound "bd sd:1"
d1 $ silence
d2 $ sound "hh hh hh hh"
d2 $ silence
d3 $ sound "arpy"
d3 $ silence
p "susan" $ sound "bd sd:1"
p "gerard" $ sound "hh hh hh hh"
d1 $ sound "bd sd"
d1 $ silence
d1 $ sound "bd sd hh cp mt arpydrum"
d1 $ silence
d1 $ sound "bd sd hh cp mt arpydrum odx bd arpy bass2 feel future"
d1 $ silence
d1 silence
d1 $ silence
hush
d1 $ sound "bd"
d1 $ silence
d2 $ sound "~ cp"
-- run this and only the bd plays
solo 1
-- unsolo it and the cp plays again
unsolo 1
d2 $ silence
d1 $ sound "[bd sd sd] cp"
d1 $ silence
d1 $ sound "bd [sd sd]"
d1 $ silence
d1 $ sound "bd [sd sd sd]"
d1 $ silence
d1 $ sound "bd [sd sd sd sd]"
d1 $ silence
d1 $ sound "[bd bd] [sd sd sd sd]"
d1 $ silence
d1 $ sound "[bd bd bd] [sd sd]"
d1 $ silence
d1 $ sound "[bd bd bd bd] [sd]"
d1 $ silence
d1 $ sound "[bd bd] [bd [sd [sd sd] sd] sd]"
d1 $ silence
d1 $ sound "bd bd . sd sd sd . bd sd"
d1 $ silence
d1 $ sound "[bd bd] [sd sd sd] [bd sd]"
d1 $ silence
d1 $ sound "[bd bd bd, sd cp sd cp]"
d1 $ silence
d1 $ sound "[bd bd bd, sd cp sd cp, arpy arpy, odx]"
d1 $ silence
d1 $ sound "[bd bd bd, [sd sd] cp, arpy [arpy [arpy arpy] arpy arpy], odx]"
d1 $ silence
d1 $ sound "bd <arpy:1 arpy:2 arpy:3>"
d1 $ silence
d1 $ sound "bd*2"
d1 $ silence
d1 $ sound "bd/2"
d1 $ silence
d1 $ sound "bd*3" -- plays the bd sample three times each cycle
d1 $ silence
d1 $ sound "bd/3" -- plays the bd samples only once each third cycle
d1 $ silence
d1 $ sound "[bd sn]*2 cp"
d1 $ silence
d1 $ sound "[bd sn] cp/2"
d1 $ silence
d1 $ sound "[[bd sn] cp]*2" -- speeds up the entire pattern by 2
d1 $ silence
d1 $ sound "[[bd sn] cp]/2" -- slowsdown the entire pattern by 2
d1 $ silence
d1 $ sound "[bd sn sn*3]/2 [bd sn*3 bd*4]/3"
d1 $ silence
d1 $ sound "[bd [sn sn]*2]/2 [bd [sn bd]/2]*2"
d1 $ silence
d1 $ rev (sound "bd*2 [bd [sn sn*2 sn] sn]")
d1 $ silence
d1 $ every 4 (rev) (sound "bd*2 [bd [sn sn*2 sn] sn]")
d1 $ silence
d1 $ slow 4 $ sound "bd*2 [bd [sn sn*2 sn] sn]"
d1 $ silence
d1 $ fast 4 $ sound "bd*2 [bd [sn sn*2 sn] sn]"
d1 $ silence
d1 $ every 4 (fast 4) $ sound "bd*2 [bd [sn sn*2 sn] sn]"
d1 $ silence
d1 $ sound (every 4 (fast 4) "bd*2 [bd [sn sn*2 sn] sn]")
d1 $ silence
d1 $ sound "bd*4" # crush "4"
d1 $ silence
d1 $ sound "bd*4" # crush "4" # speed "2"
d1 $ silence
d1 $ sound "bd*4" # gain "1 0.8 0.5 0.7"
d1 $ silence
d1 $ sound "bd*4 sn*4" # gain "[[1 0.8]*2 [0.5 0.7]]/2"
d1 $ silence
d1 $ sound "bd*4" # (every 3 (rev) $ gain "1 0.8 0.5 0.7")
d1 $ silence
d1 $ sound "bd*4" # gain (every 3 (rev) $ "1 0.8 0.5 0.7")
d1 $ silence
d1 $ gain "1 0.8 0.5 0.7" # sound "bd"
d1 $ silence
d1 $ every 2 (|> speed "2") $ sound "arpy*4" |> speed "1"
d1 $ silence
|+
|-
|*
|/
d1 $ every 2 (|+ speed "1") $ sound "arpy*4" |> speed "1"
d1 $ silence
d1 $ every 2 (|* speed "1.5") $ sound "arpy*4" |> speed "1"
d1 $ silence
d1 $ every 3 (|- note "3") $ every 2 (|+ up "5") $ sound "arpy*4" |> note "0 2 4 5"
d1 $ silence
d1 $ sound "arpy(3,8)" # n "2"
d1 $ silence
d1 $ sound "arpy(3,8)" # n 2
d1 $ silence
d1 $ sound "arpy(3,8)" # n "2 5"
d1 $ silence
d1 $ sound "arpy(3,8)" # n ("0 2" * 2)
d1 $ silence
d1 $ sound "arpy(3,8)" # n (every 4 (* 2) "0 2")
d1 $ silence
d1 $ n (off 0.125 (+12) $ off 0.25 (+7) $ slow 2 $ "0(3,8) [5 7]") # sound "supergong"
d1 $ silence
d1 $ n "[0 .. 7] [3 .. 1]" # sound "supergong"
d1 $ silence
d1 $ n "[0 1 2 3 4 5 6 7] [3 2 1]" # sound "supergong"
d1 $ silence
d1 $ sound "arpy" # speed "1"
d1 $ silence
d1 $ sound "arpy" # speed "0.5"
d1 $ silence
d1 $ sound "arpy" # speed "2"
d1 $ silence
d1 $ speed "1 0.5 2 1.5" # sound "arpy"
d1 $ silence
d1 $ speed "-1 -0.5 -2 -1.5" # sound "arpy"
d1 $ silence
d1 $ sound "arpy" # speed "[1, 1.5]"
d1 $ silence
d1 $ speed "[1 0.5, 1.5 2 3 4]" # sound "arpy"
d1 $ silence
d1 $ up "0 1 2 3 4 5 6 7 8 9 10 11" # sound "arpy"
d1 $ silence
d1 $ up (run 12) # sound "arpy".
d1 $ silence
d1 $ sound "bd(5,8)"
d1 $ silence
d1 $ euclid 5 8 $ sound "bd"
d1 $ silence
d1 $ sound "bd(3,8) sn*2"
d1 $ silence
d1 $ sound "bd(3,8) sn(5,8)"
d1 $ silence
d1 $ sound "bd(5,8,2)"
d1 $ silence
d1 $ euclid 3 8 $ sound "bd*2 [sn cp]"
d1 $ silence
d1 $ sound "bd([5 3]/2,8)"
d1 $ silence
setcps 1
setcps 1.5
setcps 0.75
setcps 10
setcps (140/60/4)
d1 $ sound "cp(3,8)"
# cps (slow 8 $ range 0.8 1.6 saw)
d1 $ silence
d1 $ sound "arpy*8" # up (run 8)
d1 $ silence
d1 $ sound "arpy*8" # speed (run 8)
d1 $ silence
d1 $ up (run 8) # sound "arpy"
d1 $ silence
d1 $ sound "arpy*8" # up (every 2 (rev) $ run 8)
d1 $ silence
d1 $ sound "arpy:0 arpy:2 arpy:3"
d1 $ silence
d1 $ n "0 2 3" # s "arpy"
d1 $ silence
d1 $ sound "arpy:0 arpy:2 arpy:3"
d1 $ silence
d1 $ n "0 2 3" # s "arpy"
d1 $ silence
d1 $ sound $ samples "drum*4" "0 1 2 3"
d1 $ silence
d1 $ sound "drum:0drum:1drum:2drum:3"
d1 $ silence
d1 $ n (run 4) # s "drum"
d1 $ silence
d1 $ sound $ samples "drum*4" (run 4) -- or with samples
d1 $ silence
d1 $ s "drum arpy cp hh" # n (run 10)
d1 $ silence
d1 $ n (run 10) # s "drum arpy cp hh"
d1 $ silence
d1 $ sound (samples "drum arpy cp hh" (run 10))
d1 $ silence
d1 $ sound "bd sndrum arpy" # pan "0 1 0.25 0.75"
d1 $ silence
d1 $ pan "0 1 0.25 0.75" # sound "bd sndrum arpy"
d1 $ silence
d1 $ pan "0 1 0.25" # sound "bd sndrum arpy"
d1 $ silence
d1 $ up "0 0*2 0*4 1" # sound "[arpy, bass2, bd]"
d1 $ silence
d1 $ sound "drum" >| n "0 1*2 ~ 3"
d1 $ silence
d1 $ sound "drum cp" >| n "0 1 2"
d1 $ silence
d1 $ sound "bd*16" # pan sine
d1 $ silence
d1 $ sound "bd*16" # pan (slow 8 $ saw)
d1 $ silence
d1 $ sound "bd*8 sn*8" # pan (density 1.75 $ tri)
d1 $ silence
d1 $ sound "bd*8 sn*8" # speed (density 2 $ tri)
d1 $ silence
d1 $ sound "bd*16" # pan (slowcat [sine, saw, square, tri])
d1 $ silence
d1 $ sound "sn:2*16" # speed ((range 0.5 3 sine) * (slow 4 saw))
d1 $ silence
d1 $ sound "bd*8 sn*8" # speed (range 1 3 $ tri)
d1 $ silence
d1 $ sound "bd*8 sn*8" # speed (slow 4 $ range 1 3 $ tri)
d1 $ silence
d1 $ sound "bd*8 sn*8" # speed (range (-2) 3 $ tri)
d1 $ silence
d1 $ sound "hh*32" # cutoff (range 300 1000 $ slow 4 $ sine) # resonance "0.4"
d1 $ silence
d1 $ sound "bd bd ~ bd"
d1 $ silence
d1 $ sound "{bd hh sn cp, arpy bass2drum notes can}"
d1 $ silence
d1 $ sound "{arpy bass2drum notes can, bd hh sn cp}"
d1 $ silence
d1 $ sound "{~ ~ ~ ~, arpy bass2drum notes can}"
d1 $ silence
d1 $ sound "{arpy bass2drum notes can}%4"
d1 $ silence
d1 $ sound "{~ ~ ~ ~, arpy bass2drum notes can}"
d1 $ silence
d1 $ (0.25 <~) $ sound "bd*2 cp*2 hh sn"
d1 $ silence
d1 $ (0.25 ~>) $ sound "bd*2 cp*2 hh sn"
d1 $ silence
d1 $ every 3 (0.25 <~) $ sound "bd*2 cp*2 hh sn"
d1 $ silence
d1 $ every 3 (0.25 ~>) $ sound "bd*2 cp*2 hh sn"
d1 $ silence
d1 $ every 3 (0.0625 <~) $ sound "bd*2 cp*2 hh sn"
d1 $ silence
d1 $ every 3 (1000 ~>) $ sound "bd*2 cp*2 hh sn"
d1 $ silence
d1 $ every 3 (1000.125 ~>) $ sound "bd*2 cp*2 hh sn"
d1 $ silence
d1 $ "[0 0.25]/4" <~ (sound "bd*2 cp*2 hh sn")
d1 $ silence
d1 $ sound "arpy*4" # pan (rand)
d1 $ silence
d1 $ sound "arpy*4" # pan (range 0.25 0.75 $ rand)
d1 $ silence
d1 $ s "arpy*8" # n (irand 30)
d1 $ silence
d1 $ sound "bd? sd? sd? sd?"
d1 $ silence
d1 $ sound "bd*16?"
d1 $ silence
d1 $ sound "bd sn? cp hh?"
d1 $ silence
d1 $ sound "[bd sn cp hh]?"
d1 $ silence
d1 $ sound "bd*16?"
d1 $ silence
d1 $degrade $ sound "bd*16"
d1 $ silence
d1 $degradeBy 0.25 $ sound "bd*16"
d1 $ silence
d1 $ sometimesBy 0.75 (# crush 4) $ sound "bd arpy sn ~"
d1 $ silence
sometimes = sometimesBy 0.5
often = sometimesBy 0.75
rarely = sometimesBy 0.25
almostNever = sometimesBy 0.1
almostAlways = sometimesBy 0.9
d1 $ rarely (# crush 4) $ sound "bd*8"
d1 $ silence
d1 $ every 5 (|+| speed "0.5") $ every 4 (0.25 <~) $ every 3 (rev) $
sound "bd sn arpy*2 cp"
# speed "[1 1.25 0.75 -1.5]/3"
d1 $ silence
d1 $ whenmod 8 6 (rev) $ sound "bd*2 arpy*2 cp hh*4"
d1 $ silence
d1 $ every 8 (rev) $ every 4 (density 2) $ sound "bd hh sn cp"
d1 $ silence
d1 $ whenmod 16 14 (# speed "2") $ sound "bd arpy*2 cp bass2"
d1 $ silence
d1 $ const (sound "arpy*3") $ sound "bd sn cp hh"
d1 $ silence
d1 $ whenmod 8 6 (const $ sound "arpy(3,8) bd*4") $ sound "bd sn bass2 sn"
d1 $ silence
d1 $ every 12 (const $ sound "bd*4 sn*2") $ sound "bd sn bass2 sn"
d1 $ silence
d1 $ fastcat [sound "bd sn:2" # vowel "[a o]/2",
sound "casio casio:1 casio:2*2"
]
d1 $ silence
d1 $ fastcat [sound "bd sn:2" # vowel "[a o]/2",
sound "casio casio:1 casio:2*2",
sound "drumdrum:2drum:3drum:4*2"
]
d1 $ silence
d1 $ cat [sound "bd sn:2" # vowel "[a o]/2",
sound "casio casio:1 casio:2*2",
sound "drumdrum:2drum:3drum:4*2"
]
d1 $ silence
d1 $ stack [
sound "bd bd*2",
sound "hh*2 [sn cp] cp future*4",
sound (samples "arpy*8" (run 16))
]
d1 $ silence
d1 $ every 4 (slow 2) $ whenmod 5 3 (# speed "0.75 1.5") $ stack [
sound "bd bd*2",
sound "hh*2 [sn cp] cp future*4",
sound (samples "arpy*8" (run 16))
] # speed "[[1 0.8], [1.5 2]*2]/3"
d1 $ silence
d1 $ sound (samples "arpy*8" (run 8)) # speed "0.25"
d1 $ silence
d1 $ sound (samples "arpy*8" (run 8)) # speed "0.25" # cut "1"
d1 $ silence
d1 $ sound (samples "arpy*8" (run 8)) # speed "0.25" # cut "1"
d1 $ silence
d2 $ sound (samples "bass2*6" (run 6)) # speed "0.5" # cut "2"
d2 $ silence
d1 $ stack [
sound (samples "arpy*8" (run 8)) # speed "0.25" # cut "1",
sound (samples "bass2*6" (run 6)) # speed "0.5" # cut "2" ]
d1 $ silence
d1 $ sound (samples "hc*8" (iter 4 $ run 4))
d1 $ silence
anticipate 1 $ sound (samples "bd(3,8)" (run 3))
xfadeIn 1 16 $ sound "bd(5,8)"
flick sid can metal future gabba sn mouth co gretsch mt arp h cp
cr newnotes bass crow hc tabla bass0 hh bass1 bass2 oc bass3 ho
odxdiphone2 house off ht tink perc bd industrial pluck trump
printshort jazz voodoo birds3 procshort blipdrum jvbass psr
wobbledrumtraks koy rave bottle kurt latibro rm sax lighter lt
arpy feel less stab ul
d1 $ midinote "60 62*2" # s "supersaw"
d1 $ silence
d1 $ n "c5d5*2" # s "supersaw"
d1 $ silence
d1 $ n "<[a5,cs5,e5,g5]*3 [d5,fs5,g5,c5]>" # s "supersquare" # gain "0.7"
d1 $ silence
d2 $ every 4 (rev) $ n "<[g5df5 e5 a5] [gf5d5 c5 g5]*3>" # s "supersaw"
d2 $ silence
d1 $ n "0 5" # s "supersaw"
d1 $ silence
d1 $ n "c5d5*2" # s "supersaw" # sustain "0.4 0.2"
d1 $ silence
d1 $ jux (# accelerate "-0.1") $ s "supermandolin*8" # midinote "[80!6 78]/8"
# sustain "1 0.25 2 1"
d1 $ silence
d1 $ midinote (slow 2 $ (run 8) * 7 + 50) # s "supergong" #decay "[1 0.2]/4"
# voice "[0.5 0]/8" # sustain (slow 16 $ range 5 0.5 $ saw1)
d1 $ silence
d1 $ sound "superhat:0*8" # sustain "0.125!6 1.2" # accelerate "[0.5 -0.5]/4"
d1 $ silence
d1 $ s "super808 supersnare" # n (irand 5)
# voice "0.2" #decay "[2 0.5]/4" # accelerate "-0.1" # sustain "0.5" # speed "[0.5 2]/4"
d1 $ silence
d1 $ n (slow 8 "[[c5 e5 g5 c6]*4 [b4 e5 g5 b5]*4]") # s "superpiano"
# velocity "[1.20 0.9 0.8 1]"
d1 $ silence
d1 $ n (slow 8 $ "[[c4,e4,g4,c5]*4 [e4,g4,b5,e5]*4]" + "<12 7>") # s "superpiano"
# velocity (slow 8 $ range 0.8 1.1 sine) # sustain "8"
d1 $ silence
d1 $ n "[c2 e3 g4 c5 c4 c3]/3" # s "[superpwm supersaw supersquare]/24" # sustain "0.5"
# voice "0.9" # semitone "7.9" # resonance "0.3" # lfo "3" # pitch1 "0.5" # speed "0.25 1"
d1 $ silence
d1 $ every 16 (density 24 . (|+| midinote "24") . (# sustain "0.3") . (# attack "0.05"))
$ s "supercomparator/4" # midinote ((irand 24) + 24)
# sustain "8" # attack "0.5" # hold "4" # release "4"
# voice "0.5" # resonance "0.9" # lfo "1" # speed "30" # pitch1 "4"
d1 $ silence
d1 $ n "[c2 e3 g4 c5 c4 c3]*4/3" # s "superchip" # sustain "0.1"
# pitch2 "[1.2 1.5 2 3]" # pitch3 "[1.44 2.25 4 9]"
# voice (slow 4 "0 0.25 0.5 0.75") # slide "[0 0.1]/8" # speed "-4"
d1 $ silence
d2 $ every 4 (echo (negate 3/32)) $ n "c5*4" # s "supernoise"
# accelerate "-2" # speed "1" # sustain "0.1 ! ! 1" # voice "0.0"
d2 $ silence
d1 $ s "supernoise/8" # midinote ((irand 10) + 30) # sustain "8"
# accelerate "0.5" # voice "0.5" # pitch1 "0.15" # slide "-0.5" # resonance "0.7"
# attack "1" # release "20" # room "0.9" # size "0.9" # orbit "1"
d1 $ silence
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment