⌈⌋ branch:  Bitrhythm


Check-in [414174737a]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Added cue Changed Support link Working example for p5
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 414174737a63494e1325ad71eb8edb796f57799ef7ac5293d7d3c7d8baeac6b4
User & Date: dev 2021-10-12 03:29:01
Context
2021-11-08
06:21
Added cue Changed Support link Working example for p5 Added dsl for tracking Added autocommit Various Fixes for Save Improve Docs and Bookmarks WebGL Demo check-in: fa4745a0a7 user: dev tags: trunk
2021-10-12
03:29
Added cue Changed Support link Working example for p5 check-in: 414174737a user: dev tags: trunk
2021-08-11
18:56
Import from git Added a changelog check-in: 12a9bb700d user: dev tags: trunk
Changes

Changes to build/html/index.html.

227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
<li class="toctree-l2"><a class="reference internal" href="midi.html#terms">Terms</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="samples.html">Samples</a></li>
<li class="toctree-l1"><a class="reference internal" href="early-attempts.html">Early Attempts</a></li>
<li class="toctree-l1"><a class="reference internal" href="changelog.html">Changelog</a></li>
<li class="toctree-l1"><a class="reference internal" href="main.html">Concepts and Code Walkthrough</a><ul>
<li class="toctree-l2"><a class="reference internal" href="main.html#running">Running</a></li>
<li class="toctree-l2"><a class="reference internal" href="main.html#core-tracker-loop">Core Tracker Loop</a><ul>
<li class="toctree-l3"><a class="reference internal" href="main.html#observers">Observers</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="main.html#dials">Dials</a></li>
<li class="toctree-l2"><a class="reference internal" href="main.html#numbers">Numbers</a></li>
<li class="toctree-l2"><a class="reference internal" href="main.html#autoknob">AutoKnob</a></li>
<li class="toctree-l2"><a class="reference internal" href="main.html#main-ui">Main UI</a></li>
<li class="toctree-l2"><a class="reference internal" href="main.html#sample">Sample</a></li>
<li class="toctree-l2"><a class="reference internal" href="main.html#app">App</a></li>
<li class="toctree-l2"><a class="reference internal" href="main.html#index">Index</a></li>
<li class="toctree-l2"><a class="reference internal" href="main.html#page">Page</a></li>
<li class="toctree-l2"><a class="reference internal" href="main.html#javascript">Javascript</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="saving.html">Saving and Sharing</a></li>
<li class="toctree-l1"><a class="reference internal" href="bookmarks.html">Bookmarks</a><ul>
<li class="toctree-l2"><a class="reference internal" href="bookmarks.html#webaudio">WebAudio</a></li>
<li class="toctree-l2"><a class="reference internal" href="bookmarks.html#obsevers">Obsevers</a></li>







<









<
<
<







227
228
229
230
231
232
233

234
235
236
237
238
239
240
241
242



243
244
245
246
247
248
249
<li class="toctree-l2"><a class="reference internal" href="midi.html#terms">Terms</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="samples.html">Samples</a></li>
<li class="toctree-l1"><a class="reference internal" href="early-attempts.html">Early Attempts</a></li>
<li class="toctree-l1"><a class="reference internal" href="changelog.html">Changelog</a></li>
<li class="toctree-l1"><a class="reference internal" href="main.html">Concepts and Code Walkthrough</a><ul>

<li class="toctree-l2"><a class="reference internal" href="main.html#core-tracker-loop">Core Tracker Loop</a><ul>
<li class="toctree-l3"><a class="reference internal" href="main.html#observers">Observers</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="main.html#dials">Dials</a></li>
<li class="toctree-l2"><a class="reference internal" href="main.html#numbers">Numbers</a></li>
<li class="toctree-l2"><a class="reference internal" href="main.html#autoknob">AutoKnob</a></li>
<li class="toctree-l2"><a class="reference internal" href="main.html#main-ui">Main UI</a></li>
<li class="toctree-l2"><a class="reference internal" href="main.html#sample">Sample</a></li>



<li class="toctree-l2"><a class="reference internal" href="main.html#javascript">Javascript</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="saving.html">Saving and Sharing</a></li>
<li class="toctree-l1"><a class="reference internal" href="bookmarks.html">Bookmarks</a><ul>
<li class="toctree-l2"><a class="reference internal" href="bookmarks.html#webaudio">WebAudio</a></li>
<li class="toctree-l2"><a class="reference internal" href="bookmarks.html#obsevers">Obsevers</a></li>

Changes to build/html/main.html.

183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
...
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
...
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
...
281
282
283
284
285
286
287

288
289
290
291
292
293
294
...
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
...
665
666
667
668
669
670
671

672
673
674
675
676
677
678
...
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
        <div class="d-none d-md-block col-md-2 bd-toc show">
            
            <div class="tocsection onthispage pt-5 pb-3">
                <i class="fas fa-list"></i> Contents
            </div>
            <nav id="bd-toc-nav">
                <ul class="visible nav section-nav flex-column">
 <li class="toc-h2 nav-item toc-entry">
  <a class="reference internal nav-link" href="#running">
   Running
  </a>
 </li>
 <li class="toc-h2 nav-item toc-entry">
  <a class="reference internal nav-link" href="#core-tracker-loop">
   Core Tracker Loop
  </a>
  <ul class="nav section-nav flex-column">
   <li class="toc-h3 nav-item toc-entry">
    <a class="reference internal nav-link" href="#observers">
................................................................................
   Main UI
  </a>
 </li>
 <li class="toc-h2 nav-item toc-entry">
  <a class="reference internal nav-link" href="#sample">
   Sample
  </a>
 </li>
 <li class="toc-h2 nav-item toc-entry">
  <a class="reference internal nav-link" href="#app">
   App
  </a>
 </li>
 <li class="toc-h2 nav-item toc-entry">
  <a class="reference internal nav-link" href="#index">
   Index
  </a>
 </li>
 <li class="toc-h2 nav-item toc-entry">
  <a class="reference internal nav-link" href="#page">
   Page
  </a>
 </li>
 <li class="toc-h2 nav-item toc-entry">
  <a class="reference internal nav-link" href="#javascript">
   Javascript
  </a>
 </li>
</ul>
................................................................................
    <div id="main-content" class="row">
        <div class="col-12 col-md-9 pl-md-3 pr-md-0">
        
              <div>
                
  <div class="section" id="concepts-and-code-walkthrough">
<h1>Concepts and Code Walkthrough<a class="headerlink" href="#concepts-and-code-walkthrough" title="Permalink to this headline">¶</a></h1>
<div class="section" id="running">
<h2>Running<a class="headerlink" href="#running" title="Permalink to this headline">¶</a></h2>
<p>ls source/main.cog | entr -r runserver.sh -b</p>
</div>
<div class="section" id="core-tracker-loop">
<h2>Core Tracker Loop<a class="headerlink" href="#core-tracker-loop" title="Permalink to this headline">¶</a></h2>
<p>In bitrhythm code is evaluated for every cycle.</p>
<p>1 beat = 60 / tempo
1 cycle = 1 beat / ticks</p>
<p>For every cycle visual and audio code is evaluated.</p>
<p>The edit checkbox allows you to perform long edits, where only old code is evaluated. Once you disable it, all the new edit changes are applied in the next cycle.</p>
................................................................................
<div class="section" id="observers">
<h3>Observers<a class="headerlink" href="#observers" title="Permalink to this headline">¶</a></h3>
<p>Sidechain compression is a simple algorithm which observes amplitude of another instrument but you can generalise it to anything. By attaching observers  to time or other instruments you can create sections within the song that can trigger others with conditional logic. This is similar to pure data’s bangs - <a class="reference external" href="https://www.youtube.com/watch?v=nTTZZyD4xlE">see this</a>. In future this will be referred to as side events. You could decrease the volume of the drums to have the snares drop automatically for example.</p>
<p>This is something that you can’t do in DAWs.</p>
<div class="highlight-js notranslate"><div class="highlight"><pre><span></span><span class="k">async</span> <span class="nx">play</span><span class="p">()</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">self</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>
    <span class="kd">var</span> <span class="nx">cellx</span> <span class="o">=</span> <span class="nb">window</span><span class="p">.</span><span class="nx">cellx</span><span class="p">.</span><span class="nx">cellx</span><span class="p">;</span>


    <span class="k">await</span> <span class="nx">Tone</span><span class="p">.</span><span class="nx">start</span><span class="p">();</span>
    <span class="nx">Tone</span><span class="p">.</span><span class="nx">Transport</span><span class="p">.</span><span class="nx">start</span><span class="p">();</span>
    <span class="nx">Tone</span><span class="p">.</span><span class="nx">Transport</span><span class="p">.</span><span class="nx">bpm</span><span class="p">.</span><span class="nx">value</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">.</span><span class="nx">tempo</span><span class="p">;</span>
    <span class="nx">Tone</span><span class="p">.</span><span class="nx">Transport</span><span class="p">.</span><span class="nx">swing</span><span class="p">.</span><span class="nx">value</span> <span class="o">=</span> <span class="mf">0</span><span class="p">;</span>

    <span class="kd">var</span> <span class="nx">transition</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
................................................................................
    <span class="k">return</span> <span class="nx">context</span><span class="p">.</span><span class="nx">knob</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
</div>
</div>
<div class="section" id="main-ui">
<h2>Main UI<a class="headerlink" href="#main-ui" title="Permalink to this headline">¶</a></h2>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>// Not working

.CodeMirror-selected,
.CodeMirror-focused,
.CodeMirror-activeline,
.CodeMirror-activeline-background {
    background: transparent;
    color: #882d2d;
    z-index: 5 !important;
}
</pre></div>
</div>
<div class="highlight-html notranslate"><div class="highlight"><pre><span></span><span class="p">&lt;</span><span class="nt">bitrhythm</span><span class="p">&gt;</span>

<span class="p">&lt;</span><span class="nt">div</span><span class="p">&gt;</span>
    <span class="p">&lt;</span><span class="nt">vstack</span> <span class="na">id</span><span class="o">=</span><span class="s">&quot;header-playback&quot;</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">hstack</span><span class="p">&gt;</span>
            <span class="p">&lt;</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;ml-2&quot;</span><span class="p">&gt;</span>
                <span class="p">&lt;</span><span class="nt">button</span> <span class="na">type</span><span class="o">=</span><span class="s">&quot;button&quot;</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;btn btn-primary w-1/10 ml-2 mt-1&quot;</span> <span class="na">onclick</span><span class="o">=</span><span class="s">{addDial}</span><span class="p">&gt;</span>+ Dial<span class="p">&lt;/</span><span class="nt">button</span><span class="p">&gt;</span>
................................................................................
            <span class="p">&lt;</span><span class="nt">div</span> <span class="na">each</span><span class="o">=</span><span class="s">{</span> <span class="na">key</span><span class="err">,</span> <span class="na">index</span> <span class="na">in</span> <span class="na">state</span><span class="err">.</span><span class="na">numbers</span><span class="err">}</span><span class="p">&gt;</span>
                <span class="p">&lt;</span><span class="nt">number</span> <span class="na">rmnumber</span><span class="o">=</span><span class="s">{rmNumber}</span> <span class="na">v</span><span class="o">=</span><span class="s">{state.numbers[index]}</span> <span class="na">ti</span><span class="o">=</span><span class="s">{index</span> <span class="err">+</span> <span class="na">1</span><span class="err">}</span><span class="p">&gt;&lt;/</span><span class="nt">number</span><span class="p">&gt;</span>
            <span class="p">&lt;/</span><span class="nt">div</span><span class="p">&gt;</span>
        <span class="p">&lt;/</span><span class="nt">hstack</span><span class="p">&gt;</span>

    <span class="p">&lt;/</span><span class="nt">vstack</span><span class="p">&gt;</span>


    <span class="p">&lt;</span><span class="nt">div</span> <span class="na">id</span><span class="o">=</span><span class="s">&quot;error&quot;</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;p-2&quot;</span> <span class="na">style</span><span class="o">=</span><span class="s">&quot;color: yellow !important; height: 32px; font-size: 12px;&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">div</span><span class="p">&gt;</span>
    <span class="p">&lt;</span><span class="nt">div</span> <span class="na">id</span><span class="o">=</span><span class="s">&quot;canvas-container&quot;</span> <span class="na">style</span><span class="o">=</span><span class="s">&quot;position: relative;&quot;</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">div</span> <span class="na">id</span><span class="o">=</span><span class="s">&quot;p5&quot;</span> <span class="na">style</span><span class="o">=</span><span class="s">&quot;position: absolute; width: 100%; background: black&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">div</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">canvas</span> <span class="na">id</span><span class="o">=</span><span class="s">&quot;visual&quot;</span> <span class="na">style</span><span class="o">=</span><span class="s">&quot;position: absolute; width: 100%; background: black;&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">canvas</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">div</span> <span class="na">id</span><span class="o">=</span><span class="s">&quot;code&quot;</span> <span class="na">style</span><span class="o">=</span><span class="s">&quot;position: absolute;&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">div</span><span class="p">&gt;</span>
    <span class="p">&lt;/</span><span class="nt">div</span><span class="p">&gt;</span>
    
................................................................................
<span class="cm">        */</span>

    <span class="p">});</span>
   <span class="p">&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">sample</span><span class="p">&gt;</span>
</pre></div>
</div>
</div>
<div class="section" id="app">
<h2>App<a class="headerlink" href="#app" title="Permalink to this headline">¶</a></h2>
<div class="highlight-hylang notranslate"><div class="highlight"><pre><span></span><span class="p">(</span><span class="k">import </span><span class="p">[</span><span class="nv">sanic</span> <span class="p">[</span><span class="nv">Sanic</span> <span class="nv">response</span><span class="p">]])</span>
<span class="p">(</span><span class="k">import </span><span class="p">[</span><span class="nv">sanic.response</span> <span class="p">[</span><span class="nv">json</span> <span class="nv">text</span><span class="p">]])</span>
<span class="p">(</span><span class="k">import </span><span class="p">[</span><span class="nv">sanic.exceptions</span> <span class="p">[</span><span class="nv">NotFound</span> <span class="nv">abort</span><span class="p">]])</span>
<span class="p">(</span><span class="k">import </span><span class="p">[</span><span class="nv">jinja2</span> <span class="p">[</span><span class="nv">Environment</span> <span class="nv">FileSystemLoader</span><span class="p">]])</span>
<span class="p">(</span><span class="k">import </span><span class="nv">re</span><span class="p">)</span>
<span class="p">(</span><span class="k">import </span><span class="nv">ipdb</span><span class="p">)</span>
<span class="p">(</span><span class="k">import </span><span class="nv">sys</span><span class="p">)</span>
<span class="p">(</span><span class="k">import </span><span class="nv">traceback</span><span class="p">)</span>
<span class="p">(</span><span class="k">import </span><span class="nv">json</span><span class="p">)</span>
<span class="p">(</span><span class="k">import </span><span class="nv">datetime</span><span class="p">)</span>
<span class="p">(</span><span class="k">import </span><span class="p">[</span><span class="nv">email.utils</span> <span class="p">[</span><span class="nv">format_datetime</span><span class="p">]])</span>
<span class="p">(</span><span class="k">import </span><span class="p">[</span><span class="nv">urllib.parse</span> <span class="p">[</span><span class="nv">urlparse</span><span class="p">]])</span>
<span class="p">(</span><span class="k">import </span><span class="nv">base64</span><span class="p">)</span>

<span class="p">(</span><span class="kd">setv </span><span class="nv">file-loader</span> <span class="p">(</span><span class="nf">FileSystemLoader</span> <span class="s">&quot;templates&quot;</span><span class="p">))</span>
<span class="p">(</span><span class="kd">setv </span><span class="nv">env</span> <span class="p">(</span><span class="nf">Environment</span> <span class="ss">:loader</span> <span class="nv">file-loader</span><span class="p">))</span>

<span class="p">(</span><span class="kd">setv </span><span class="nv">app</span> <span class="p">(</span><span class="nf">Sanic</span> <span class="s">&quot;Bitrhythm&quot;</span><span class="p">))</span>

<span class="p">(</span><span class="k">with</span><span class="nv">-decorator</span>
  <span class="p">(</span><span class="nf">app.exception</span> <span class="nv">NotFound</span><span class="p">)</span>
  <span class="p">(</span><span class="nf">defn/a</span> <span class="nv">ignore_404s</span> <span class="p">[</span><span class="nv">request</span> <span class="nv">exception</span><span class="p">]</span>
    <span class="p">(</span><span class="k">return</span> <span class="p">(</span><span class="nf">text</span> <span class="p">(</span><span class="nf">+</span> <span class="s">&quot;Yep, I totally found the page &quot;</span> <span class="nv">request.url</span><span class="p">)))</span>
  <span class="p">)</span>
<span class="p">)</span>

<span class="p">(</span><span class="k">with</span><span class="nv">-decorator</span>
  <span class="p">(</span><span class="nf">app.route</span> <span class="s">&quot;/song/&lt;name&gt;&quot;</span><span class="p">)</span>
  <span class="p">(</span><span class="nf">defn/a</span> <span class="nv">get-index</span> <span class="p">[</span><span class="nv">request</span> <span class="nv">name</span><span class="p">]</span>
    <span class="p">(</span><span class="kd">setv </span><span class="nv">template</span> <span class="p">(</span><span class="nf">env.get_template</span> <span class="s">&quot;index.html&quot;</span><span class="p">))</span>
    <span class="p">(</span><span class="k">return</span> <span class="p">(</span><span class="nf">response.html</span> <span class="p">(</span><span class="nf">template.render</span> <span class="p">{</span><span class="s">&quot;data&quot;</span> <span class="nv">name</span><span class="p">})))</span>
  <span class="p">)</span>
<span class="p">)</span>

<span class="p">(</span><span class="k">with</span><span class="nv">-decorator</span>
  <span class="p">(</span><span class="nf">app.route</span> <span class="s">&quot;/&quot;</span><span class="p">)</span>
  <span class="p">(</span><span class="nf">defn/a</span> <span class="nv">get-index</span> <span class="p">[</span><span class="nv">request</span><span class="p">]</span>
    <span class="p">(</span><span class="kd">setv </span><span class="nv">template</span> <span class="p">(</span><span class="nf">env.get_template</span> <span class="s">&quot;index.html&quot;</span><span class="p">))</span>
    <span class="p">(</span><span class="k">return</span> <span class="p">(</span><span class="nf">response.html</span> <span class="p">(</span><span class="nf">template.render</span> <span class="p">{</span><span class="s">&quot;data&quot;</span> <span class="s">&quot;&quot;</span><span class="p">})))</span>
  <span class="p">)</span>
<span class="p">)</span>

<span class="p">(</span><span class="k">with</span><span class="nv">-decorator</span>
  <span class="p">(</span><span class="nf">app.route</span> <span class="s">&quot;/issue&quot;</span><span class="p">)</span>
  <span class="p">(</span><span class="nf">defn/a</span> <span class="nv">get-index</span> <span class="p">[</span><span class="nv">request</span><span class="p">]</span>
    <span class="p">(</span><span class="kd">setv </span><span class="nv">template</span> <span class="p">(</span><span class="nf">env.get_template</span> <span class="s">&quot;page.html&quot;</span><span class="p">))</span>
    <span class="p">(</span><span class="k">return</span> <span class="p">(</span><span class="nf">response.html</span> <span class="p">(</span><span class="nf">template.render</span><span class="p">)))</span>
  <span class="p">)</span>
<span class="p">)</span>

<span class="p">(</span><span class="nf">app.static</span> <span class="s">&quot;/&quot;</span> <span class="s">&quot;./public&quot;</span><span class="p">)</span>

<span class="p">(</span><span class="nf">defmain</span> <span class="p">[</span><span class="o">&amp;</span><span class="k">rest </span><span class="nv">args</span><span class="p">]</span>
    <span class="p">(</span><span class="nf">app.run</span> <span class="ss">:host</span> <span class="s">&quot;0.0.0.0&quot;</span> <span class="ss">:port</span> <span class="mi">8015</span><span class="p">)</span>
<span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="index">
<h2>Index<a class="headerlink" href="#index" title="Permalink to this headline">¶</a></h2>
<div class="highlight-html notranslate"><div class="highlight"><pre><span></span><span class="cp">&lt;!DOCTYPE html&gt;</span>
<span class="p">&lt;</span><span class="nt">html</span> <span class="na">lang</span><span class="o">=</span><span class="s">&quot;en&quot;</span><span class="p">&gt;</span>

    <span class="p">&lt;</span><span class="nt">head</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">meta</span> <span class="na">charset</span><span class="o">=</span><span class="s">&quot;utf-8&quot;</span><span class="p">&gt;</span>

        <span class="p">&lt;</span><span class="nt">title</span><span class="p">&gt;</span>Bitrhythm<span class="p">&lt;/</span><span class="nt">title</span><span class="p">&gt;</span>

        <span class="p">&lt;</span><span class="nt">meta</span> <span class="na">http-equiv</span><span class="o">=</span><span class="s">&quot;Cache-Control&quot;</span> <span class="na">content</span><span class="o">=</span><span class="s">&quot;no-cache, no-store, must-revalidate&quot;</span> <span class="p">/&gt;</span>
        <span class="p">&lt;</span><span class="nt">meta</span> <span class="na">http-equiv</span><span class="o">=</span><span class="s">&quot;Pragma&quot;</span> <span class="na">content</span><span class="o">=</span><span class="s">&quot;no-cache&quot;</span> <span class="p">/&gt;</span>
        <span class="p">&lt;</span><span class="nt">meta</span> <span class="na">http-equiv</span><span class="o">=</span><span class="s">&quot;Expires&quot;</span> <span class="na">content</span><span class="o">=</span><span class="s">&quot;0&quot;</span> <span class="p">/&gt;</span>

        <span class="p">&lt;</span><span class="nt">meta</span> <span class="na">content</span><span class="o">=</span><span class="s">&quot;Bitrhythm&quot;</span> <span class="na">name</span><span class="o">=</span><span class="s">&quot;description&quot;</span> <span class="na">xml:lang</span><span class="o">=</span><span class="s">&quot;en&quot;</span> <span class="na">lang</span><span class="o">=</span><span class="s">&quot;en&quot;</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">meta</span> <span class="na">content</span><span class="o">=</span><span class="s">&quot;literate programming, p5, live coding, algorave, demoscene, creative programming, music, techno, programming, webaudio, webgl, p5, improvising&quot;</span><span class="p">&gt;</span>

       ${common_scripts}

        <span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;preconnect&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;https://fonts.gstatic.com&quot;</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">link</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100;0,200;0,300;0,400;0,500;0,700;1,100;1,200;1,300;1,400;1,500;1,700&amp;display=swap&quot;</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">link</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;https://fonts.googleapis.com/css2?family=Major+Mono+Display&amp;family=Roboto+Mono:ital,wght@0,100;0,200;0,300;0,400;0,500;0,700;1,100;1,200;1,300;1,400;1,500;1,700&amp;display=swap&quot;</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span><span class="p">&gt;</span>

        <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://code.jquery.com/ui/1.12.0/jquery-ui.min.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;https://code.jquery.com/ui/1.12.0/themes/smoothness/jquery-ui.css&quot;</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://cdnjs.cloudflare.com/ajax/libs/micromodal/0.4.6/micromodal.min.js&quot;</span> <span class="na">integrity</span><span class="o">=</span><span class="s">&quot;sha512-RMMh+IHzfZLsVFo1rX9PBoysxrJJqjyOS31HYWftobWtv2At6KBTqKpvVDIWAjL5aiV+LjFqkQ6e53Rdw3VOBg==&quot;</span> <span class="na">crossorigin</span><span class="o">=</span><span class="s">&quot;anonymous&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://cdn.jsdelivr.net/npm/whenipress@1.8.0/dist/whenipress.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>

        <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://cdnjs.cloudflare.com/ajax/libs/AlertifyJS/1.13.1/alertify.min.js&quot;</span> <span class="na">integrity</span><span class="o">=</span><span class="s">&quot;sha512-JnjG+Wt53GspUQXQhc+c4j8SBERsgJAoHeehagKHlxQN+MtCCmFDghX9/AcbkkNRZptyZU4zC8utK59M5L45Iw==&quot;</span> <span class="na">crossorigin</span><span class="o">=</span><span class="s">&quot;anonymous&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;https://cdnjs.cloudflare.com/ajax/libs/AlertifyJS/1.13.1/css/alertify.min.css&quot;</span> <span class="na">integrity</span><span class="o">=</span><span class="s">&quot;sha512-IXuoq1aFd2wXs4NqGskwX2Vb+I8UJ+tGJEu/Dc0zwLNKeQ7CW3Sr6v0yU3z5OQWe3eScVIkER4J9L7byrgR/fA==&quot;</span> <span class="na">crossorigin</span><span class="o">=</span><span class="s">&quot;anonymous&quot;</span> <span class="p">/&gt;</span>
        <span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;https://cdnjs.cloudflare.com/ajax/libs/AlertifyJS/1.13.1/css/themes/default.min.css&quot;</span> <span class="na">integrity</span><span class="o">=</span><span class="s">&quot;sha512-RgUjDpwjEDzAb7nkShizCCJ+QTSLIiJO1ldtuxzs0UIBRH4QpOjUU9w47AF9ZlviqV/dOFGWF6o7l3lttEFb6g==&quot;</span> <span class="na">crossorigin</span><span class="o">=</span><span class="s">&quot;anonymous&quot;</span> <span class="p">/&gt;</span>

        <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;/json-url-master/dist/browser/json-url.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;/riot-3.13.2/riot+compiler.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>

        <span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.1.2/tailwind.min.css&quot;</span> <span class="na">integrity</span><span class="o">=</span><span class="s">&quot;sha512-RntatPOhEcQEA81gC/esYoCkGkL7AYV7TeTPoU+R9zE44/yWxVvLIBfBSaMu78rhoDd73ZeRHXRJN5+aPEK53Q==&quot;</span> <span class="na">crossorigin</span><span class="o">=</span><span class="s">&quot;anonymous&quot;</span> <span class="p">/&gt;</span>
        <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js&quot;</span> <span class="na">integrity</span><span class="o">=</span><span class="s">&quot;sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM&quot;</span> <span class="na">crossorigin</span><span class="o">=</span><span class="s">&quot;anonymous&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>

        <span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;https://esironal.github.io/cmtouch/lib/codemirror.css&quot;</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;https://esironal.github.io/cmtouch/addon/hint/show-hint.css&quot;</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://esironal.github.io/cmtouch/lib/codemirror.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://esironal.github.io/cmtouch/addon/hint/show-hint.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;http://esironal.github.io/cmtouch/addon/hint/xml-hint.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://esironal.github.io/cmtouch/addon/hint/html-hint.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://esironal.github.io/cmtouch/mode/xml/xml.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://esironal.github.io/cmtouch/mode/javascript/javascript.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://esironal.github.io/cmtouch/mode/css/css.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://esironal.github.io/cmtouch/mode/htmlmixed/htmlmixed.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://esironal.github.io/cmtouch/addon/selection/active-line.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://esironal.github.io/cmtouch/addon/edit/matchbrackets.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;https://esironal.github.io/cmtouch/theme/neonsyntax.css&quot;</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;https://unpkg.com/pyloncss@latest/css/pylon.css&quot;</span><span class="p">/&gt;</span>


        <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;/tune.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;/misc.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>

        <span class="p">&lt;</span><span class="nt">style</span> <span class="na">type</span><span class="o">=</span><span class="s">&quot;text/css&quot;</span><span class="p">&gt;</span>
<span class="nt">body</span> <span class="p">{</span>
    <span class="k">background</span><span class="p">:</span> <span class="kc">black</span><span class="p">;</span>
    <span class="k">color</span><span class="p">:</span> <span class="kc">white</span><span class="p">;</span>
    <span class="k">font-family</span><span class="p">:</span> <span class="s1">&#39;Roboto Mono&#39;</span><span class="p">,</span> <span class="kc">monospace</span><span class="p">;</span>
<span class="p">}</span>

<span class="nt">a</span> <span class="p">{</span>
    <span class="k">color</span><span class="p">:</span> <span class="kc">white</span><span class="p">;</span>
<span class="p">}</span>

<span class="nt">input</span> <span class="p">{</span>
    <span class="k">color</span><span class="p">:</span> <span class="kc">black</span><span class="p">;</span>
<span class="p">}</span>

<span class="p">.</span><span class="nc">btn</span> <span class="p">{</span>
    <span class="k">background</span><span class="p">:</span> <span class="kc">white</span><span class="p">;</span>
    <span class="k">color</span><span class="p">:</span> <span class="kc">black</span><span class="p">;</span>
    <span class="k">padding</span><span class="p">:</span> <span class="mi">4</span><span class="kt">px</span><span class="p">;</span>
<span class="p">}</span>

<span class="p">.</span><span class="nc">CodeMirror</span> <span class="p">{</span>
    <span class="k">font-size</span><span class="p">:</span> <span class="mi">12</span><span class="kt">px</span><span class="p">;</span>
    <span class="k">width</span><span class="p">:</span> <span class="mi">100</span><span class="kt">%</span><span class="p">;</span>
    <span class="k">padding-left</span><span class="p">:</span> <span class="mi">4</span><span class="kt">px</span><span class="p">;</span>
    <span class="k">line-height</span><span class="p">:</span> <span class="mi">1</span><span class="p">;</span>
    <span class="k">background</span><span class="p">:</span> <span class="kc">transparent</span> <span class="cp">!important</span><span class="p">;</span>
    <span class="k">color</span><span class="p">:</span> <span class="kc">white</span> <span class="cp">!important</span><span class="p">;</span>
    <span class="k">font-family</span><span class="p">:</span> <span class="s1">&#39;Roboto Mono&#39;</span><span class="p">,</span> <span class="kc">monospace</span> <span class="cp">!important</span><span class="p">;</span>
<span class="p">}</span>

<span class="p">.</span><span class="nc">CodeMirror-vscrollbar</span><span class="o">,</span> <span class="p">.</span><span class="nc">CodeMirror-hscrollbar</span> <span class="p">{</span>
    <span class="k">overflow-x</span><span class="p">:</span> <span class="kc">hidden</span> <span class="cp">!important</span><span class="p">;</span>
    <span class="k">overflow-y</span><span class="p">:</span> <span class="kc">hidden</span> <span class="cp">!important</span><span class="p">;</span>
<span class="p">}</span>

<span class="p">.</span><span class="nc">CodeMirror-cursor</span> <span class="p">{</span>
  <span class="k">border-left</span><span class="p">:</span> <span class="mi">2</span><span class="kt">px</span> <span class="kc">solid</span> <span class="kc">white</span> <span class="cp">!important</span><span class="p">;</span>
<span class="p">}</span>

<span class="p">.</span><span class="nc">CodeMirror</span> <span class="nt">pre</span><span class="o">,</span>
<span class="p">.</span><span class="nc">CodeMirror-line</span> <span class="o">&gt;</span> <span class="nt">span</span><span class="o">,</span>
<span class="p">.</span><span class="nc">CodeMirror-lines</span> <span class="p">{</span>
  <span class="k">padding</span><span class="p">:</span> <span class="mi">0</span> <span class="cp">!important</span><span class="p">;</span>
<span class="p">}</span>


        <span class="p">&lt;/</span><span class="nt">style</span><span class="p">&gt;</span>

        <span class="p">&lt;</span><span class="nt">script</span> <span class="na">type</span><span class="o">=</span><span class="s">&quot;riot/tag&quot;</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;/components/bitrhythm.tag&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">script</span> <span class="na">type</span><span class="o">=</span><span class="s">&quot;riot/tag&quot;</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;/components/dial.tag&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">script</span> <span class="na">type</span><span class="o">=</span><span class="s">&quot;riot/tag&quot;</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;/components/sample.tag&quot;</span> <span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">script</span> <span class="na">type</span><span class="o">=</span><span class="s">&quot;riot/tag&quot;</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;/components/number.tag&quot;</span> <span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>

        <span class="p">&lt;</span><span class="nt">script</span><span class="p">&gt;</span>
            <span class="nb">window</span><span class="p">.</span><span class="nx">goatcounter</span> <span class="o">=</span> <span class="p">{</span>
                <span class="nx">path</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">p</span><span class="p">)</span> <span class="p">{</span> <span class="k">return</span> <span class="nx">location</span><span class="p">.</span><span class="nx">host</span> <span class="o">+</span> <span class="nx">p</span> <span class="p">}</span>
            <span class="p">}</span>
        <span class="p">&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
	    <span class="p">&lt;</span><span class="nt">script</span> <span class="na">data-goatcounter</span><span class="o">=</span><span class="s">&quot;https://analytics.xyzzyapps.link/count&quot;</span> <span class="na">async</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;//analytics.xyzzyapps.link/count.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
    <span class="p">&lt;/</span><span class="nt">head</span><span class="p">&gt;</span>

    <span class="p">&lt;</span><span class="nt">body</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;containera-full&quot;</span><span class="p">&gt;</span>
            <span class="p">&lt;</span><span class="nt">hstack</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;mb-2&quot;</span><span class="p">&gt;</span>
                <span class="p">&lt;</span><span class="nt">h5</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;ml-4&quot;</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;/docs/index.html&quot;</span> <span class="na">target</span><span class="o">=</span><span class="s">&quot;_blank&quot;</span><span class="p">&gt;</span>Docs<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">h5</span><span class="p">&gt;</span>
                <span class="p">&lt;</span><span class="nt">h5</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;ml-4&quot;</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">target</span><span class="o">=</span><span class="s">&quot;_blank&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;/issue&quot;</span><span class="p">&gt;</span>Report bugs / Feedback<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">h5</span><span class="p">&gt;</span>
                <span class="p">&lt;</span><span class="nt">h5</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;ml-4&quot;</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;/song/XQAAAALHCwAAAAAAAABDKUqGU5vI8Eygv8VLc6H1NFIzdYQ4SmT-79BTKosH6Xje2IYnNRgEOpeuhg9Ej9Iz-_uEg-npGX0y9CmzyyVpwgaOUrKNlF-pzVXf3YmslEqBloRY0JslK5KapeSFSSH9ScweRgAPu9a4t1L0-t71Xb9Eb3KJ-lezPo7xcmK9xCnNGorm__kixtPuM_8L3YNc30OA3GMBPHu5pAH__cKjLF6k5mCGKsNp8WFWYQACckBR03VaZGhfZv946NYyFQlw6boXQuVis292UUboEkaCJ0CV5wGurbJUA7il2uX-okyMSjx7WVseVG-zDQ0wBjbMLNYnXzoT0kYxI_6-GOAOVamJJHTrkulVfd1k0AgzCHByI6zCNtWyBa3i_2ks4ncMec8vqsjAy8BhwFAbKAP1RDKh7MUxwsecBuzyLR0hKGddivZmPn-xyYB-p8-Xru_Min2-3Z_3YZal2_wv8s6cIcqPAJ4wf5DH29U7le-eRLcUN6lhK77651_xeU--z7A6E3NDQ6WEb6UPc-brxTz-L-wZwFwy95QkwAZw4bWR2LNW78DVdCSnMC8zf-DVWgFkKP9SU9iGQj6yk6E8qBAlZfd3YavthZBdwhs2mtzsvIL8qcBTBRhy2Fxx5n5tLq2lXuPkH19-cqIoJCHJUjiuGKWh3PqOAnTj9n2PejvNlp1GUMMixR7YMUofcLeA5oQCQpMSuIEP8sUshtk3zY35vG4xr3FfPj7OZiOQx5jRtMaw7l8xqFVm_PZ-kEgxoIVFtpZFcgsACnuBeJF1yZ2ss1GN95XEt9BsF3UY_UM1x8ePgY8BL4WH7BcHZRCOV2YZeRXZ6sYLNjKBjGVD_FAR_ZL6yd6l_1wqpQJPb3lL1fhBecNTcaXAn61RhySOvokAJ5TcrTtqdhsGEBUnaQOGRIfKU0NV4zPmgTm9TLASz5gs1VRoUZ06htWirfNfjiWNrbw8I9ggo8KMKwDZ2v4CnfqyL4eCpFNZjVIYOEWGGktLAadafQjdjOkWHWF8KIdr3uPBt1kXY_-IEkn11gjmn1q9ybgMLxriz7kWqzyawAEpqM27wzIwET2smzbJ-zHcx01rdHu3AqLMHk-AliQLGvGknluJNjWmK-WFwZUR8ZokJ6cVYW70a6X1dYWncQsPwyC3AOplDyUChlC_Rmgvz9fqeMs-fXub0odr01b7PFrraLWJ02Xk7trVq_Gqh8V2A2LATUKewJT05dG0bVJTBdM9n86C-mgyLf7s7JeNf9ul97CsS3BalNZ--N0hfkPbT_VPU9heFko9goG_mkF7Ky6FbtVpERCqw7UbvPgdFdIOEkoqPYEwAmjwzva2U-7cLo3g3uEQq1NBV3C8LijP10-1Avqu2df_R8XtykOk4H8yitylcxka4vSq1Jo2fv-wp74EiJi6Tn6T3epZJYXAMBRXRxozyl1r4lbOqRjDfqjWRTRrr8l9U2iKbAiIz6Ssy74Ic9sQABR9F4UahwsDQuJgjOHKdaLXmBHoPuD7nX_9mMYV&quot;</span><span class="p">&gt;</span>Example1<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">h5</span><span class="p">&gt;</span>
                <span class="p">&lt;</span><span class="nt">h5</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;ml-4&quot;</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;/song/XQAAAALYEwAAAAAAAABDKUqGU5vI8Eygv8VLc6H1NFIzdYQe5mT-79BTKosH6Xje2IYnNRgEOpeuhg9NTfIT-_uEg-npGX0y9CmzyyVpwgaOUrKNlF-pzVXf3YnQ2gSfpzY3zlYLujavQRq73hSEM-RaGxTxuud9naok9rMpYn-UCaNiF2zrnnqUB61s_22pYOE_9KuFo7vEJMCtU2bkxyNdgSXzwmIDuo8OyxcIh9HQP59UZbNRixlBnmw73PnywS5DJBoH8NEIAnlLpL4rqaokfN9Cfte0Id3929n26IjA7zVZF75ovX37KO1xT9iBa8gt-w8cvYBdIdVL5JUOrbf0ccVJSoXGFoM0U4GXoEDThw00FdKnfsq1WeJjEQt4Qn8f90TkkQgkpSajR9dA0AJBqKDuVeEgDoFsbVI-ZZVvJW2dD_9GIm5PpQSTzpuBslzD7ZJQSI3XA1g2F_QP4w6U4rOrTMZUQSr___s22d8Plp0FbffDCq8dri0C8kUYPqS_np_Nnr7sDY9KsxgNZJmUxYkt1XBTO3iWmR6RZ7OFk6PZ8R44NXwhvxbUEikMoboPSW1XPiV4xtCfZb4qE4yCP2xHPlEniUhcNrWc5608hrNkVfpQUmYLFvXFTyUHA4aOkRDoHf0jHwGzyBV-YanP65YlZpupZC4oW3bjhO01tfh_qYWNA_ZpDVCCXRoGZJfrBjkmaYom9Gd6mvGVzillbk6LD0_Amu_Zublb4_AZ1SAxKSWlMfbmbXQfW16RSMidtmTCKAMmF9LCONKcjTR_1P2vU3fPR7hBhRtbtNR0xNEfRstXJ81ZcyC5YTK8dnpMwMXKk5uoaBMDbochbAKXaswgZKIn2usyi5Z4pyQf8xCSheQawyYSA031ZHA3wRuq_7rjhn0bXZrEGnB0QFzxgM-dYsY7CUojKr8ziZGXGb9zoVHvGDI0SIFyFIrMs6kEzpZAq_CnJyqJi4nbbqfoHlE3nDyLNKFk1e4OHqPsU9G1LRNnHBwSjiJCnvZO_xv_VQbtWmQwLrT7j6PZeXvNOz-yKWQFcE-0RXn6-EuqT7LNTF1GSo2o9AFS5Z2PJqIXioD9ebr9xjFXNrfTdIe32dgcgQHVHNyjEIH22AABUQWYtHRvZQpcfsUjJQM140MJ8nmpjmxlhtAMEstPzbGYUKZdjhF1LkeePxXD46zniN9cFEtRPTNR9luP4W2rhfHnvP4_tRAipmQiB_6RSRvLaiVYfkYYXdzMkX_M5blfwCKQ-DyDFy0hTw3mYZ-SbYT11RVO-5dEm_YntYmgQOI1FI7AhMxpmyE27Lwb73oDO0SeS-SDj4T6nbfltfHdWDPFaeUWd12KRmI-E8AQCcnmJayoBnMXyXNw3muX0319WhuitTtab3n3vwZM1e7ku11q1rNoaA3VXLbBJdyS1Vxvdvm8Tled56S54siOsEYGRqmdiC3gO2ZGaBq68SJZ9zxe9yttNFEXFFgWYFnIn_EMSTNj1ILB0wkOQPzsjFXEEa3W6esXTujFuoHK05q4rrfYicKZkq01hfaoZcovIbDFNyGtpgEzn-BFPJXKWwqn5gkgrvZiYxVxG7a449Gjj_R2HqNbbiTmd1la0MKDnVLWv9yXXRdRLQrKC4Z2kAJIOdwxluk6fRBFzRWT_o046yjM-nvgp3KLJU-n_CWu3mgfmQi5vCbNxRczEeyaJGg3DJL-anxXk0A2CFsFCXRLccmhHV7MjQdh4sdvnvl3JO1Ypt1_nsBXQJqXvahwkjpEC5jzduvTd0rIHgDBAzO3PA7YNjWF_r1EmagtsB_1VFSRqAQdXjbEep8SLKNqv8N7ILkix2NeTM30r9xyXtXcGOOmoQK4AMk1tHBmQ4m6YYNalWXJ_aGIjdBgx4jgsRYjWp1H9qRr0wMkmG75zOSbuOy_lg5-C-xbszvp7B5YELZblpjnpXCW8AhXMWCLM_iG16lkgw24Z40VWh4Q9DCXoMgZmOXm-98WidEFfkMP_8L7sdQjWRxMAodkLhUkHnsBRlYNChmAexNvzKW3xiiDhC_k6qKRfldVgCGSBFfpldJF_8e7EyQ&quot;</span><span class="p">&gt;</span>Example2<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">h5</span><span class="p">&gt;</span>
                <span class="p">&lt;</span><span class="nt">h5</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;ml-4&quot;</span><span class="p">&gt;&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;/docs/demo.html&quot;</span><span class="p">&gt;</span>See Demo Song // Techno<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;&lt;/</span><span class="nt">h5</span><span class="p">&gt;</span>
            <span class="p">&lt;/</span><span class="nt">hstack</span><span class="p">&gt;</span>

            <span class="p">&lt;</span><span class="nt">bitrhythm</span> <span class="na">song</span><span class="o">=</span><span class="s">&quot;{{data}}&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">bitrhythm</span><span class="p">&gt;</span>
        <span class="p">&lt;/</span><span class="nt">div</span><span class="p">&gt;</span>

    <span class="p">&lt;</span><span class="nt">script</span><span class="p">&gt;</span>
        <span class="nx">riot</span><span class="p">.</span><span class="nx">compile</span><span class="p">(</span><span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
            <span class="kd">var</span> <span class="nx">bitrhythm</span> <span class="o">=</span> <span class="nx">riot</span><span class="p">.</span><span class="nx">mount</span><span class="p">(</span><span class="s1">&#39;bitrhythm&#39;</span><span class="p">);</span>
            <span class="nb">window</span><span class="p">.</span><span class="nx">bitrhythm</span> <span class="o">=</span> <span class="nx">bitrhythm</span><span class="p">[</span><span class="mf">0</span><span class="p">];</span>
            <span class="kd">var</span> <span class="nx">dial</span> <span class="o">=</span> <span class="nx">riot</span><span class="p">.</span><span class="nx">mount</span><span class="p">(</span><span class="s1">&#39;dial&#39;</span><span class="p">);</span>
            <span class="kd">var</span> <span class="nx">number</span> <span class="o">=</span> <span class="nx">riot</span><span class="p">.</span><span class="nx">mount</span><span class="p">(</span><span class="s1">&#39;number&#39;</span><span class="p">);</span>
            <span class="kd">var</span> <span class="nx">sample</span> <span class="o">=</span> <span class="nx">riot</span><span class="p">.</span><span class="nx">mount</span><span class="p">(</span><span class="s1">&#39;sample&#39;</span><span class="p">);</span>
        <span class="p">})</span>
    <span class="p">&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>


    <span class="p">&lt;/</span><span class="nt">body</span><span class="p">&gt;</span>

<span class="p">&lt;/</span><span class="nt">html</span><span class="p">&gt;</span>
</pre></div>
</div>
</div>
<div class="section" id="page">
<h2>Page<a class="headerlink" href="#page" title="Permalink to this headline">¶</a></h2>
<div class="highlight-html notranslate"><div class="highlight"><pre><span></span><span class="cp">&lt;!DOCTYPE html&gt;</span>
<span class="p">&lt;</span><span class="nt">html</span> <span class="na">lang</span><span class="o">=</span><span class="s">&quot;en&quot;</span><span class="p">&gt;</span>
    <span class="p">&lt;</span><span class="nt">head</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">meta</span> <span class="na">charset</span><span class="o">=</span><span class="s">&quot;utf-8&quot;</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">meta</span> <span class="na">name</span><span class="o">=</span><span class="s">&quot;viewport&quot;</span> <span class="na">content</span><span class="o">=</span><span class="s">&quot;width=device-width, initial-scale=1&quot;</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">meta</span> <span class="na">http-equiv</span><span class="o">=</span><span class="s">&quot;Cache-Control&quot;</span> <span class="na">content</span><span class="o">=</span><span class="s">&quot;no-cache, no-store, must-revalidate&quot;</span> <span class="p">/&gt;</span>
        <span class="p">&lt;</span><span class="nt">meta</span> <span class="na">http-equiv</span><span class="o">=</span><span class="s">&quot;Pragma&quot;</span> <span class="na">content</span><span class="o">=</span><span class="s">&quot;no-cache&quot;</span> <span class="p">/&gt;</span>
        <span class="p">&lt;</span><span class="nt">meta</span> <span class="na">http-equiv</span><span class="o">=</span><span class="s">&quot;Expires&quot;</span> <span class="na">content</span><span class="o">=</span><span class="s">&quot;0&quot;</span> <span class="p">/&gt;</span>
        <span class="p">&lt;</span><span class="nt">title</span><span class="p">&gt;</span>About birthythm<span class="p">&lt;/</span><span class="nt">title</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">link</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;icon&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;favicon.ico&quot;</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">style</span><span class="p">&gt;</span>
        <span class="nt">html</span><span class="o">,</span> <span class="nt">body</span> <span class="p">{</span>
            <span class="k">margin</span><span class="p">:</span> <span class="mi">0</span><span class="p">;</span>
            <span class="k">width</span><span class="p">:</span> <span class="mi">100</span><span class="kt">%</span><span class="p">;</span>
            <span class="k">height</span><span class="p">:</span> <span class="mi">100</span><span class="kt">%</span><span class="p">;</span>
            <span class="k">padding</span><span class="p">:</span> <span class="mi">0</span><span class="p">;</span>
        <span class="p">}</span>
        <span class="nt">iframe</span> <span class="p">{</span>
            <span class="k">position</span><span class="p">:</span><span class="kc">fixed</span><span class="p">;</span>
            <span class="k">top</span><span class="p">:</span><span class="mi">0</span><span class="p">;</span>
            <span class="k">left</span><span class="p">:</span><span class="mi">0</span><span class="p">;</span>
            <span class="k">bottom</span><span class="p">:</span><span class="mi">0</span><span class="p">;</span>
            <span class="k">right</span><span class="p">:</span><span class="mi">0</span><span class="p">;</span>
            <span class="k">width</span><span class="p">:</span><span class="mi">100</span><span class="kt">%</span><span class="p">;</span>
            <span class="k">height</span><span class="p">:</span><span class="mi">100</span><span class="kt">%</span><span class="p">;</span>
            <span class="k">border</span><span class="p">:</span><span class="kc">none</span><span class="p">;</span>
            <span class="k">margin</span><span class="p">:</span><span class="mi">0</span><span class="p">;</span>
            <span class="k">padding</span><span class="p">:</span><span class="mi">0</span><span class="p">;</span>
            <span class="k">overflow</span><span class="p">:</span><span class="kc">hidden</span><span class="p">;</span>
            <span class="k">z-index</span><span class="p">:</span><span class="mi">999999</span><span class="p">;</span>
        <span class="p">}</span>
        <span class="p">&lt;/</span><span class="nt">style</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">link</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css&quot;</span> <span class="na">rel</span><span class="o">=</span><span class="s">&quot;stylesheet&quot;</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">script</span><span class="p">&gt;</span>
            <span class="nb">window</span><span class="p">.</span><span class="nx">goatcounter</span> <span class="o">=</span> <span class="p">{</span>
                <span class="nx">path</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">p</span><span class="p">)</span> <span class="p">{</span> <span class="k">return</span> <span class="nx">location</span><span class="p">.</span><span class="nx">host</span> <span class="o">+</span> <span class="nx">p</span> <span class="p">}</span>
            <span class="p">}</span>
        <span class="p">&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">script</span> <span class="na">data-goatcounter</span><span class="o">=</span><span class="s">&quot;https://analytics.xyzzyapps.link/count&quot;</span> <span class="na">async</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;//analytics.xyzzyapps.link/count.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
    <span class="p">&lt;/</span><span class="nt">head</span><span class="p">&gt;</span>
    <span class="p">&lt;</span><span class="nt">body</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">iframe</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://blog.xyzzyapps.link/bitrhythm-submit-issue-feedback&quot;</span> <span class="na">frameborder</span><span class="o">=</span><span class="s">&quot;0&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">iframe</span><span class="p">&gt;</span>
    <span class="p">&lt;/</span><span class="nt">body</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">html</span><span class="p">&gt;</span>
</pre></div>
</div>
</div>
<div class="section" id="javascript">
<h2>Javascript<a class="headerlink" href="#javascript" title="Permalink to this headline">¶</a></h2>
<div class="highlight-js notranslate"><div class="highlight"><pre><span></span><span class="kd">function</span> <span class="nx">initWinamp</span><span class="p">(</span><span class="nx">preset</span><span class="p">)</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">can</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s2">&quot;visual&quot;</span><span class="p">);</span>
    <span class="nx">can</span><span class="p">.</span><span class="nx">height</span> <span class="o">=</span> <span class="nb">window</span><span class="p">.</span><span class="nx">innerHeight</span> <span class="o">-</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s2">&quot;header-playback&quot;</span><span class="p">).</span><span class="nx">clientHeight</span> <span class="o">-</span> <span class="mf">75</span><span class="p">;</span>
    <span class="nx">can</span><span class="p">.</span><span class="nx">width</span> <span class="o">=</span> <span class="nb">window</span><span class="p">.</span><span class="nx">innerWidth</span><span class="p">;</span>







<
<
<
<
<







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







<
<
<
<







 







>







 







<
<
<
<
<
<
<
<
<
<
<
<







 







>







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







183
184
185
186
187
188
189





190
191
192
193
194
195
196
...
219
220
221
222
223
224
225















226
227
228
229
230
231
232
...
238
239
240
241
242
243
244




245
246
247
248
249
250
251
...
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
...
573
574
575
576
577
578
579












580
581
582
583
584
585
586
...
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
...
942
943
944
945
946
947
948


































































































































































































































































949
950
951
952
953
954
955
        <div class="d-none d-md-block col-md-2 bd-toc show">
            
            <div class="tocsection onthispage pt-5 pb-3">
                <i class="fas fa-list"></i> Contents
            </div>
            <nav id="bd-toc-nav">
                <ul class="visible nav section-nav flex-column">





 <li class="toc-h2 nav-item toc-entry">
  <a class="reference internal nav-link" href="#core-tracker-loop">
   Core Tracker Loop
  </a>
  <ul class="nav section-nav flex-column">
   <li class="toc-h3 nav-item toc-entry">
    <a class="reference internal nav-link" href="#observers">
................................................................................
   Main UI
  </a>
 </li>
 <li class="toc-h2 nav-item toc-entry">
  <a class="reference internal nav-link" href="#sample">
   Sample
  </a>















 </li>
 <li class="toc-h2 nav-item toc-entry">
  <a class="reference internal nav-link" href="#javascript">
   Javascript
  </a>
 </li>
</ul>
................................................................................
    <div id="main-content" class="row">
        <div class="col-12 col-md-9 pl-md-3 pr-md-0">
        
              <div>
                
  <div class="section" id="concepts-and-code-walkthrough">
<h1>Concepts and Code Walkthrough<a class="headerlink" href="#concepts-and-code-walkthrough" title="Permalink to this headline">¶</a></h1>




<div class="section" id="core-tracker-loop">
<h2>Core Tracker Loop<a class="headerlink" href="#core-tracker-loop" title="Permalink to this headline">¶</a></h2>
<p>In bitrhythm code is evaluated for every cycle.</p>
<p>1 beat = 60 / tempo
1 cycle = 1 beat / ticks</p>
<p>For every cycle visual and audio code is evaluated.</p>
<p>The edit checkbox allows you to perform long edits, where only old code is evaluated. Once you disable it, all the new edit changes are applied in the next cycle.</p>
................................................................................
<div class="section" id="observers">
<h3>Observers<a class="headerlink" href="#observers" title="Permalink to this headline">¶</a></h3>
<p>Sidechain compression is a simple algorithm which observes amplitude of another instrument but you can generalise it to anything. By attaching observers  to time or other instruments you can create sections within the song that can trigger others with conditional logic. This is similar to pure data’s bangs - <a class="reference external" href="https://www.youtube.com/watch?v=nTTZZyD4xlE">see this</a>. In future this will be referred to as side events. You could decrease the volume of the drums to have the snares drop automatically for example.</p>
<p>This is something that you can’t do in DAWs.</p>
<div class="highlight-js notranslate"><div class="highlight"><pre><span></span><span class="k">async</span> <span class="nx">play</span><span class="p">()</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">self</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>
    <span class="kd">var</span> <span class="nx">cellx</span> <span class="o">=</span> <span class="nb">window</span><span class="p">.</span><span class="nx">cellx</span><span class="p">.</span><span class="nx">cellx</span><span class="p">;</span>
    <span class="kd">var</span> <span class="nx">$</span> <span class="o">=</span> <span class="nx">jQuery</span><span class="p">;</span>

    <span class="k">await</span> <span class="nx">Tone</span><span class="p">.</span><span class="nx">start</span><span class="p">();</span>
    <span class="nx">Tone</span><span class="p">.</span><span class="nx">Transport</span><span class="p">.</span><span class="nx">start</span><span class="p">();</span>
    <span class="nx">Tone</span><span class="p">.</span><span class="nx">Transport</span><span class="p">.</span><span class="nx">bpm</span><span class="p">.</span><span class="nx">value</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">state</span><span class="p">.</span><span class="nx">tempo</span><span class="p">;</span>
    <span class="nx">Tone</span><span class="p">.</span><span class="nx">Transport</span><span class="p">.</span><span class="nx">swing</span><span class="p">.</span><span class="nx">value</span> <span class="o">=</span> <span class="mf">0</span><span class="p">;</span>

    <span class="kd">var</span> <span class="nx">transition</span> <span class="o">=</span> <span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
................................................................................
    <span class="k">return</span> <span class="nx">context</span><span class="p">.</span><span class="nx">knob</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
</div>
</div>
<div class="section" id="main-ui">
<h2>Main UI<a class="headerlink" href="#main-ui" title="Permalink to this headline">¶</a></h2>












<div class="highlight-html notranslate"><div class="highlight"><pre><span></span><span class="p">&lt;</span><span class="nt">bitrhythm</span><span class="p">&gt;</span>

<span class="p">&lt;</span><span class="nt">div</span><span class="p">&gt;</span>
    <span class="p">&lt;</span><span class="nt">vstack</span> <span class="na">id</span><span class="o">=</span><span class="s">&quot;header-playback&quot;</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">hstack</span><span class="p">&gt;</span>
            <span class="p">&lt;</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;ml-2&quot;</span><span class="p">&gt;</span>
                <span class="p">&lt;</span><span class="nt">button</span> <span class="na">type</span><span class="o">=</span><span class="s">&quot;button&quot;</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;btn btn-primary w-1/10 ml-2 mt-1&quot;</span> <span class="na">onclick</span><span class="o">=</span><span class="s">{addDial}</span><span class="p">&gt;</span>+ Dial<span class="p">&lt;/</span><span class="nt">button</span><span class="p">&gt;</span>
................................................................................
            <span class="p">&lt;</span><span class="nt">div</span> <span class="na">each</span><span class="o">=</span><span class="s">{</span> <span class="na">key</span><span class="err">,</span> <span class="na">index</span> <span class="na">in</span> <span class="na">state</span><span class="err">.</span><span class="na">numbers</span><span class="err">}</span><span class="p">&gt;</span>
                <span class="p">&lt;</span><span class="nt">number</span> <span class="na">rmnumber</span><span class="o">=</span><span class="s">{rmNumber}</span> <span class="na">v</span><span class="o">=</span><span class="s">{state.numbers[index]}</span> <span class="na">ti</span><span class="o">=</span><span class="s">{index</span> <span class="err">+</span> <span class="na">1</span><span class="err">}</span><span class="p">&gt;&lt;/</span><span class="nt">number</span><span class="p">&gt;</span>
            <span class="p">&lt;/</span><span class="nt">div</span><span class="p">&gt;</span>
        <span class="p">&lt;/</span><span class="nt">hstack</span><span class="p">&gt;</span>

    <span class="p">&lt;/</span><span class="nt">vstack</span><span class="p">&gt;</span>

    <span class="p">&lt;</span><span class="nt">div</span> <span class="na">id</span><span class="o">=</span><span class="s">&quot;cue&quot;</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;p-2&quot;</span> <span class="na">style</span><span class="o">=</span><span class="s">&quot;color: white !important; height: 32px; font-size: 24px;&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">div</span><span class="p">&gt;</span>
    <span class="p">&lt;</span><span class="nt">div</span> <span class="na">id</span><span class="o">=</span><span class="s">&quot;error&quot;</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;p-2&quot;</span> <span class="na">style</span><span class="o">=</span><span class="s">&quot;color: yellow !important; height: 32px; font-size: 12px;&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">div</span><span class="p">&gt;</span>
    <span class="p">&lt;</span><span class="nt">div</span> <span class="na">id</span><span class="o">=</span><span class="s">&quot;canvas-container&quot;</span> <span class="na">style</span><span class="o">=</span><span class="s">&quot;position: relative;&quot;</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">div</span> <span class="na">id</span><span class="o">=</span><span class="s">&quot;p5&quot;</span> <span class="na">style</span><span class="o">=</span><span class="s">&quot;position: absolute; width: 100%; background: black&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">div</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">canvas</span> <span class="na">id</span><span class="o">=</span><span class="s">&quot;visual&quot;</span> <span class="na">style</span><span class="o">=</span><span class="s">&quot;position: absolute; width: 100%; background: black;&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">canvas</span><span class="p">&gt;</span>
        <span class="p">&lt;</span><span class="nt">div</span> <span class="na">id</span><span class="o">=</span><span class="s">&quot;code&quot;</span> <span class="na">style</span><span class="o">=</span><span class="s">&quot;position: absolute;&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">div</span><span class="p">&gt;</span>
    <span class="p">&lt;/</span><span class="nt">div</span><span class="p">&gt;</span>
    
................................................................................
<span class="cm">        */</span>

    <span class="p">});</span>
   <span class="p">&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
<span class="p">&lt;/</span><span class="nt">sample</span><span class="p">&gt;</span>
</pre></div>
</div>


































































































































































































































































</div>
<div class="section" id="javascript">
<h2>Javascript<a class="headerlink" href="#javascript" title="Permalink to this headline">¶</a></h2>
<div class="highlight-js notranslate"><div class="highlight"><pre><span></span><span class="kd">function</span> <span class="nx">initWinamp</span><span class="p">(</span><span class="nx">preset</span><span class="p">)</span> <span class="p">{</span>
    <span class="kd">var</span> <span class="nx">can</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s2">&quot;visual&quot;</span><span class="p">);</span>
    <span class="nx">can</span><span class="p">.</span><span class="nx">height</span> <span class="o">=</span> <span class="nb">window</span><span class="p">.</span><span class="nx">innerHeight</span> <span class="o">-</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="s2">&quot;header-playback&quot;</span><span class="p">).</span><span class="nx">clientHeight</span> <span class="o">-</span> <span class="mf">75</span><span class="p">;</span>
    <span class="nx">can</span><span class="p">.</span><span class="nx">width</span> <span class="o">=</span> <span class="nb">window</span><span class="p">.</span><span class="nx">innerWidth</span><span class="p">;</span>

Changes to build/html/source-code.html.

188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
    <div id="main-content" class="row">
        <div class="col-12 col-md-9 pl-md-3 pr-md-0">
        
              <div>
                
  <div class="section" id="source-code-and-license">
<h1>Source Code and License<a class="headerlink" href="#source-code-and-license" title="Permalink to this headline">¶</a></h1>
<p>The literate code framework wheel uses extensively in this project is available <a class="reference external" href="https://xyzzyapps.link/wheel">here</a>.</p>
<p>The documentation, demo code and the source code in the following webpages is distributed under <a class="reference external" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">creative commons, attribution-noncommercial-sharealike license</a>. The source code is self-hosted using fossil <a class="reference external" href="https://fossil.xyzzyapps.link/bitrhythm/timeline">here</a>. You can report issues, browse and download the source code from fossil. An Iframe is provided below. You can also get the latest source code <a class="reference external" href="https://fossil.xyzzyapps.link/bitrhythm/download">here</a>.</p>
<iframe style="width:100%; height:75vh" src="https://fossil.xyzzyapps.link/bitrhythm/dir?ci=tip" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<p>Coding conventions</p>
<ol class="simple">
<li><p>4 Spaces</p></li>
<li><p>EcmaScript5</p></li>
</ol>







|







188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
    <div id="main-content" class="row">
        <div class="col-12 col-md-9 pl-md-3 pr-md-0">
        
              <div>
                
  <div class="section" id="source-code-and-license">
<h1>Source Code and License<a class="headerlink" href="#source-code-and-license" title="Permalink to this headline">¶</a></h1>
<p>The literate code framework wheel used extensively in this project is available <a class="reference external" href="https://xyzzyapps.link/wheel">here</a>.</p>
<p>The documentation, demo code and the source code in the following webpages is distributed under <a class="reference external" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">creative commons, attribution-noncommercial-sharealike license</a>. The source code is self-hosted using fossil <a class="reference external" href="https://fossil.xyzzyapps.link/bitrhythm/timeline">here</a>. You can report issues, browse and download the source code from fossil. An Iframe is provided below. You can also get the latest source code <a class="reference external" href="https://fossil.xyzzyapps.link/bitrhythm/download">here</a>.</p>
<iframe style="width:100%; height:75vh" src="https://fossil.xyzzyapps.link/bitrhythm/dir?ci=tip" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<p>Coding conventions</p>
<ol class="simple">
<li><p>4 Spaces</p></li>
<li><p>EcmaScript5</p></li>
</ol>

Changes to build/html/what.html.

256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
...
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
<span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://cdnjs.cloudflare.com/ajax/libs/tunajs/1.0.1/tuna-min.js&quot;</span> <span class="na">type</span><span class="o">=</span><span class="s">&quot;text/javascript&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://cdnjs.cloudflare.com/ajax/libs/tone/14.7.77/Tone.js&quot;</span> <span class="na">integrity</span><span class="o">=</span><span class="s">&quot;sha512-gwSDP1iEKl4KG0wi3N89RAJU91s78jb/TGC6lsbF5IyR2c19Rn7Jl1icK4K4kUiJNwQUEPI7o98T+GJVWNuvIQ==&quot;</span> <span class="na">crossorigin</span><span class="o">=</span><span class="s">&quot;anonymous&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;/teoria-master/teoria.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>

<span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://cdn.jsdelivr.net/npm/p5@1.3.1/lib/p5.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://cdn.jsdelivr.net/npm/d3@5.7.0/dist/d3.min.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://threejs.org/build/three.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://cdnjs.cloudflare.com/ajax/libs/paper.js/0.12.11/paper-full.min.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>

<span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://cdn.jsdelivr.net/npm/butterchurn@2.6.7/lib/butterchurn.min.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://cdn.jsdelivr.net/npm/butterchurn-presets@2.4.7/lib/butterchurnPresets.min.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>

<span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://cdn.jsdelivr.net/npm/webmidi@2.0.0&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://code.jquery.com/jquery-3.4.1.min.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;/nexus-js/dist/NexusUI.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://cdnjs.cloudflare.com/ajax/libs/cellx/1.10.19/cellx.umd.min.js&quot;</span> <span class="na">integrity</span><span class="o">=</span><span class="s">&quot;sha512-ojEcAP3e6N+n5MDKPW6CexXzuLDahDPkNZmzyRV4t2zqh9nwljJNuV8JGa+xjpnAaGB/FhsAU7P6IHEP0dtJQA==&quot;</span> <span class="na">crossorigin</span><span class="o">=</span><span class="s">&quot;anonymous&quot;</span> <span class="na">referrerpolicy</span><span class="o">=</span><span class="s">&quot;no-referrer&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
</pre></div>
</div>
<div class="section" id="about-author">
................................................................................
<p>For my music I moved onto Electribe, Renoise, Reaper and live looping with my guitar. I started exploring sonic pi in 2019 but TBH none of the live coding tools were doing what I wanted - basically tweaking /knob-twisting in techno so I started my work on this project. <a class="reference external" href="https://www.youtube.com/watch?v=adz1Gv5Lm34">This library</a> in sonic pi comes close to what I am trying todo with this project. In bitrhythm time is divided into ticks like renoise tracker.</p>
<p>After my initial work on the project in 2019, the project got sidetracked. After seeing <a class="reference external" href="https://www.vitling.xyz/toys/acid-banger/">endless acid banger</a> I had an epiphany to work on this project again. I was able to compose an endless and interactive dubtechno demo track. In March 2021, I also picked up on literate programming so this document will have both code and documentation intertwined.</p>
<p>The documentation for the literate programming project - wheel is <a class="reference external" href="https://xyzzyapps.link/wheel/">available here</a>.</p>
</div>
<div class="section" id="support-this-project">
<h2>Support this project<a class="headerlink" href="#support-this-project" title="Permalink to this headline">¶</a></h2>
<p>My goal is to make bitrhythm easy for both professionals and music learners. Support my work to get regular updates. Supporters will also get free accounts when I add pro features! Also get notified on latest developments and tutorials in the web audio world.</p>
<p><script src="https://gumroad.com/js/gumroad.js"></script><a class="gumroad-button" href="https://gumroad.com/l/kQSCv" target="_blank" rel="noopener"><span class="gumroad-button-logo"></span>Support Bitrhythm</a></p>
<p>You can find me on <a class="reference external" href="https://theaudioprogrammer.com/">theaudioprogrammer</a> and algorave discord as &#64;xyzzy.</p>
</div>
<div class="section" id="future-features">
<h2>Future Features<a class="headerlink" href="#future-features" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li><p>Saving Songs</p></li>
<li><p>More Synths with Presets</p></li>







<
<


<







 







|







256
257
258
259
260
261
262


263
264

265
266
267
268
269
270
271
...
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
<span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://cdnjs.cloudflare.com/ajax/libs/tunajs/1.0.1/tuna-min.js&quot;</span> <span class="na">type</span><span class="o">=</span><span class="s">&quot;text/javascript&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://cdnjs.cloudflare.com/ajax/libs/tone/14.7.77/Tone.js&quot;</span> <span class="na">integrity</span><span class="o">=</span><span class="s">&quot;sha512-gwSDP1iEKl4KG0wi3N89RAJU91s78jb/TGC6lsbF5IyR2c19Rn7Jl1icK4K4kUiJNwQUEPI7o98T+GJVWNuvIQ==&quot;</span> <span class="na">crossorigin</span><span class="o">=</span><span class="s">&quot;anonymous&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;/teoria-master/teoria.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>

<span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://cdn.jsdelivr.net/npm/p5@1.3.1/lib/p5.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://cdn.jsdelivr.net/npm/d3@5.7.0/dist/d3.min.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://threejs.org/build/three.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>


<span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://cdn.jsdelivr.net/npm/butterchurn@2.6.7/lib/butterchurn.min.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://cdn.jsdelivr.net/npm/butterchurn-presets@2.4.7/lib/butterchurnPresets.min.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>

<span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://cdn.jsdelivr.net/npm/webmidi@2.0.0&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://code.jquery.com/jquery-3.4.1.min.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;/nexus-js/dist/NexusUI.js&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">script</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;https://cdnjs.cloudflare.com/ajax/libs/cellx/1.10.19/cellx.umd.min.js&quot;</span> <span class="na">integrity</span><span class="o">=</span><span class="s">&quot;sha512-ojEcAP3e6N+n5MDKPW6CexXzuLDahDPkNZmzyRV4t2zqh9nwljJNuV8JGa+xjpnAaGB/FhsAU7P6IHEP0dtJQA==&quot;</span> <span class="na">crossorigin</span><span class="o">=</span><span class="s">&quot;anonymous&quot;</span> <span class="na">referrerpolicy</span><span class="o">=</span><span class="s">&quot;no-referrer&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
</pre></div>
</div>
<div class="section" id="about-author">
................................................................................
<p>For my music I moved onto Electribe, Renoise, Reaper and live looping with my guitar. I started exploring sonic pi in 2019 but TBH none of the live coding tools were doing what I wanted - basically tweaking /knob-twisting in techno so I started my work on this project. <a class="reference external" href="https://www.youtube.com/watch?v=adz1Gv5Lm34">This library</a> in sonic pi comes close to what I am trying todo with this project. In bitrhythm time is divided into ticks like renoise tracker.</p>
<p>After my initial work on the project in 2019, the project got sidetracked. After seeing <a class="reference external" href="https://www.vitling.xyz/toys/acid-banger/">endless acid banger</a> I had an epiphany to work on this project again. I was able to compose an endless and interactive dubtechno demo track. In March 2021, I also picked up on literate programming so this document will have both code and documentation intertwined.</p>
<p>The documentation for the literate programming project - wheel is <a class="reference external" href="https://xyzzyapps.link/wheel/">available here</a>.</p>
</div>
<div class="section" id="support-this-project">
<h2>Support this project<a class="headerlink" href="#support-this-project" title="Permalink to this headline">¶</a></h2>
<p>My goal is to make bitrhythm easy for both professionals and music learners. Support my work to get regular updates. Supporters will also get free accounts when I add pro features! Also get notified on latest developments and tutorials in the web audio world.</p>
<p><script src="https://gumroad.com/js/gumroad.js"></script><a class="gumroad-button" href="https://gumroad.com/l/iEVpN" target="_blank" rel="noopener"><span class="gumroad-button-logo"></span>Support Bitrhythm</a></p>
<p>You can find me on <a class="reference external" href="https://theaudioprogrammer.com/">theaudioprogrammer</a> and algorave discord as &#64;xyzzy.</p>
</div>
<div class="section" id="future-features">
<h2>Future Features<a class="headerlink" href="#future-features" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li><p>Saving Songs</p></li>
<li><p>More Synths with Presets</p></li>

Changes to public/components/bitrhythm.tag.

52
53
54
55
56
57
58

59
60
61
62
63
64
65
...
221
222
223
224
225
226
227

228
229
230
231
232
233
234
            <div each={ key, index in state.numbers}>
                <number rmnumber={rmNumber} v={state.numbers[index]} ti={index + 1}></number>
            </div>
        </hstack>

    </vstack>


    <div id="error" class="p-2" style="color: yellow !important; height: 32px; font-size: 12px;"></div>
    <div id="canvas-container" style="position: relative;">
        <div id="p5" style="position: absolute; width: 100%; background: black"></div>
        <canvas id="visual" style="position: absolute; width: 100%; background: black;"></canvas>
        <div id="code" style="position: absolute;"></div>
    </div>
    
................................................................................
}



async play() {
    var self = this;
    var cellx = window.cellx.cellx;


    await Tone.start();
    Tone.Transport.start();
    Tone.Transport.bpm.value = this.state.tempo;
    Tone.Transport.swing.value = 0;

    var transition = function () {







>







 







>







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
...
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
            <div each={ key, index in state.numbers}>
                <number rmnumber={rmNumber} v={state.numbers[index]} ti={index + 1}></number>
            </div>
        </hstack>

    </vstack>

    <div id="cue" class="p-2" style="color: white !important; height: 32px; font-size: 24px;"></div>
    <div id="error" class="p-2" style="color: yellow !important; height: 32px; font-size: 12px;"></div>
    <div id="canvas-container" style="position: relative;">
        <div id="p5" style="position: absolute; width: 100%; background: black"></div>
        <canvas id="visual" style="position: absolute; width: 100%; background: black;"></canvas>
        <div id="code" style="position: absolute;"></div>
    </div>
    
................................................................................
}



async play() {
    var self = this;
    var cellx = window.cellx.cellx;
    var $ = jQuery;

    await Tone.start();
    Tone.Transport.start();
    Tone.Transport.bpm.value = this.state.tempo;
    Tone.Transport.swing.value = 0;

    var transition = function () {

Changes to source/common.py.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<script src="https://cdnjs.cloudflare.com/ajax/libs/tunajs/1.0.1/tuna-min.js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tone/14.7.77/Tone.js" integrity="sha512-gwSDP1iEKl4KG0wi3N89RAJU91s78jb/TGC6lsbF5IyR2c19Rn7Jl1icK4K4kUiJNwQUEPI7o98T+GJVWNuvIQ==" crossorigin="anonymous"></script>
<script src="/teoria-master/teoria.js"></script>

<script src="https://cdn.jsdelivr.net/npm/p5@1.3.1/lib/p5.js"></script>
<script src="https://cdn.jsdelivr.net/npm/d3@5.7.0/dist/d3.min.js"></script>
<script src="https://threejs.org/build/three.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/paper.js/0.12.11/paper-full.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/butterchurn@2.6.7/lib/butterchurn.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/butterchurn-presets@2.4.7/lib/butterchurnPresets.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/webmidi@2.0.0"></script>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="/nexus-js/dist/NexusUI.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/cellx/1.10.19/cellx.umd.min.js" integrity="sha512-ojEcAP3e6N+n5MDKPW6CexXzuLDahDPkNZmzyRV4t2zqh9nwljJNuV8JGa+xjpnAaGB/FhsAU7P6IHEP0dtJQA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
"""








<
<


<






10
11
12
13
14
15
16


17
18

19
20
21
22
23
24
<script src="https://cdnjs.cloudflare.com/ajax/libs/tunajs/1.0.1/tuna-min.js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tone/14.7.77/Tone.js" integrity="sha512-gwSDP1iEKl4KG0wi3N89RAJU91s78jb/TGC6lsbF5IyR2c19Rn7Jl1icK4K4kUiJNwQUEPI7o98T+GJVWNuvIQ==" crossorigin="anonymous"></script>
<script src="/teoria-master/teoria.js"></script>

<script src="https://cdn.jsdelivr.net/npm/p5@1.3.1/lib/p5.js"></script>
<script src="https://cdn.jsdelivr.net/npm/d3@5.7.0/dist/d3.min.js"></script>
<script src="https://threejs.org/build/three.js"></script>


<script src="https://cdn.jsdelivr.net/npm/butterchurn@2.6.7/lib/butterchurn.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/butterchurn-presets@2.4.7/lib/butterchurnPresets.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/webmidi@2.0.0"></script>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="/nexus-js/dist/NexusUI.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/cellx/1.10.19/cellx.umd.min.js" integrity="sha512-ojEcAP3e6N+n5MDKPW6CexXzuLDahDPkNZmzyRV4t2zqh9nwljJNuV8JGa+xjpnAaGB/FhsAU7P6IHEP0dtJQA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
"""

Changes to source/main.cog.

55
56
57
58
59
60
61

62
63
64
65
66
67
68
...
519
520
521
522
523
524
525

526
527
528
529
530
531
532

@<
core_loop = """

async play() {
    var self = this;
    var cellx = window.cellx.cellx;


    await Tone.start();
    Tone.Transport.start();
    Tone.Transport.bpm.value = this.state.tempo;
    Tone.Transport.swing.value = 0;

    var transition = function () {
................................................................................
            <div each={ key, index in state.numbers}>
                <number rmnumber={rmNumber} v={state.numbers[index]} ti={index + 1}></number>
            </div>
        </hstack>

    </vstack>


    <div id="error" class="p-2" style="color: yellow !important; height: 32px; font-size: 12px;"></div>
    <div id="canvas-container" style="position: relative;">
        <div id="p5" style="position: absolute; width: 100%; background: black"></div>
        <canvas id="visual" style="position: absolute; width: 100%; background: black;"></canvas>
        <div id="code" style="position: absolute;"></div>
    </div>
    







>







 







>







55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
...
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534

@<
core_loop = """

async play() {
    var self = this;
    var cellx = window.cellx.cellx;
    var $ = jQuery;

    await Tone.start();
    Tone.Transport.start();
    Tone.Transport.bpm.value = this.state.tempo;
    Tone.Transport.swing.value = 0;

    var transition = function () {
................................................................................
            <div each={ key, index in state.numbers}>
                <number rmnumber={rmNumber} v={state.numbers[index]} ti={index + 1}></number>
            </div>
        </hstack>

    </vstack>

    <div id="cue" class="p-2" style="color: white !important; height: 32px; font-size: 24px;"></div>
    <div id="error" class="p-2" style="color: yellow !important; height: 32px; font-size: 12px;"></div>
    <div id="canvas-container" style="position: relative;">
        <div id="p5" style="position: absolute; width: 100%; background: black"></div>
        <canvas id="visual" style="position: absolute; width: 100%; background: black;"></canvas>
        <div id="code" style="position: absolute;"></div>
    </div>
    

Changes to source/main.md.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
..
39
40
41
42
43
44
45

46
47
48
49
50
51
52
...
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
...
453
454
455
456
457
458
459

460
461
462
463
464
465
466
...
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063

# Concepts and Code Walkthrough


## Running

ls source/main.cog | entr -r runserver.sh -b

## Core Tracker Loop

In bitrhythm code is evaluated for every cycle.

1 beat = 60 / tempo
1 cycle = 1 beat / ticks

................................................................................
---



async play() {
    var self = this;
    var cellx = window.cellx.cellx;


    await Tone.start();
    Tone.Transport.start();
    Tone.Transport.bpm.value = this.state.tempo;
    Tone.Transport.swing.value = 0;

    var transition = function () {
................................................................................
    return context.knob;
}
```

## Main UI


```
// Not working

.CodeMirror-selected,
.CodeMirror-focused,
.CodeMirror-activeline,
.CodeMirror-activeline-background {
    background: transparent;
    color: #882d2d;
    z-index: 5 !important;
}
```


```{code-block} html
---
force: true
---


................................................................................
            <div each={ key, index in state.numbers}>
                <number rmnumber={rmNumber} v={state.numbers[index]} ti={index + 1}></number>
            </div>
        </hstack>

    </vstack>


    <div id="error" class="p-2" style="color: yellow !important; height: 32px; font-size: 12px;"></div>
    <div id="canvas-container" style="position: relative;">
        <div id="p5" style="position: absolute; width: 100%; background: black"></div>
        <canvas id="visual" style="position: absolute; width: 100%; background: black;"></canvas>
        <div id="code" style="position: absolute;"></div>
    </div>
    
................................................................................

    });
   </script>
</sample>
```


## App

```{code-block} hylang
---
force: true
---

(import [sanic [Sanic response]])
(import [sanic.response [json text]])
(import [sanic.exceptions [NotFound abort]])
(import [jinja2 [Environment FileSystemLoader]])
(import re)
(import ipdb)
(import sys)
(import traceback)
(import json)
(import datetime)
(import [email.utils [format_datetime]])
(import [urllib.parse [urlparse]])
(import base64)

(setv file-loader (FileSystemLoader "templates"))
(setv env (Environment :loader file-loader))

(setv app (Sanic "Bitrhythm"))

(with-decorator
  (app.exception NotFound)
  (defn/a ignore_404s [request exception]
    (return (text (+ "Yep, I totally found the page " request.url)))
  )
)

(with-decorator
  (app.route "/song/<name>")
  (defn/a get-index [request name]
    (setv template (env.get_template "index.html"))
    (return (response.html (template.render {"data" name})))
  )
)

(with-decorator
  (app.route "/")
  (defn/a get-index [request]
    (setv template (env.get_template "index.html"))
    (return (response.html (template.render {"data" ""})))
  )
)

(with-decorator
  (app.route "/issue")
  (defn/a get-index [request]
    (setv template (env.get_template "page.html"))
    (return (response.html (template.render)))
  )
)

(app.static "/" "./public")

(defmain [&rest args]
    (app.run :host "0.0.0.0" :port 8015)
)

```


## Index

```{code-block} html
---
force: true
---

<!DOCTYPE html>
<html lang="en">

    <head>
        <meta charset="utf-8">

        <title>Bitrhythm</title>

        <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
        <meta http-equiv="Pragma" content="no-cache" />
        <meta http-equiv="Expires" content="0" />

        <meta content="Bitrhythm" name="description" xml:lang="en" lang="en">
        <meta content="literate programming, p5, live coding, algorave, demoscene, creative programming, music, techno, programming, webaudio, webgl, p5, improvising">

       ${common_scripts}

        <link rel="preconnect" href="https://fonts.gstatic.com">
        <link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100;0,200;0,300;0,400;0,500;0,700;1,100;1,200;1,300;1,400;1,500;1,700&display=swap" rel="stylesheet">
        <link href="https://fonts.googleapis.com/css2?family=Major+Mono+Display&family=Roboto+Mono:ital,wght@0,100;0,200;0,300;0,400;0,500;0,700;1,100;1,200;1,300;1,400;1,500;1,700&display=swap" rel="stylesheet">

        <script src="https://code.jquery.com/ui/1.12.0/jquery-ui.min.js"></script>
        <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.0/themes/smoothness/jquery-ui.css">
        <script src="https://cdnjs.cloudflare.com/ajax/libs/micromodal/0.4.6/micromodal.min.js" integrity="sha512-RMMh+IHzfZLsVFo1rX9PBoysxrJJqjyOS31HYWftobWtv2At6KBTqKpvVDIWAjL5aiV+LjFqkQ6e53Rdw3VOBg==" crossorigin="anonymous"></script>
        <script src="https://cdn.jsdelivr.net/npm/whenipress@1.8.0/dist/whenipress.js"></script>

        <script src="https://cdnjs.cloudflare.com/ajax/libs/AlertifyJS/1.13.1/alertify.min.js" integrity="sha512-JnjG+Wt53GspUQXQhc+c4j8SBERsgJAoHeehagKHlxQN+MtCCmFDghX9/AcbkkNRZptyZU4zC8utK59M5L45Iw==" crossorigin="anonymous"></script>
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/AlertifyJS/1.13.1/css/alertify.min.css" integrity="sha512-IXuoq1aFd2wXs4NqGskwX2Vb+I8UJ+tGJEu/Dc0zwLNKeQ7CW3Sr6v0yU3z5OQWe3eScVIkER4J9L7byrgR/fA==" crossorigin="anonymous" />
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/AlertifyJS/1.13.1/css/themes/default.min.css" integrity="sha512-RgUjDpwjEDzAb7nkShizCCJ+QTSLIiJO1ldtuxzs0UIBRH4QpOjUU9w47AF9ZlviqV/dOFGWF6o7l3lttEFb6g==" crossorigin="anonymous" />

        <script src="/json-url-master/dist/browser/json-url.js"></script>
        <script src="/riot-3.13.2/riot+compiler.js"></script>

        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.1.2/tailwind.min.css" integrity="sha512-RntatPOhEcQEA81gC/esYoCkGkL7AYV7TeTPoU+R9zE44/yWxVvLIBfBSaMu78rhoDd73ZeRHXRJN5+aPEK53Q==" crossorigin="anonymous" />
        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>

        <link rel="stylesheet" href="https://esironal.github.io/cmtouch/lib/codemirror.css">
        <link rel="stylesheet" href="https://esironal.github.io/cmtouch/addon/hint/show-hint.css">
        <script src="https://esironal.github.io/cmtouch/lib/codemirror.js"></script>
        <script src="https://esironal.github.io/cmtouch/addon/hint/show-hint.js"></script>
        <script src="http://esironal.github.io/cmtouch/addon/hint/xml-hint.js"></script>
        <script src="https://esironal.github.io/cmtouch/addon/hint/html-hint.js"></script>
        <script src="https://esironal.github.io/cmtouch/mode/xml/xml.js"></script>
        <script src="https://esironal.github.io/cmtouch/mode/javascript/javascript.js"></script>
        <script src="https://esironal.github.io/cmtouch/mode/css/css.js"></script>
        <script src="https://esironal.github.io/cmtouch/mode/htmlmixed/htmlmixed.js"></script>
        <script src="https://esironal.github.io/cmtouch/addon/selection/active-line.js"></script>
        <script src="https://esironal.github.io/cmtouch/addon/edit/matchbrackets.js"></script>
        <link rel="stylesheet" href="https://esironal.github.io/cmtouch/theme/neonsyntax.css">
        <link rel="stylesheet" href="https://unpkg.com/pyloncss@latest/css/pylon.css"/>


        <script src="/tune.js"></script>
        <script src="/misc.js"></script>

        <style type="text/css">
body {
    background: black;
    color: white;
    font-family: 'Roboto Mono', monospace;
}

a {
    color: white;
}

input {
    color: black;
}

.btn {
    background: white;
    color: black;
    padding: 4px;
}

.CodeMirror {
    font-size: 12px;
    width: 100%;
    padding-left: 4px;
    line-height: 1;
    background: transparent !important;
    color: white !important;
    font-family: 'Roboto Mono', monospace !important;
}

.CodeMirror-vscrollbar, .CodeMirror-hscrollbar {
    overflow-x: hidden !important;
    overflow-y: hidden !important;
}

.CodeMirror-cursor {
  border-left: 2px solid white !important;
}

.CodeMirror pre,
.CodeMirror-line > span,
.CodeMirror-lines {
  padding: 0 !important;
}


        </style>

        <script type="riot/tag" src="/components/bitrhythm.tag"></script>
        <script type="riot/tag" src="/components/dial.tag"></script>
        <script type="riot/tag" src="/components/sample.tag" ></script>
        <script type="riot/tag" src="/components/number.tag" ></script>

        <script>
            window.goatcounter = {
                path: function(p) { return location.host + p }
            }
        </script>
	    <script data-goatcounter="https://analytics.xyzzyapps.link/count" async src="//analytics.xyzzyapps.link/count.js"></script>
    </head>

    <body>
        <div class="containera-full">
            <hstack class="mb-2">
                <h5 class="ml-4"><a href="/docs/index.html" target="_blank">Docs</a></h5>
                <h5 class="ml-4"><a target="_blank" href="/issue">Report bugs / Feedback</a></h5>
                <h5 class="ml-4"><a href="/song/XQAAAALHCwAAAAAAAABDKUqGU5vI8Eygv8VLc6H1NFIzdYQ4SmT-79BTKosH6Xje2IYnNRgEOpeuhg9Ej9Iz-_uEg-npGX0y9CmzyyVpwgaOUrKNlF-pzVXf3YmslEqBloRY0JslK5KapeSFSSH9ScweRgAPu9a4t1L0-t71Xb9Eb3KJ-lezPo7xcmK9xCnNGorm__kixtPuM_8L3YNc30OA3GMBPHu5pAH__cKjLF6k5mCGKsNp8WFWYQACckBR03VaZGhfZv946NYyFQlw6boXQuVis292UUboEkaCJ0CV5wGurbJUA7il2uX-okyMSjx7WVseVG-zDQ0wBjbMLNYnXzoT0kYxI_6-GOAOVamJJHTrkulVfd1k0AgzCHByI6zCNtWyBa3i_2ks4ncMec8vqsjAy8BhwFAbKAP1RDKh7MUxwsecBuzyLR0hKGddivZmPn-xyYB-p8-Xru_Min2-3Z_3YZal2_wv8s6cIcqPAJ4wf5DH29U7le-eRLcUN6lhK77651_xeU--z7A6E3NDQ6WEb6UPc-brxTz-L-wZwFwy95QkwAZw4bWR2LNW78DVdCSnMC8zf-DVWgFkKP9SU9iGQj6yk6E8qBAlZfd3YavthZBdwhs2mtzsvIL8qcBTBRhy2Fxx5n5tLq2lXuPkH19-cqIoJCHJUjiuGKWh3PqOAnTj9n2PejvNlp1GUMMixR7YMUofcLeA5oQCQpMSuIEP8sUshtk3zY35vG4xr3FfPj7OZiOQx5jRtMaw7l8xqFVm_PZ-kEgxoIVFtpZFcgsACnuBeJF1yZ2ss1GN95XEt9BsF3UY_UM1x8ePgY8BL4WH7BcHZRCOV2YZeRXZ6sYLNjKBjGVD_FAR_ZL6yd6l_1wqpQJPb3lL1fhBecNTcaXAn61RhySOvokAJ5TcrTtqdhsGEBUnaQOGRIfKU0NV4zPmgTm9TLASz5gs1VRoUZ06htWirfNfjiWNrbw8I9ggo8KMKwDZ2v4CnfqyL4eCpFNZjVIYOEWGGktLAadafQjdjOkWHWF8KIdr3uPBt1kXY_-IEkn11gjmn1q9ybgMLxriz7kWqzyawAEpqM27wzIwET2smzbJ-zHcx01rdHu3AqLMHk-AliQLGvGknluJNjWmK-WFwZUR8ZokJ6cVYW70a6X1dYWncQsPwyC3AOplDyUChlC_Rmgvz9fqeMs-fXub0odr01b7PFrraLWJ02Xk7trVq_Gqh8V2A2LATUKewJT05dG0bVJTBdM9n86C-mgyLf7s7JeNf9ul97CsS3BalNZ--N0hfkPbT_VPU9heFko9goG_mkF7Ky6FbtVpERCqw7UbvPgdFdIOEkoqPYEwAmjwzva2U-7cLo3g3uEQq1NBV3C8LijP10-1Avqu2df_R8XtykOk4H8yitylcxka4vSq1Jo2fv-wp74EiJi6Tn6T3epZJYXAMBRXRxozyl1r4lbOqRjDfqjWRTRrr8l9U2iKbAiIz6Ssy74Ic9sQABR9F4UahwsDQuJgjOHKdaLXmBHoPuD7nX_9mMYV">Example1</a></h5>
                <h5 class="ml-4"><a href="/song/XQAAAALYEwAAAAAAAABDKUqGU5vI8Eygv8VLc6H1NFIzdYQe5mT-79BTKosH6Xje2IYnNRgEOpeuhg9NTfIT-_uEg-npGX0y9CmzyyVpwgaOUrKNlF-pzVXf3YnQ2gSfpzY3zlYLujavQRq73hSEM-RaGxTxuud9naok9rMpYn-UCaNiF2zrnnqUB61s_22pYOE_9KuFo7vEJMCtU2bkxyNdgSXzwmIDuo8OyxcIh9HQP59UZbNRixlBnmw73PnywS5DJBoH8NEIAnlLpL4rqaokfN9Cfte0Id3929n26IjA7zVZF75ovX37KO1xT9iBa8gt-w8cvYBdIdVL5JUOrbf0ccVJSoXGFoM0U4GXoEDThw00FdKnfsq1WeJjEQt4Qn8f90TkkQgkpSajR9dA0AJBqKDuVeEgDoFsbVI-ZZVvJW2dD_9GIm5PpQSTzpuBslzD7ZJQSI3XA1g2F_QP4w6U4rOrTMZUQSr___s22d8Plp0FbffDCq8dri0C8kUYPqS_np_Nnr7sDY9KsxgNZJmUxYkt1XBTO3iWmR6RZ7OFk6PZ8R44NXwhvxbUEikMoboPSW1XPiV4xtCfZb4qE4yCP2xHPlEniUhcNrWc5608hrNkVfpQUmYLFvXFTyUHA4aOkRDoHf0jHwGzyBV-YanP65YlZpupZC4oW3bjhO01tfh_qYWNA_ZpDVCCXRoGZJfrBjkmaYom9Gd6mvGVzillbk6LD0_Amu_Zublb4_AZ1SAxKSWlMfbmbXQfW16RSMidtmTCKAMmF9LCONKcjTR_1P2vU3fPR7hBhRtbtNR0xNEfRstXJ81ZcyC5YTK8dnpMwMXKk5uoaBMDbochbAKXaswgZKIn2usyi5Z4pyQf8xCSheQawyYSA031ZHA3wRuq_7rjhn0bXZrEGnB0QFzxgM-dYsY7CUojKr8ziZGXGb9zoVHvGDI0SIFyFIrMs6kEzpZAq_CnJyqJi4nbbqfoHlE3nDyLNKFk1e4OHqPsU9G1LRNnHBwSjiJCnvZO_xv_VQbtWmQwLrT7j6PZeXvNOz-yKWQFcE-0RXn6-EuqT7LNTF1GSo2o9AFS5Z2PJqIXioD9ebr9xjFXNrfTdIe32dgcgQHVHNyjEIH22AABUQWYtHRvZQpcfsUjJQM140MJ8nmpjmxlhtAMEstPzbGYUKZdjhF1LkeePxXD46zniN9cFEtRPTNR9luP4W2rhfHnvP4_tRAipmQiB_6RSRvLaiVYfkYYXdzMkX_M5blfwCKQ-DyDFy0hTw3mYZ-SbYT11RVO-5dEm_YntYmgQOI1FI7AhMxpmyE27Lwb73oDO0SeS-SDj4T6nbfltfHdWDPFaeUWd12KRmI-E8AQCcnmJayoBnMXyXNw3muX0319WhuitTtab3n3vwZM1e7ku11q1rNoaA3VXLbBJdyS1Vxvdvm8Tled56S54siOsEYGRqmdiC3gO2ZGaBq68SJZ9zxe9yttNFEXFFgWYFnIn_EMSTNj1ILB0wkOQPzsjFXEEa3W6esXTujFuoHK05q4rrfYicKZkq01hfaoZcovIbDFNyGtpgEzn-BFPJXKWwqn5gkgrvZiYxVxG7a449Gjj_R2HqNbbiTmd1la0MKDnVLWv9yXXRdRLQrKC4Z2kAJIOdwxluk6fRBFzRWT_o046yjM-nvgp3KLJU-n_CWu3mgfmQi5vCbNxRczEeyaJGg3DJL-anxXk0A2CFsFCXRLccmhHV7MjQdh4sdvnvl3JO1Ypt1_nsBXQJqXvahwkjpEC5jzduvTd0rIHgDBAzO3PA7YNjWF_r1EmagtsB_1VFSRqAQdXjbEep8SLKNqv8N7ILkix2NeTM30r9xyXtXcGOOmoQK4AMk1tHBmQ4m6YYNalWXJ_aGIjdBgx4jgsRYjWp1H9qRr0wMkmG75zOSbuOy_lg5-C-xbszvp7B5YELZblpjnpXCW8AhXMWCLM_iG16lkgw24Z40VWh4Q9DCXoMgZmOXm-98WidEFfkMP_8L7sdQjWRxMAodkLhUkHnsBRlYNChmAexNvzKW3xiiDhC_k6qKRfldVgCGSBFfpldJF_8e7EyQ">Example2</a></h5>
                <h5 class="ml-4"><a href="/docs/demo.html">See Demo Song // Techno</a></h5>
            </hstack>

            <bitrhythm song="{{data}}"></bitrhythm>
        </div>

    <script>
        riot.compile(function() {
            var bitrhythm = riot.mount('bitrhythm');
            window.bitrhythm = bitrhythm[0];
            var dial = riot.mount('dial');
            var number = riot.mount('number');
            var sample = riot.mount('sample');
        })
    </script>


    </body>

</html>


```
    



## Page

```{code-block} html
---
force: true
---

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
        <meta http-equiv="Pragma" content="no-cache" />
        <meta http-equiv="Expires" content="0" />
        <title>About birthythm</title>
        <link rel="icon" href="favicon.ico">
        <style>
        html, body {
            margin: 0;
            width: 100%;
            height: 100%;
            padding: 0;
        }
        iframe {
            position:fixed;
            top:0;
            left:0;
            bottom:0;
            right:0;
            width:100%;
            height:100%;
            border:none;
            margin:0;
            padding:0;
            overflow:hidden;
            z-index:999999;
        }
        </style>
        <link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">
        <script>
            window.goatcounter = {
                path: function(p) { return location.host + p }
            }
        </script>
        <script data-goatcounter="https://analytics.xyzzyapps.link/count" async src="//analytics.xyzzyapps.link/count.js"></script>
    </head>
    <body>
        <iframe src="https://blog.xyzzyapps.link/bitrhythm-submit-issue-feedback" frameborder="0"></iframe>
    </body>
</html>

```
    

## Javascript

```{code-block} js
---
force: true
---




<
<
<
<







 







>







 







<
<
<
<
<
<
<
<
<
<
<
<
<







 







>







 







<

<
<
<
<

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







1
2
3
4




5
6
7
8
9
10
11
..
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
...
373
374
375
376
377
378
379













380
381
382
383
384
385
386
...
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
...
757
758
759
760
761
762
763

764




765















































































































































































































































































766
767
768
769
770
771
772

# Concepts and Code Walkthrough






## Core Tracker Loop

In bitrhythm code is evaluated for every cycle.

1 beat = 60 / tempo
1 cycle = 1 beat / ticks

................................................................................
---



async play() {
    var self = this;
    var cellx = window.cellx.cellx;
    var $ = jQuery;

    await Tone.start();
    Tone.Transport.start();
    Tone.Transport.bpm.value = this.state.tempo;
    Tone.Transport.swing.value = 0;

    var transition = function () {
................................................................................
    return context.knob;
}
```

## Main UI
















```{code-block} html
---
force: true
---


................................................................................
            <div each={ key, index in state.numbers}>
                <number rmnumber={rmNumber} v={state.numbers[index]} ti={index + 1}></number>
            </div>
        </hstack>

    </vstack>

    <div id="cue" class="p-2" style="color: white !important; height: 32px; font-size: 24px;"></div>
    <div id="error" class="p-2" style="color: yellow !important; height: 32px; font-size: 12px;"></div>
    <div id="canvas-container" style="position: relative;">
        <div id="p5" style="position: absolute; width: 100%; background: black"></div>
        <canvas id="visual" style="position: absolute; width: 100%; background: black;"></canvas>
        <div id="code" style="position: absolute;"></div>
    </div>
    
................................................................................

    });
   </script>
</sample>
```

























































































































































































































































































## Javascript

```{code-block} js
---
force: true
---

Changes to source/source-code.md.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Source Code and License

The literate code framework wheel uses extensively in this project is available [here](https://xyzzyapps.link/wheel).

The documentation, demo code and the source code in the following webpages is distributed under [creative commons, attribution-noncommercial-sharealike license](https://creativecommons.org/licenses/by-nc-sa/4.0/). The source code is self-hosted using fossil [here](https://fossil.xyzzyapps.link/bitrhythm/timeline). You can report issues, browse and download the source code from fossil. An Iframe is provided below. You can also get the latest source code [here](https://fossil.xyzzyapps.link/bitrhythm/download).

<iframe style="width:100%; height:75vh" src="https://fossil.xyzzyapps.link/bitrhythm/dir?ci=tip" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

Coding conventions

1. 4 Spaces
2. EcmaScript5

Written using the Vim editor.



|












1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Source Code and License

The literate code framework wheel used extensively in this project is available [here](https://xyzzyapps.link/wheel).

The documentation, demo code and the source code in the following webpages is distributed under [creative commons, attribution-noncommercial-sharealike license](https://creativecommons.org/licenses/by-nc-sa/4.0/). The source code is self-hosted using fossil [here](https://fossil.xyzzyapps.link/bitrhythm/timeline). You can report issues, browse and download the source code from fossil. An Iframe is provided below. You can also get the latest source code [here](https://fossil.xyzzyapps.link/bitrhythm/download).

<iframe style="width:100%; height:75vh" src="https://fossil.xyzzyapps.link/bitrhythm/dir?ci=tip" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

Coding conventions

1. 4 Spaces
2. EcmaScript5

Written using the Vim editor.

Changes to source/what.cog.

51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

The documentation for the literate programming project - wheel is [available here](https://xyzzyapps.link/wheel/).

## Support this project

My goal is to make bitrhythm easy for both professionals and music learners. Support my work to get regular updates. Supporters will also get free accounts when I add pro features! Also get notified on latest developments and tutorials in the web audio world.

<p><script src="https://gumroad.com/js/gumroad.js"></script><a class="gumroad-button" href="https://gumroad.com/l/kQSCv" target="_blank" rel="noopener"><span class="gumroad-button-logo"></span>Support Bitrhythm</a></p>

You can find me on [theaudioprogrammer](https://theaudioprogrammer.com/) and algorave discord as @xyzzy.

## Future Features

- Saving Songs
- More Synths with Presets







|







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

The documentation for the literate programming project - wheel is [available here](https://xyzzyapps.link/wheel/).

## Support this project

My goal is to make bitrhythm easy for both professionals and music learners. Support my work to get regular updates. Supporters will also get free accounts when I add pro features! Also get notified on latest developments and tutorials in the web audio world.

<p><script src="https://gumroad.com/js/gumroad.js"></script><a class="gumroad-button" href="https://gumroad.com/l/iEVpN" target="_blank" rel="noopener"><span class="gumroad-button-logo"></span>Support Bitrhythm</a></p>

You can find me on [theaudioprogrammer](https://theaudioprogrammer.com/) and algorave discord as @xyzzy.

## Future Features

- Saving Songs
- More Synths with Presets

Changes to source/what.md.

46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
..
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<script src="https://cdnjs.cloudflare.com/ajax/libs/tunajs/1.0.1/tuna-min.js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tone/14.7.77/Tone.js" integrity="sha512-gwSDP1iEKl4KG0wi3N89RAJU91s78jb/TGC6lsbF5IyR2c19Rn7Jl1icK4K4kUiJNwQUEPI7o98T+GJVWNuvIQ==" crossorigin="anonymous"></script>
<script src="/teoria-master/teoria.js"></script>

<script src="https://cdn.jsdelivr.net/npm/p5@1.3.1/lib/p5.js"></script>
<script src="https://cdn.jsdelivr.net/npm/d3@5.7.0/dist/d3.min.js"></script>
<script src="https://threejs.org/build/three.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/paper.js/0.12.11/paper-full.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/butterchurn@2.6.7/lib/butterchurn.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/butterchurn-presets@2.4.7/lib/butterchurnPresets.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/webmidi@2.0.0"></script>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="/nexus-js/dist/NexusUI.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/cellx/1.10.19/cellx.umd.min.js" integrity="sha512-ojEcAP3e6N+n5MDKPW6CexXzuLDahDPkNZmzyRV4t2zqh9nwljJNuV8JGa+xjpnAaGB/FhsAU7P6IHEP0dtJQA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
```

## About Author
................................................................................

The documentation for the literate programming project - wheel is [available here](https://xyzzyapps.link/wheel/).

## Support this project

My goal is to make bitrhythm easy for both professionals and music learners. Support my work to get regular updates. Supporters will also get free accounts when I add pro features! Also get notified on latest developments and tutorials in the web audio world.

<p><script src="https://gumroad.com/js/gumroad.js"></script><a class="gumroad-button" href="https://gumroad.com/l/kQSCv" target="_blank" rel="noopener"><span class="gumroad-button-logo"></span>Support Bitrhythm</a></p>

You can find me on [theaudioprogrammer](https://theaudioprogrammer.com/) and algorave discord as @xyzzy.

## Future Features

- Saving Songs
- More Synths with Presets







<
<


<







 







|







46
47
48
49
50
51
52


53
54

55
56
57
58
59
60
61
..
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<script src="https://cdnjs.cloudflare.com/ajax/libs/tunajs/1.0.1/tuna-min.js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tone/14.7.77/Tone.js" integrity="sha512-gwSDP1iEKl4KG0wi3N89RAJU91s78jb/TGC6lsbF5IyR2c19Rn7Jl1icK4K4kUiJNwQUEPI7o98T+GJVWNuvIQ==" crossorigin="anonymous"></script>
<script src="/teoria-master/teoria.js"></script>

<script src="https://cdn.jsdelivr.net/npm/p5@1.3.1/lib/p5.js"></script>
<script src="https://cdn.jsdelivr.net/npm/d3@5.7.0/dist/d3.min.js"></script>
<script src="https://threejs.org/build/three.js"></script>


<script src="https://cdn.jsdelivr.net/npm/butterchurn@2.6.7/lib/butterchurn.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/butterchurn-presets@2.4.7/lib/butterchurnPresets.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/webmidi@2.0.0"></script>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="/nexus-js/dist/NexusUI.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/cellx/1.10.19/cellx.umd.min.js" integrity="sha512-ojEcAP3e6N+n5MDKPW6CexXzuLDahDPkNZmzyRV4t2zqh9nwljJNuV8JGa+xjpnAaGB/FhsAU7P6IHEP0dtJQA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
```

## About Author
................................................................................

The documentation for the literate programming project - wheel is [available here](https://xyzzyapps.link/wheel/).

## Support this project

My goal is to make bitrhythm easy for both professionals and music learners. Support my work to get regular updates. Supporters will also get free accounts when I add pro features! Also get notified on latest developments and tutorials in the web audio world.

<p><script src="https://gumroad.com/js/gumroad.js"></script><a class="gumroad-button" href="https://gumroad.com/l/iEVpN" target="_blank" rel="noopener"><span class="gumroad-button-logo"></span>Support Bitrhythm</a></p>

You can find me on [theaudioprogrammer](https://theaudioprogrammer.com/) and algorave discord as @xyzzy.

## Future Features

- Saving Songs
- More Synths with Presets

Changes to templates/index.html.

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<script src="https://cdnjs.cloudflare.com/ajax/libs/tunajs/1.0.1/tuna-min.js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tone/14.7.77/Tone.js" integrity="sha512-gwSDP1iEKl4KG0wi3N89RAJU91s78jb/TGC6lsbF5IyR2c19Rn7Jl1icK4K4kUiJNwQUEPI7o98T+GJVWNuvIQ==" crossorigin="anonymous"></script>
<script src="/teoria-master/teoria.js"></script>

<script src="https://cdn.jsdelivr.net/npm/p5@1.3.1/lib/p5.js"></script>
<script src="https://cdn.jsdelivr.net/npm/d3@5.7.0/dist/d3.min.js"></script>
<script src="https://threejs.org/build/three.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/paper.js/0.12.11/paper-full.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/butterchurn@2.6.7/lib/butterchurn.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/butterchurn-presets@2.4.7/lib/butterchurnPresets.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/webmidi@2.0.0"></script>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="/nexus-js/dist/NexusUI.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/cellx/1.10.19/cellx.umd.min.js" integrity="sha512-ojEcAP3e6N+n5MDKPW6CexXzuLDahDPkNZmzyRV4t2zqh9nwljJNuV8JGa+xjpnAaGB/FhsAU7P6IHEP0dtJQA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>


        <link rel="preconnect" href="https://fonts.gstatic.com">







<
<


<







26
27
28
29
30
31
32


33
34

35
36
37
38
39
40
41
<script src="https://cdnjs.cloudflare.com/ajax/libs/tunajs/1.0.1/tuna-min.js" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tone/14.7.77/Tone.js" integrity="sha512-gwSDP1iEKl4KG0wi3N89RAJU91s78jb/TGC6lsbF5IyR2c19Rn7Jl1icK4K4kUiJNwQUEPI7o98T+GJVWNuvIQ==" crossorigin="anonymous"></script>
<script src="/teoria-master/teoria.js"></script>

<script src="https://cdn.jsdelivr.net/npm/p5@1.3.1/lib/p5.js"></script>
<script src="https://cdn.jsdelivr.net/npm/d3@5.7.0/dist/d3.min.js"></script>
<script src="https://threejs.org/build/three.js"></script>


<script src="https://cdn.jsdelivr.net/npm/butterchurn@2.6.7/lib/butterchurn.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/butterchurn-presets@2.4.7/lib/butterchurnPresets.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/webmidi@2.0.0"></script>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="/nexus-js/dist/NexusUI.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/cellx/1.10.19/cellx.umd.min.js" integrity="sha512-ojEcAP3e6N+n5MDKPW6CexXzuLDahDPkNZmzyRV4t2zqh9nwljJNuV8JGa+xjpnAaGB/FhsAU7P6IHEP0dtJQA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>


        <link rel="preconnect" href="https://fonts.gstatic.com">