-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
1199 lines (1199 loc) · 102 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
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
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
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
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
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
<!DOCTYPE html>
<html>
<head>
<title>LiMuT</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">
<style>
body {
font-family: helvetica, arial;
background: #202830;
color: #d0d0d0;
text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
scrollbar-width: thin;
scrollbar-color: #b0b0b080 #50505080;
}
.fullscreen {
position: fixed;
top:0%;
left:0%;
width:100%;
height:100%;
z-index: -1;
}
.fixed-top {
position: sticky;
top: 0;
left: 0;
z-index: 999;
width: 100%;
}
.widget {
color: #ddd;
border: 2px solid #222;
border-radius: 6px;
margin: 2px;
padding: 2px;
font-size: 1.1em;
}
.widget p {
margin: 0px;
}
.widget h3 {
margin: 0px;
}
.code {
height: 400px;
margin-bottom: 8px;
max-width: 100%;
font-size: 1.2em;
}
code {
color: #d0d0ff;
}
textarea {
font-family: courier, mono, monospace;
font-size: 1.5em;
color: #e0e0e0;
width: 100%;
max-width: 100%;
background: transparent;
border-radius: 4px;
border-style: solid;
border-color: #60606080;
text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
caret-color: #80b0ff;
}
textarea::selection {
background: #4060d0;
color: #000000;
text-shadow: none;
}
textarea#console {
font-size: 1em;
color: #808080;
}
button {
width:1.5em;
height:1.5em;
background: #80808080;
font-size: 1.3em;
border-radius: 4px;
border-style: solid;
border-color: #d0d0d080;
padding: 0;
}
span {
font-weight: bold;
}
span.beat-readout {
padding-left: 24px;
font-weight: normal;
font-family: courier, mono, monospace;
white-space: pre;
}
.info {
width: 100%;
max-width: 100%;
}
.closed {
display: none;
}
pre {
width: 100%;
max-width: 100%;
overflow-x: auto;
}
#accordion-examples pre {
margin: 8px 2px 16px 2px;
padding: 4px;
border: 2px #222 solid;
}
.sub {
margin-top: -10px;
margin-left: 20px;
}
.subsub {
margin-top: -10px;
margin-left: 30px;
}
.meter {
display: inline-block;
width: 1em;
height: 1em;
background-color: #808080;
}
.vu-meter-base {
display: inline-block;
width: 4em;
height: 0.8em;
padding: 2px;
border: 2px #808080 solid;
background: linear-gradient(to right, #040, #440 3em, #400 4em);
}
.vu-meter {
display: block;
width: 100%;
height: 50%;
background-color: black;
}
.info h4 {
cursor: pointer;
}
a {
color: #cde;
}
a:visited {
color: #99b;
}
.accordion::before {
content: "▶";
}
.accordion.opened::before {
content: "◢";
}
.warn {
background-color: #400;
color: #d44;
padding: 4px;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
align-items: center;
}
.warn p {
margin:0px;
padding:0px;
}
h5 {
font-size: 1.05em;
}
:fullscreen { display: flex; flex-flow: column; }
:fullscreen > * > h3 { font-size: 1em; }
:fullscreen > .code { flex: 1; max-height: calc(100% + 100px); }
:fullscreen > .info { display: none; }
:fullscreen > .warn { display: none; }
</style>
<link rel="stylesheet" href="codemirror/codemirror.css">
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-M1EBQVY3B4"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('set', { 'restricted_data_processing':true });
gtag('config', 'G-M1EBQVY3B4', { 'allow_google_signals':false,'allow_ad_personalization_signals':false });
</script>
<!-- End Google Analytics -->
<script src="codemirror/codemirror.js"></script>
<script src="codemirror/mode.js"></script>
<script src="codemirror/comment.js"></script>
</head>
<body>
<canvas id="canvas" class="fullscreen" style="width:100%; height:100%; background: #000f; display:none"></canvas>
<div class="widget">
<h3>Limut live coding</h3>
<p style="display: flex; flex-flow: row nowrap;">
Level:
<span class="vu-meter-base"><span id="vu-meter-l" class="vu-meter"></span><span id="vu-meter-r" class="vu-meter"></span></span>
<input id="main-amp-slider" type="range" min="0" max="200" oninput="mainAmpChange(parseFloat(this.value)/100)" style="flex:auto; margin-left:12px;" />
</p>
<p>
Beat: <span class="beat-readout" id="beat-readout"></span>
<span class="beat-readout">:</span>
<span class="beat-readout" id="beat1-readout"></span>
<span class="beat-readout" id="beat2-readout"></span>
<span class="beat-readout" id="beat3-readout"></span>
</p>
<p id="sliders">
<template id="slider-template">
<p style="display: flex; flex-flow: row nowrap;">
<span class="slider-name"></span>
<input class="slider" type="range" min="0" max="1000" style="flex:auto;"/>
</p>
</template>
</p>
</div>
<div class="widget fixed-top" style="display:flex; flex-wrap: wrap;">
<div style="margin-right:8px;">
<button onclick="go()" title="Run the code Ctrl-Enter">▶</button>
<button onclick="stop()" title="Stop all players Ctrl-.">◼️</button>
<button onclick="comment()" title="Toggle comment for line Ctrl-/">//</button>
<button onclick="fullscreen()" title="Toggle fullscreen">⛶</button>
</div>
<div style="margin-top:8px;">
Audio: <span id="beat-latency-readout" class="meter"> </span>
Visual: <span id="visual-readout" class="meter"> </span>
Limiter: <span id="compressor-readout" class="meter"> </span>
</div>
</div>
<div id="code-codemirror" class="widget code" style="display:none;"></div>
<textarea id="code-textarea" class="widget code" rows="15" style="display:none;"></textarea>
<textarea id="console" class="widget" rows="5"></textarea>
</div>
<div class="info">
<h4 onclick="toggleAccordion('accordion-examples')" class="accordion"> Examples</h4>
<div id="accordion-examples" class="closed">
<p>Copy and paste an example into the editor window, then hit the play ▶ button:</p>
<pre>d1 play x-o-</pre>
<pre>p1 dsaw 0534, add=(0,2,4), dur=4</pre>
<pre>Ba dbass 0, dur=1/4, add=[0:2]r*2, lpf={[3:12]r*100,q:8}, att=0</pre>
<pre>d dsaw 4[32]<10>___.., phaser=1/3, envelope=simple, rel=this.dur*2, amp=3, room={2,mix:1/4}</pre>
<pre>ARP dsaw 02479742, dur=1/4, lpf={100*[3,30]l6.8,q:8}, Oct=(3,5), echo=3/8, att=0
Bass prophet -2210, dur=4, Oct=(2,3), amp=1.7</pre>
<pre>set bpm=125
set * swing=61
p play [X-]-(X*)<---[--^]>, high=4, pan=[-1/4:1/4]r
s tri 00[...0][.0..], dur=1, sus=1/6, att=0.05, room, oct=3, fold, phaser=1/16, amp=2/3, pan=[-1/2:1/2]l4@f+[-1/4:1/4]r, add=(0,2,4,6)
b dbass ...[02]...[0246], room=0.1, lpf={this.freq*[3:12]l11@f,q:15}, pan=[-1/4:1/4]r</pre>
<pre>d play x.h[.x]x[x.]h., room={0.1,mix:1/3}, amp=3/2
set chords=[0,2,4,3]t[16,8,4,4]
be bell 0[.......2], dur=8, add=chords
gl glock 024797.., dur=1/4, add=chords</pre>
<pre>Perc play lstig, dur=[1,3,2], amp=[1/6:1/2]l16, echo=1/8, pan=[-1:1]r
Amb ambi 0[21]., dur=4, release=8, room=2, pan=(-1,1)
Bass dbass 0, dur=8, att=2, rel=4, lpf=100*[3,30]l16@f</pre>
<pre>set Prog=[2,5,4,0]t8
Ba piano 0__2, add=prog, amp=4, Oct=2
Ch piano 0, dur=8, Sus=12, add=(prog+(0,2,4))%7, amp=2, Oct=3
Le piano 0_.[.0]2343, amp=3, add=prog, Oct=4</pre>
<pre>set scale=minor
Ba dbass 0.4[21], dur=4, amp=2, room=1.2, att=0.01, lpf=this.freq*[30,24,4]e1, phaser=1/8
Kd play V[.V]V., dur=2, room=1.1, echo=1/16, amp=2
Sn play .(xO), dur=2, room=1.1, echo=1/16</pre>
<pre>set bpm=120
set * swing=58
set scale=minor
k play Xv, room=1/4, amp=3/2
h play s-, dur=1/4, amp=1/2
ba saw 020.00.0.040.00., dur=1/4, oct=2, sus=1/6, amp=2, lpf={this.freq*[[4:25]l7,2]e,q:15}, room={1,mix:1/5}</pre>
<pre>set bpm=65
pad dsaw (024)(025)(035)(026), envelope=pad, dur=4, lpf=[600:3000]s21, oct=3, amp=[1.2:2.0]s70
padf ethereal follow pad, oct=4
pi ping 0, dur=[3,3,2]/20, amp=[0.5:1.2]n*[2:0]s96, oct=[3,4,5,6]t1/4, add=[0,5,3,4]t4+[0,[1:3]n32,4,[6:10]n37]r, sus=2, addc=[-.15:.15]n</pre>
<pre>v kal 0, tunnel, scroll={x:time/8}, monochrome, fore=rainbow, mid=white
b dbass [(04v).], dur=8, noisify=1/8, drive=2/8, fold=1, phaser=1/8, room=2, add=[2,3,1,0]t8, addc=wow, pan=[-1/2:1/2]r, chorus=2, att=1/2, rel=5</pre>
<pre>set bpm=145
set scale=minor
v streetlight 0
kd play (xv):, lpf=1000
hh play -, dur=1/4, amp=[0.2:1.2]n
kk play ::[::][::][::]::., lpf=[600:900]l40, rate=[0.8:1.2]n
ba dbass 0, dur=1/4, att=0, lpf=[1000:100]e, hpf=[0:500]n
pi ping [010], add=[-5:5]l18/4, amp=[0:[0:1]t96]n, echo=1/2, oct=6, scale=minorpentatonic
pad dsaw (-303), dur=16, envelope=pad, amp=[0:3/2]s64@f, room=0.5, lpf=[1000:3000]s32@f, oct=3, addc=[2,2,0,0]s[62,4,62,0]@f</pre>
<pre>set bpm=90
n noise 00, dur=[9,7], envelope=simple, bpf=523*[[1:5]e,[1:1/5]e]*[1:[1.1,1.25]]n1, amp=3/2, att=[2,1/4], rel=[9,7], pan=[-1,1]l8@f
p dsaw 0., dur=[3,1,5,3,3,4], addc=[1:3]r+[2,0]e, envelope=simple, att=0.1, rel=[0.4:0.6]r, oct=6, pan=[-1:1]n8, amp=[0.3:1.1]n8, room=1
</pre>
<pre>s supersaw 0, dur=[1/4:1]l8, scale=penta, add=[-10:10]r1/2, room=2, lpf={[300,3000,300]e,q:11}, amp=2, phaser=1/4
</pre>
<pre>v kal 0, mirror={100,fan:[7:12]s32@f/10}, zoom=3, mid=random, contrast
</pre>
<pre>ld dsaw 0^.70-7.70, dur=1/4, scale=minor, add=[0,2,4]r+[0,2,3,0]t4, lpf={this.freq*[3/2,2,3,5]t4,q:25}, room, delay=(0,[1/4,1/2,3/4,5/4]r), echo=7/8, addc=wow
</pre>
<pre>v kal 1, buffer=vb1, contrast=3, blend=max, zoom=2, scroll=1
vb1 buffer 0, feedback={zoom:1.01,ripple:1/32,contrast:0.005}
</pre>
<pre>
include 'preset/house.limut'
set bpm=127
b tb303 `0a2u2b0d 0u0a2d3 00u0a0d 0da4ua5a6u`, cutoff=[1/4:1]n3, resonance=0.8, accent=1
</pre>
<p>More examples: <a href="https://github.com/sdclibbery/limut/blob/master/examples.txt" target="_blank">https://github.com/sdclibbery/limut/blob/master/examples.txt</a></p>
</div>
<h4 onclick="toggleAccordion('accordion-glossary')" class="accordion"> Glossary</h4>
<div id="accordion-glossary" class="closed">
<p>Chord: multiple simultaneous events</p>
<p>Command: One programming instruction to tell limut what to do</p>
<p>Event: One event to be played; either an audio note/sample or a visual display</p>
<p>Expression: Code that evaluates to a value</p>
<p>Global Var: A variable; something whose value can be set by a command, and then read in an expression</p>
<p>Indicator: Visual display on the limut screen to help with composition or production</p>
<p>Map: Value containing multiple values indexed by keys</p>
<p>Modifier: Additional data thats changes the value of an expression, eg by modifying the current time it sees, or by providing a random seed</p>
<p>Param: A named parameter expression that controls the output produced by a synth</p>
<p>Pattern: A sequence defining the notes or control values to be played by a synth</p>
<p>Player: An player uses a synth to play events in a pattern, controlled by params</p>
<p>Subparam: An additional parameter provided extra info on how a param should control the output of a synth</p>
<p>Synth: An audio or visual synthesizer that can produce sound output or visual display.</p>
<p>Timevar: An expression whose value varies over time</p>
<p>Value: A primitive value to control synths</p>
</div>
<h4 onclick="toggleAccordion('accordion-indicators')" class="accordion"> Indicators</h4>
<div id="accordion-indicators" class="closed">
<p><b>Level</b> VU meter for current output signal level. Use this when adjusting the output level, using either <code>set main amp</code> or the level slider, so it is just touching the red at its loudest. Only one active channel is shown if the mix is fully mono.</p>
<p><b>Beat</b> Current audio system beat count, followed by beat counts out of 12, 16 and 32 beats (useful for synchronising changes to various size musical bars and progressions)</p>
<p><b>Audio</b> Audio lag; green when the browser audio system is keeping up; turns red when the system is struggling, which may lead to audio glitching</p>
<p><b>Visual</b> Visual lag; green when the framerate is keeping up to 60 fps; turns red when the system is struggling, which may lead to visual glitching</p>
<p><b>Limiter</b> Audio limiter: turns red when the internal Limut limiter is active, implying the combined audio sources are too loud. Note this limiter is before the <code>main amp</code> control and vu meter, it makes sure the levels from individual synths do not go so loud as to distort. So if it is lighting up, lower the <code>amp</code> on individual synths, and if necessary, raise the <code>main amp</code> level to compensate.</p>
</div>
<h4 onclick="toggleAccordion('accordion-syntax-principles')" class="accordion"> Syntax Principles for Expressions</h4>
<div id="accordion-syntax-principles" class="closed">
<p><code>()</code> Round brackets define chords in both patterns and expressions; that is, mutltiple events or values at the same time. Chord indexers and aggregators can be used to extract various values from chords.</p>
<p><code>[]</code> Square brackets define sequences in both patterns and expressions; that is, multiple events or values one after another over time (sequences/timevars)</p>
<p><code><></code> Angle brackets define higher level sequences in patterns; that is, a sequence where the next event is selected when the entire pattern repeats next.</p>
<p><code>{}</code> Curly brackets in an expression supply extra information to a param (subparams), value (modifiers) or function call (arguments)</p>
<p><code>@</code> Defines the interval for an expression; that is, how often the expression should be evaluated within the event. Note, the interval applies directly to the nearest value. So for example, with <code>this.foo@e</code> the per-event <code>@e</code> interval will apply to the <code>foo</code> only. To force the overall <code>this.foo</code> lookup to be evaluated per event, you could use <code>(this.foo)@e</code>.</p>
</div>
<h4 onclick="toggleAccordion('accordion-basic-syntax')" class="accordion"> Basic Syntax</h4>
<div id="accordion-basic-syntax" class="closed">
<p>Limut is case insensitive; <code>piano</code>, <code>Piano</code>, and <code>PIANO</code> are all treated the same; <code>[1:4]t4</code> is the same as <code>[1:4]T4</code> etc.</p>
<h5>Comments</h5>
<p>Anything after <code>//</code> on a line is ignored</p>
<h5>Commands</h5>
<p>A command defines a player or preset, or sets player overrides, or sets global variables, or includes a limut source file. Commands may span multiple lines; a new command is started whenever the beginning of a command is recognised at the start of a new line. So any line that begins with <code>set </code> keyword for setting vars or overrides, or with the <code>id type pattern</code> syntax for defining a player, will begin a new command.</p>
<p>Example:
<pre>
include 'preset/synthwave.limut' // Command that includes a limut source file from a URL
preset mysynth ping, amp=3 // Command that creates a preset synth based on the 'ping' synth, but overriding the amp value
set bpm=130 // Command that sets the global bpm (beats per minute) var to 130bpm.
kick play x., amp=2, // Start of a command that defines the player called 'kick', of type `play`, with an amp (volume) of 2
drive=1/2 // Continuation of the kick player definition, setting its drive param to 1/2
set kick drive=0 // New command defining an override for the kick player, setting its drive param to zero. Overrides like this take precedence over params set on the player itself.
</pre>
</p>
<h5>Defining a player</h5>
<p>Basic structure: <code>id synth pattern, params</code></p>
<p>A player command begins when something matching <code>id synth pattern</code> begins a new line. The params may follow on subsequent lines.</p>
<p><code>id</code> Identifier for the player, so it can be referred to from other players etc. Must contain only alphanumeric characters from the basic Latin alphabet or underscore, and must not start with a digit. No player can be named <code>set</code> or <code>preset</code> as those are reserved keywords.</p>
<p><code>synth</code> Name of the audio or visual synth to use; eg <code>piano</code></p>
<p><code>pattern</code> Pattern of notes to play. Specifies the notes or sounds to play, and when to play them</p>
<p><code>params</code> Comma separated list of params (eg <code>amp=1/2</code>) that affect how the player plays; see 'Value Syntax' and 'Params' sections below</p>
<h5>Overriding player params:</h5>
<p>Basic structure: <code>set id params</code></p>
<p>A set overrides command begins when <code>set </code> begins a new line. The id and params may follow on subsequent lines.</p>
<p><code>id</code> Player identifier; the override params will be apllied to this player. Can also be a list of multiple players to apply the params to; eg <code>set (kd,sd) amp=0</code>. Can include wildcards, so <code>set p* ...</code> will apply the overrides to every player whose name starts with 'p'. <code>set * ...</code> will apply to all players. <code>set !p ...</code> will apply to all players _except_ 'p'.</p>
<p><code>params</code> Comma separated list of params (eg <code>amp=1/2</code>) that affect how the player plays; see 'Value Syntax' and 'Params' sections below</p>
<p class='sub'><code>modification overrides</code> params can be defined using operators to modify existing values rather than override them; eg <code>add+=2</code> will increase the add parameter by an additional 2 on top of what it was already set to.</p>
<h5>Setting global vars:</h5>
<p>Basic structure: <code>set var = value</code></p>
<p>A set global var command begins when <code>set </code> begins a new line. The var and value may follow on subsequent lines.</p>
<p><code>var</code> variable to set; either a predefined var (see 'Predefined Vars' section below) or a user defined var which can be referenced from params on any player(s)</p>
<p><code>value</code> expression value to set; see 'Value Syntax'</p>
<h5>Creating a synth preset:</h5>
<p>Basic structure: <code>preset name synth, params</code></p>
<p>A preset global var command begins when <code>preset </code> begins a new line. The params may follow on subsequent lines.</p>
<p><code>name</code> The name for the preset. The preset can be used by players by referring to this name as the player type. Must contain only alphanumeric characters from the basic Latin alphabet or underscore, and must not start with a digit.</p>
<p><code>synth</code> The existing synth (or preset) to base this preset on</p>
<p><code>params</code> Series of param overrides to apply for players that use this preset</p>
<h5>Including a limut source file:</h5>
<p>Basic structure: <code>include 'url'</code></p>
<p>Include a limut source file. The file will be downloaded from the given URL and then executed as limut code. The file will only be downloaded once, but will be executed every time the code is updated.</p>
<p><code>url</code> The URL of the limut source file to include. Must be in single quotes as a limut string. Include standard limut libraries from eg <code>'preset/synthwave.limut'</code>. Include limut source from anywhere on the web (CORS permitting) using the full URL; eg <code>'https://sdclibbery.github.io/limut/preset/synthwave.limut'</code></p>
</div>
<h4 onclick="toggleAccordion('accordion-pattern-syntax')" class="accordion"> Patterns</h4>
<div id="accordion-pattern-syntax" class="closed">
<p><code>x-o-</code> Sequence of events, each with duration given by the player's <code>dur</code> param, for use with <code>play</code></p>
<p><code>0123</code> Sequence of events, each with duration given by the player's <code>dur</code> param, for use with tonal synths. Numbers are scale degrees</p>
<p><code>`01 23`</code> Pattern literal; inside backticks, pattern elements can be separated by whitespace which will be ignored. Backticks force the contents to be treated as a literal, so for example <code>`01 loop 1`</code> is treated as the literal <code>01loop1</code> and the loop operator is ignored.</p>
<p><code>0-1-2-3</code> Negative scale degrees allow tones below the synth root pitch</p>
<p><code>x.</code> Use a dot for a rest</p>
<p><code>0#</code> # following numeric event makes it sharp</p>
<p><code>0b</code> b following numeric event makes it flat</p>
<p><code>0=</code> = following numeric event extends the duration by 50%</p>
<p><code>0!</code> ! following numeric event shortens the duration by 33%</p>
<p><code>0^</code> ^ following numeric event makes it 50% louder</p>
<p><code>0v</code> v following numeric event makes it 33% quieter</p>
<p><code>0a</code> Other characters following numeric event become params; for example <code>t tri 01g23, glide=this.g/2</code></p>
<p><code>x^</code> ^ following non-numeric event makes it 50% louder (for use with play synth)</p>
<p><code>0_[_1]</code> Continuation: use underscore to extend the previous note duration. Currently continuations are not valid within chords <code>()</code> or supersequences <code><></code></p>
<p><code>0[123]</code> Subsequence: square brackets to fit multiple events into one <code>dur</code> (triplet shown)</p>
<p><code>0(135)</code> Chord: Round brackets to play multiple events together</p>
<p><code>0<12></code> Supersequence: angle brackets to play events in sequence as the pattern repeats. Eg <code>0<12></code> is exactly equivalent to <code>0102</code></p>
<p><code>01 loop 2</code> Restrict the number of times the pattern can loop. In the example, the pattern <code>01</code> will play twice and then stop. The player will not reset until it gets recreated or changed. So if a player with a loop pattern has finished its repeats, it will not start playing again until it is commented out/in, or playback stopped and restarted, or the pattern string is changed and updated.</p>
<p><code>0123 crop 2</code> Crop a pattern to a given number of steps. For example, <code>0123 crop 2</code> is equivalent to <code>01</code>. Crop will repeat the pattern if necessary, eg <code>01 crop 5</code> is equivalent to <code>01010</code></p>
<p><code>1 + 2</code> Concatenate two patterns; the first pattern plays then the second. For example, <code>12 + 34</code> is the same as <code>1234</code></p>
<p><code>1 * 2</code> Repeat a pattern; the first pattern plays a given number of times. For example, <code>12 * 2</code> is the same as <code>1212</code></p>
<p><code>now 01</code> Play the pattern starting on the next beat, rather than as if it had been playing from beat 0. In the example, the pattern <code>0123</code> will play starting from the <code>0</code> whatever beat the player is started on.</p>
<p><code>follow p1</code> Use <code>follow</code> to follow another player (named 'p1' in the example) pattern</p>
</div>
<h4 onclick="toggleAccordion('accordion-value-syntax')" class="accordion"> Values</h4>
<div id="accordion-value-syntax" class="closed">
<p>Basic structure <code>value{modifiers}@interval</code></p>
<p><code>value</code> Actual value (which may include subparameters); see below</p>
<p><code>{modifiers}</code> Map of modifiers and/or arguments. Modifiers may modify the time passed to the value expression, or the value it returns, or provide additional data for a parameter. For example, <code>[1,2,3]t1{0:0,per:8}</code> will give a sequence that repeats every 8 beats, forced to the value 0 at the start of each repeat. In other words, the repeating sequence: 0,2,3,1,2,3,1,2. See "Modifiers" below.</p>
<p><code>@interval</code> Intervals specify how often the value should be evaluated, for example once per event (then the same value through the event), or continuously varying. See "Intervals" below.</p>
<h5>Values:</h5>
<p><code>1</code> Single, constant numeric value</p>
<p><code>0dB</code> Numeric values can be expressed in dB. These are immediately (at parse time) converted to gain numbers, so 0dB is a gain of 1, +20dB is a gain of 10 etc. Values can be specified in dB for any numeric values, however it may not make sense in all cases. <code>amp=6dB</code> is basically equivalent to <code>amp=2</code>; it doubles the output level of a player. But while <code>scroll=6dB</code> is still the same as <code>scroll=2</code>, it doesn't make much sense to write it way (especially since it is impossible to express negative numbers with dB: Eg <code>-20dB</code> is the same as <code>1/2</code>. Note that because dB is a relative scale, it must be multiplied. Eg to add +3dB to an amp, multiplication must still be used: <code>amp*=3db</code></p>
<p><code>1#</code> <code>1b</code> For use with the audio <code>add</code> param, sharpen or flatten the value. This is parsed into <code>{1,#:1}</code> or <code>{1,b:1}</code></p>
<p><code>100ms</code> Single, constant numeric value with time units. Time units are valid for any param which has a default time unit. In general time units will be automatically converted between beats and seconds (using the current bpm), and also between time and frequency; so <code>lpf=0.001s</code> is equivalent to <code>lpf=1000</code> because the default units for lpf is Hz.</p>
<p class='sub'><code>1s</code> Time in seconds</p>
<p class='sub'><code>1000ms</code> Time in milliseconds</p>
<p class='sub'><code>1Hz</code> Frequency in Hertz (cycles per second). Also <code>1cps</code> is the same as <code>1Hz</code> and <code>1kHz</code> is <code>1000Hz</code>.</p>
<p class='sub'><code>1cpm</code> Frequency in cycles per minute</p>
<p class='sub'><code>1b</code> Time in beats</p>
<p class='sub'><code>1cpb</code> Frequency in cycles per beat. Also <code>1kcpb</code> is <code>1000cpb</code></p>
<p><code></code> No value: for a param, missing a value is the same as setting the param to <code>1</code>. Eg <code>monochrome</code> is the same as <code>monochrome=1</code></p>
<p><code>(1,2)</code> A chord. Multiple values, all played together at the same time</p>
<p><code>[1,2]</code> Sequence of values, one after another, one per event in the pattern, ignoring rests. For single length patterns only, all values will be expanded, so <code>p ping 0, add=[0,1,2]</code> will cycle through all three values.</p>
<p><code>[1,2]t3</code> Timed sequence, each value lasts for 3 beats. Duration must be a const number, cannot be an expression. Default time unit: beats.</p>
<p><code>[1:12,2:4]t</code> Timed sequence with variable timing per value. Durations can be expressions. Default time unit: beats.</p>
<p><code>[0:3]t1</code> Timed sequence, expanded. The example is equivalent to <code>[0,1,2,3]t1</code></p>
<p><code>[1,2]l3</code> Timed linear interpolated sequence, each value takes 3 beats to change into the next. Default time unit: beats.</p>
<p><code>[1:12,2:4]l</code> Timed linear interpolated sequence with variable timing per value. Durations can be expressions. Default time unit: beats.</p>
<p><code>[1,2]s3</code> Timed smooth interpolated sequence, each value takes 3 beats to change into the next, using an 's' shaped ease in/out curve. Duration must be a const number, cannot be an expression. Default time unit: beats.</p>
<p><code>[1:12,2:4]s</code> Timed smooth interpolated sequence with variable timing per value. Durations can be expressions. Default time unit: beats.</p>
<p><code>[1,2]e</code> Timed interpolated sequence, each value is evenly spaced from beginning to end of the current event</p>
<p><code>[1,2]e1</code> Timed interpolated sequence starting at the beginning of the event, each value takes 1 beat to change to the next. Duration must be a const number, cannot be an expression. Default time unit: beats.</p>
<p><code>[0:!300ms,1:_[1/4b:1/2b]r,0]e</code> Timed piecewise sequence starting at the beginning of the event. In this case it would provide an envelope for the event, with an exponential attack lasting 300ms, followed by a const sustain lasting between 1/4 and 1/2 a beat at random. Default time unit: beats.</p>
<p><code>[]r</code> Select a different value every time, chosen randomly between 0 and 1</p>
<p><code>[1,4,7]r</code> Select a different value every time, chosen randomly from the numbers 1, 4 and 7</p>
<p><code>[:9]r</code> Select a different random float every time, between 0 and 9</p>
<p><code>[0:9]r</code> Select a different random float every time, between 0 and 9. Note if this will be rounded to to an integer (eg for oct, add or sample params), then the upper limit is exclusive. eg <code>oct=[2:3]r</code> will give a float value between 2 and 2.9999...., so since oct rounds down to the nearest integer, it will always get <code>oct=2</code></p>
<p><code>[0,1:7]r</code> Select a different random float every time, either 0 or 1. The 1 is 7 times more likely than the 0.</p>
<p><code>[1,2]r4</code> Select a different value and hold for 4 beats, chosen randomly from the numbers 1, 2. The hold time must be a const number, it cannot be an expression. Default unit: beats.</p>
<p><code>[1:3]r{seed:1,per:4}</code> Select a different determninistic random float every time, between 1 and 3; <code>seed</code> determines the random sequence; the sequence repeats every <code>per</code> beats. <code>seed</code> is also in beats, so adding 1 to seed pushes the sequence by 1 beat.</p>
<p><code>[]n</code> Smoothly varying noise, moving between 0 and 1</p>
<p><code>[1:2]n</code> Smoothly varying noise, moving between 1 and 2</p>
<p><code>[1:2]n4</code> Smoothly varying noise, moving between 1 and 2, taking 4 beats to progress from one value to another. The timing must be a const number, it cannot be an expression. Default time unit: beats.</p>
<p><code>[]n{seed:1,per:4}</code> Smoothly varying deterministic noise, moving between 0 and 1; <code>seed</code> and <code>per</code> work the same as for <code>[]r</code></p>
<p><code>[ v1:i1t1, v2:i2t2, ... ]{p}</code> Piecewise series. Allows interpolating between a set of values, specifying the interpolation and 'travel' between each pair of values, and allowing a custom parameter to control the interpolation. For example, <code>[0:_1,1:\]{time*2}</code> is controlled by double-speed time, starts at 0, stays constant at zero for 1 unit of double-speed time, then jumps to 1 and linearly falls back down to 0 for 1 unit of double-speed time.</p>
<p class='sub'><code>v1 etc</code> Expressions giving the values to interpolate between</p>
<p class='sub'><code>i1 etc</code> Interpolation operator</p>
<p class='subsub'><code>:/ :\</code> Linear interpolation operators; both do the same, but the two can be used to indicate direction</p>
<p class='subsub'><code>:_</code> Const interpolation operator: stay at original value right to end of step</p>
<p class='subsub'><code>:_</code> Step interpolation operator: immediately jump to new value from start of step</p>
<p class='subsub'><code>:~</code> Smoothed interpolation operator: bezier ease in/out s-shaped smooth transition through step</p>
<p class='subsub'><code>:!</code> Exponential interpolation operator: exponential growth/decay to target</p>
<p class='sub'><code>t1 etc</code> The amount of parameter p travel between this value and the next; note the sequence wraps round. Default time unit: beats.</p>
<p class='sub'><code>p</code> Parameter expression giving the current point of travel through the piecewise series</p>
<p><code>+</code> Add values together; eg <code>[2,3]+4</code> is equivalent to <code>[6,7]</code></p>
<p><code>-</code> Subtract values; eg <code>[2,3]-1</code> is equivalent to <code>[1,2]</code></p>
<p><code>-</code> Unary minus operator; eg <code>-[1,2]</code> is equivalent to <code>[-1,-2]</code></p>
<p><code>/</code> Divide values; eg <code>[1,2,3]/2</code></p>
<p><code>*</code> Multiply values; eg <code>[1,2,3]*1000</code></p>
<p><code>%</code> Take remainder; eg <code>(0,4,7,9)%7</code> is equivalent to <code>(0,4,0,2)</code></p>
<p><code>^</code> Raise to the power; eg <code>2^3</code> is 8. Imaginary results return 0; eg <code>-1^1/2</code> returns 0.</p>
<p><code>|</code> Concatenate chords; eg <code>1|2</code> is the same as <code>(1,2)</code>, and <code>(1,2)|(3,4)</code> is <code>(1,2,3,4)</code></p>
<p><code>?</code> Get a default if a value is missing. Eg <code>this.foo?5</code> will give the value of <code>this.foo</code> if present, or <code>5</code> if not.</p>
<p><code>.</code> Lookup values in a player (with a param name), a chord (with an index or aggregator) or a map (with a field name). See Lookup Examples section below.</p>
<p><code>{x:0,y:1}</code> Map, containing keys and values</p>
<p><code>{2,y:1}</code> Map, containing keys and values, with a main value of 2. The main value is the same as if no map was used; eg <code>chop={2,wave:'tri'}</code> is the same as <code>chop=2</code>, but also supplies an additional 'wave' subparameter.</p>
<p><code>{r:1,g:0,b:0,a:1}</code> RGBA colour; component range is 0 - 1.</p>
<p><code>{h:1,s:1,v:1,a:1}</code> HSV + alpha colour; component range is 0 - 1, including hue. Note RGB components can also be specified as overrides; eg <code>{h:1,b:1,a:1}</code> will be magenta not red.</p>
<p><code>{labh:1,c:1,l:1,a:1}</code> LabLCH + alpha colour; component range is 0 - 1, including hue. Note RGB components can also be specified as overrides; eg <code>{labh:1,b:1,a:1}</code> will be magenta not red.</p>
<p><code>#0369</code> Hex colour value which becomes the colour map <code>{r:0,g:0.2,b:0.4,a:0.6}</code></p>
<p><code>#036</code> Hex colour value which becomes the colour map <code>{r:0,g:0.2,b:0.4,a:1}</code></p>
<p><code>#00336699</code> Hex colour value which becomes the colour map <code>{r:0,g:0.2,b:0.4,a:0.6}</code></p>
<p><code>#003366</code> Hex colour value which becomes the colour map <code>{r:0,g:0.2,b:0.4,a:1}</code></p>
<p><code>'abc'</code> String value. Strings must be defined on a single line; multiline strings are not supported. However, line breaks can be inserted with <code>\n</code></p>
<p><code>foo</code> Lookup a global var named <code>foo</code>. If there is no var, predefined var, or var function named foo, then the string <code>'foo'</code> will be returned instead. If there is a var named foo, but no arguments are provided, then the string <code>'foo'</code> will be returned instead.</p>
<p><code>foo{x:2}</code> Lookup a global var named <code>foo</code>, and call it as a function passing in named parameters.</p>
<h5>Modifiers:</h5>
<p><code>{per:8}</code> Repeat a sequence <code>[1,2,3]t1{per:8}</code> will give a sequence that repeats every 8 beats.</p>
<p><code>{per:8,0:7,2:3}</code> Force the value to evaluate to 7 at the start of each repeat, and 3 on the second beat of every repeat. Note this only works if <code>per</code> is used to make a repeating sequence. Default time units: beats.</p>
<p><code>{step:2}</code> Advance time in discrete steps only <code>[1,4]l4{step:1/2}@f</code> will give a sequence that changes value only every 1/2 beat. Default units: beats.</p>
<h5>Intervals:</h5>
<p><code>@e</code> Use <code>@e</code> to evaluate this value once per event</p>
<p><code>@f</code> Use <code>@f</code> to evaluate once per frame (60 times a second). For example <code>lpf=[300:3000]l8@f</code> will update the lpf cutoff frequency continuously, while <code>lpf=[300:3000]l8</code> will be evaluated only once for each event played.</p>
<h5>Lookup examples</h5>
<p><code>p1.amp</code> Lookup the value of param <code>amp</code> from player <code>p1</code>. Returns a chord of values from all currently playing events.</p>
<p><code>p1.amp.0</code> Lookup the value of param <code>amp</code> from player <code>p1</code>, and if it contains a chord, extract the first element only from it.</p>
<p><code>p1.pulse.max</code> Lookup the value of the <code>pulse</code> from player <code>p1</code>, and if it contains a chord, extract the largest element only from it. The pulse param gives a smoothed approximate envelope shaped value between 0 and 1 for each event.</p>
<p><code>this.value</code> Get param <code>value</code> from the current event. Returns a single value (not generally a chord) from the event the expression is being evaluated on.</p>
<p><code>([0,1]t1@f).accum</code> Smoothly accumulate 1 every other beat</p>
<p><code>{foo:2}.foo</code> Returns a field in a map (returns 2 in this example)</p>
<p><code>(3,1,2).0</code> Returns the nth element in a chord (returns 3 in the example)</p>
<p><code>(3,1,2).3</code> Returns the nth element in a chord, wrapping around (returns 3 in the example)</p>
<p><code>(3,1,2).(0,2)</code> Returns multiple elements in a chord (returns (3,2) in the example)</p>
<p><code>(3,1,2).first</code> Returns the first element in a chord (returns 3 in the example)</p>
<p><code>(3,1,2).last</code> Returns the last element in a chord (returns 2 in the example)</p>
<p><code>(3,1,2).rand</code> Returns a random element from a chord (returns 1, 2 or 3 at random in this example)</p>
<p><code>(3,1,2).min</code> Returns the smallest element in a chord (returns 1 in the example)</p>
<p><code>(3,1,2).max</code> Returns the largest element in a chord (returns 3 in the example)</p>
<p><code>(3,1,2).count</code> Returns the number of elements in a chord (returns 3 in the example)</p>
<p><code>(3,1,2).sum</code> Returns the sum of all elements in a chord (returns 6 in the example)</p>
<p><code>(3,1,2).avg</code> Returns the mean average of all elements in a chord (returns 2 in the example)</p>
</div>
<h4 onclick="toggleAccordion('accordion-audio-synths')" class="accordion"> Audio Synths</h4>
<div id="accordion-audio-synths" class="closed">
<p><code>! / stop / none</code> </p>
<p><code>play</code> Play samples. Use letters, symbols and digits 1-4 in the pattern to choose the sample (see below for full list). Note duration defaults to 1/2.</p>
<p><code>perc</code> Play sampled percussion. Similar to the play synth, and uses the same pattern values and samples, but defaults to 1/4 beat duration, and each player has a choke group.</p>
<p><code>pitchedperc</code> Synthesised pitched percussion for kick drums, snare, toms etc. Note that as this synth is not sample based, it only accepts digits in the player pattern, unlike the play synth. The sound is made up of click, hit, body and rattle components. The synth has a number of unique params:</p>
<p class='sub'><code>click={1}</code> The click is the initial impact sound. The main param is the loudness of the click. The default values are shown.</p>
<p class='sub'><code>hit={0,sample:'^',index:1,rate:3/2}</code> The hit is a sample to be played with the initial impact sound. The main param is the loudness of the hit. Sample, index and rate control the sample playback (similar to the play synth). The default values are shown.</p>
<p class='sub'><code>body={1,att:5ms,dec:400ms,freq:55hz,boost:150hz,pitchatt:0ms,pitchdec:50ms,wave:'sine',saturation:0}</code> The body is the resonant, pitched body of the sound. The main param is the loudness of the body. units is the time units for the various envelope attack and decay values. att is the attack time. dec is the decay time. freq is the base frequency in Hz, boost is the initial frequency boost in Hz. pitchatt is the attack time for the pitch sweep. pitchdec is the decay time for the pitch sweep. wave is the waveform to use. saturation is the gain for a tanh saturator applied to the body oscillator. The default values are shown. Default time units for envelopes: seconds.</p>
<p class='sub'><code>body2={0,att:5ms,dec:400ms,freq:55hz,boost:150hz,pitchatt:0ms,pitchdec:50ms,wave:'sine',saturation:0}</code> Second body tone. May be useful for snares and toms etc.</p>
<p class='sub'><code>rattle={1,att:0ms,dec:30ms,rate:1,filter:'lowpass',freq:55hz,boost:205hz,pitchatt:0ms,pitchdec:50ms,q:18}</code> The rattle is a noisy component of the sound. The main param is the loudness of the rattle. units is the time units for the various envelope attack and decay values. att is the attack time. dec is the decay time. Rate is the sample playback rate of the noise sample; adjusting this can provide some additional filtering. freq is the base filter frequency in Hz, boost is the initial filter frequency boost in Hz, pitchatt is the attack time for the filter sweep. pitchdec is the decay time for the filter sweep. Q sets the filter resonance. The default values are shown. . Default time units for envelopes: seconds.</p>
<p><code>bd</code> Preset based on pitchedperc. Provides a basic synthesized kick drum. Note that as this synth is not sample based, it only accepts digits in the player pattern, unlike the play synth. Use sus or dec params to control the duration of the kick. Uses some unique params:</p>
<p class='sub'><code>accent=0</code> Positive values accent the kick making it louder and stronger. Negative values diminish the kick. Default value is derived from the player pattern value and 'add' param.</p>
<p class='sub'><code>tone=0</code> Tone control for the kick. Larger values will open the filters.</p>
<p class='sub'><code>tune=55</code> Base frequency for the kick in Hz. Usually this should be between about 45 and 65 Hz. The pitch{} function can be used to calculate specific frequencies for tuning the kick to the current key; for example <code>tune=pitch{0,oct:2}</code></p>
<p><code>io808</code> TR-808 simulation based on <a href="https://github.com/vincentriemer/io-808">IO-808</a>. Eg <code>p io808 0.9, type='bd'</code> plays a pattern with two bass drum hits, one unaccented then one with maximum accent. Event duration is 1/4 beat (16th note) to correspond to 808 sequencer.</p>
<p class='sub'><code>type='bd'</code> type of 808 sound: 'bd', 'sd', 'oh', 'ch', 'cb', 'cp', 'ma', 'ht', 'mt', 'lt', 'hc', 'mc', 'lc', 'cl', 'rs', 'cy'. The value from the pattern determines the level of accent placed on each event.</p>
<p class='sub'><code>level=1</code> Output level. Used on all types.</p>
<p class='sub'><code>tone=1/2</code> Tone control; used on bd, sd, and cy.</p>
<p class='sub'><code>decay=1/2</code> Decay time; used on bd, cy, and oh.</p>
<p class='sub'><code>snappy=1/2</code> Snappy control for sd.</p>
<p class='sub'><code>tuning=1/2</code> Tuning control for toms and congas ht, mt, lt, hc, mc, and lc.</p>
<p><code>impulse</code> Play an atonal impulse; that is a single pulse of millisecond duration.</p>
<p><code>sample</code> Pitched sample player. Use the 'sample' param, and then use it as a pitched synth. Use the <code>start</code> param to specify the playback start time within the original sample in seconds. Note: if the <code>rate</code> param is set, then this sets the sample playback rate and overrides the <code>value</code> and <code>add</code> params, which are ignored.</p>
<p><code>saw</code> Sawtooth wave preset</p>
<p><code>sine</code> Sine wave preset</p>
<p><code>square</code> Square wave preset</p>
<p><code>tri</code> Triangle wave preset</p>
<p><code>pulse</code> Pulse wave preset</p>
<p><code>wave</code> Synthesizer using a waveform specified by the <code>wave</code> param. Possible values <code>saw, square, sine, triangle, pulse</code></p>
<p><code>dwave</code> Synthesizer preset using multiple detuned waveforms specified by the <code>wave</code> param. Possible values <code>saw, square, sine, triangle, pulse</code></p>
<p><code>dsaw</code> Detuned saw preset - multiple sawtooth waves slightly out of tune for a fuller sound</p>
<p><code>dsquare</code> Detuned square preset - multiple square waves slightly out of tune for a fuller sound</p>
<p><code>dsine</code> Detuned sine pad preset - multiple sine waves slightly out of tune for a fuller sound</p>
<p><code>dtri</code> Detuned tri preset - multiple triangle waves slightly out of tune for a fuller sound</p>
<p><code>dbass</code> Detuned saw bass preset - multiple sawtooth waves slightly out of tune for a fuller sound</p>
<p><code>fmbass</code> Funky FM bass preset</p>
<p><code>ping</code> Sine wave ping preset</p>
<p><code>swell</code> Swell pad - triangle wave</p>
<p><code>fm</code> FM base synth; allows configuration of FM operators and envelopes. Each of up to 6 operators is specified using params <code>op1</code> to <code>op6</code>:</p>
<p class='sub'><code>op1={ratio:5.19,target:3,wave:'saw',depth:0.8,att:0.01,rel:0.1}</code> ratio: frequency ratio for this operator relative to base event frequency. target: the number of the operator that this one should modulate (eg `1` to target `op1`); use 'out' to send this operator output to the synth output. wave: the waveform to use for this operator. Depth: the amount of modulation this operator should apply to the target (note this will be scaled by the note frequency). att/rel simple envelope attack and release for this operator - default time units: beats</p>
<p><code>bell</code> FM generated bell preset</p>
<p><code>glock</code> FM generated glockenspiel preset</p>
<p><code>glass</code> FM glass synth with a chiming sound preset</p>
<p><code>xylo</code> FM xylophone preset</p>
<p><code>piano</code> Sampled piano</p>
<p><code>ambi</code> Ambient drone preset; multiple sines with varying detunes</p>
<p><code>ethereal</code> FM Ethereal pad preset</p>
<p><code>noise</code> Noise pad. Note pattern value is not used; white noise is produced for all values (uses AudioWorklet so may use more audio render capacity than other synth types).</p>
<p><code>prophet</code> Prophet style preset: pulse wave with lfo controlled pulse-width (uses AudioWorklet so may use more audio render capacity than other synth types)</p>
<p><code>pwm</code> Pulse width modulation synth. A pulse wave with variable pulse width, from pulse to square. Note: uses AudioWorklet so may use more audio render capacity than other synth types. Also note there may be aliasing, so you may want to apply some filtering to cut harsh high frequencies.</p>
<p class='sub'><code>pwm=1/2</code> Set the pulse width from 0 to 1. The default is 1/2, a square wave (50% duty cycle). values very close to 0 and 1 will produce no sound since the actual pulse width will become vanishingly small.</p>
<p><code>supersaw</code> supersaw lead synth preset; 7 detuned saws</p>
<p><code>external</code> take audio from microphone or line in. Use the <code>track</code> param to specify the track within the stream. If the input signal appears on only one stereo channel (or you only want the signal from one stereo channel), use the <code>channel</code> param to select the channel and force it to mono.</p>
<p class='sub'><code>track=1</code> Select which audio track to use from the input.</p>
<p class='sub'><code>channel=1</code> Select a single audio channel to use from the input.</p>
<p><code>multiwave</code> Synthesizer providing multiple waveform oscillators which can have their amp and detune controlled individually and dynamically. The waves are specified using params <code>wave1</code>, <code>wave2</code> etc:</p>
<p class='sub'><code>wave1={'saw',amp:[0:1]n,detune:wow}</code> The main value is a string giving the waveform to use. amp is a per frame amplitude control. detune is a per frame detune control in semitones.</p>
<p><code>crackle</code> Crackly crackle sounds.</p>
<p><code>noisefloor</code> Provide a slowly varying noise floor.</p>
<p><code>bus</code> Audio mix bus. Plays continuously, can take a pattern but the pattern is ignored. As a result, all bus param values are evaluated per frame. Chords and []e are not valid for bus players. Audio players can use the <code>bus</code> param to choose which bus to mix into (by id). A bus player does not have pitch effects (addc, vib etc), but does have wave effects (compress, drive, fold etc). There is an implicit bus called <code>main</code> that exists at all times, and provides the final mix for all other players and buses. Overrides can be used to set params on the main bus; eg <code>set main echo=1/2</code></p>
</div>
<h4 onclick="toggleAccordion('accordion-visual-synths')" class="accordion"> Visual Synths</h4>
<div id="accordion-visual-synths" class="closed">
<p><code>! / stop / none</code> </p>
<p><code>blank</code> Blank: sets every pixel to the <code>back</code> colour.</p>
<p><code>clouds</code> Moving clouds</p>
<p><code>kal</code> Changing kaleidoscope pattern</p>
<p><code>swirl</code> Psychedelic swirl</p>
<p><code>julia</code> Julia set fractal</p>
<p><code>lines</code> Twisting lines</p>
<p><code>blob</code> Morphing 3D blob</p>
<p><code>streetlight</code> Looking up at the passing streetlights on a night drive</p>
<p><code>grid</code> Square grid</p>
<p><code>glow</code> Additive glow for lights, sparks etc</p>
<p><code>stars</code> Exploding stars for fireworks etc</p>
<p><code>bits</code> Bitwise operations giving fractal patterns</p>
<p><code>xor</code> Bitwise xor with mod, giving changing pixellated patterns</p>
<p><code>gradient</code> Simple gradient in the y direction</p>
<p><code>shadertoy</code> Display a shadertoy synth. Use the <code>id</code> param to specify which shader. Only shaders published with the 'public+api' option are available, others will give error 'Shader not found'. At present, shaders that use textures or multiple channels will also not work.</p>
<p><code>image</code> Display an online image. Use the <code>url</code> param to specify the image url. The image must be served using CORS. by default the image <code>back</code> is transparent.</p>
<p><code>webcam</code> Display video feed from the attached webcam (if present). The browser will ask permission before allowing access to the webcam.</p>
<p><code>text</code> Draw and display text. Use the text param; eg <code>text='Hello'</code>. Use <code>\n</code> to split to multiple lines: <code>text='Hello\nWorld'</code>. Use subparams to control the text rendering, eg: <code>text={'Hello',font:'times',size:'144',linesize:0.7,y:1/4,x:2/3,style:'bold italic'}</code>. Text is evaluated only per event, not per frame.</p>
<p><code>buffer</code> Maintain a render target, which other synths can render into. The render target is then drawn to the screen by this synth. Use the <code>buffer</code> param on another synth to direct its output to a <code>buffer</code> synth. Use the <code>rez</code> param on the buffer synth to set the render target texture resolution scale. Use the <code>feedback</code> param to provide video feedback by rendering this buffer on top of itself every frame. The subparams will modify the feedback render.</p>
<p><code>scope</code> Display the current audio waveform</p>
<p><code>scopefft</code> Display the frequency spectrum of the current audio waveform</p>
<p><code>readout</code> Display the current value as a digital display</p>
</div>
<h4 onclick="toggleAccordion('accordion-event-params')" class="accordion"> Common Event Params</h4>
<div id="accordion-event-params" class="closed">
<p><code>dur</code> Pattern step duration. Timevars, random vars and index vars can be used to give variation in duration. Chords cannot be used with the dur param. Default time units: beats.</p>
<p><code>delay</code> Event start time offset. Default time units: beats</p>
<p class='sub'><code>delay={1/2,add:2}</code> subparams on delay will be used to override the event values. In the example given, the <code>add</code> param of the delayed event will be set to 2, but any params can be overridden this way. This is most useful with chords of delay values, as it allows individual delayed events to change their properties.</p>
<p><code>stutter</code> Split each event into multiple events spaced evenly within the same time period. Eg with <code>stutter=2</code>, an event starting at time 0 with a duration of 1 will be split into two events of duration 1/2, starting at 0 and 1/2. Stutter of 0 or 1 has no effect and is the default. Stutter is rounded down to the nearest integer value.</p>
<p><code>swing</code> Amount to swing alternating 1/4 beats, as a Linn LM-1 style percentage from <code>50</code> (no swing) to <code>66</code> (perfect triplet swing) to <code>75</code> (maximum dotted note swing). You can set swing for all players at once using (eg) <code>set * swing=60</code></p>
<p class='sub'><code>swing={66,period:1/2}</code> The period to apply the swing. Defaults to 1/4 of a beat (suitable for house music).</p>
<p><code>amp</code> Player amplitude control</p>
<p><code>sus</code> Sustain time. Note the 'sustain' in an ADSR envelope sets the sustain level, however this param sets the sustain time. The default is time required after attack and decay to take the note to the end of the duration. Default time units: beats.</p>
<p><code>rate</code> Playback rate for 'play' samples, animation rate for visuals</p>
<p><code>voice</code> READ ONLY param. This param is set to the voice index of an individual event within a chord. So for example: <code>p ping 0, add=(0,2)</code>. Here, there are two events within the chord, with <code>add</code> values of 0 and 2. The <code>voice</code> values for these events will be 0 and 1, since the <code>voice</code> increments. This can be used to change other values based on the voice index within the chord.</p>
<p><code>time</code> READ ONLY param. The current time in beats this event has been playing for.</p>
<p><code>idx</code> READ ONLY param. The pattern index of this event. The pattern index counts through the pattern, then resets when the pattern repeats.</p>
<p><code>exists</code> READ ONLY param. One if the player is defined, even if its not currently playing any event.</p>
<p><code>playing</code> READ ONLY param. One if the player exists and is currently playing one or more events.</p>
<p><code>player</code> READ ONLY param. The name of the player currently playing. For a follow player, will be the name of the follow player (not the player it's following).</p>
</div>
<h4 onclick="toggleAccordion('accordion-audio-params')" class="accordion"> Audio Params</h4>
<div id="accordion-audio-params" class="closed">
<p><code>add</code> Amount to add onto event scale degree, in degrees. Evaluated per event only.</p>
<p class='sub'><code>add={0,#:1}</code> Sharpen the scale degree (add a given number of semitones)</p>
<p class='sub'><code>add={0,b:1}</code> Flatten the scale degree (subtract a given number of semitones)</p>
<p><code>addc</code> Amount to add onto event pitch, in semitones. Evaluated per frame, and accepts fractional values, so <code>addc=[0:12]e</code> will slide the note from the starting pitch smoothly up a whole octave over the course of the note.</p>
<p><code>oct</code> Octave; middle C is in octave 4</p>
<p><code>envelope</code> Specify the envelope type to use: <code>'full'</code> (ADSR), <code>'simple'</code> (ADR), <code>'organ'</code> (ASR full volume while on like an organ), <code>'pad'</code> (uses a cosine roll on/off so consecutive notes maintain constant volume), <code>'linpad'</code> (uses a linear roll on/off, a better crossfade when the source is identical (including phase) between events), <code>'percussion'</code> (R - instant attack)</p>
<p><code>att</code> Attack time. Default time units: beats.</p>
<p><code>dec</code> Decay time. Default time units: beats.</p>
<p><code>sus</code> Sustain time. Note the 'sustain' in an ADSR envelope sets the sustain level, however this param sets the sustain time. The default is time required after attack and decay to take the note to the end of the duration. Default time units: beats.</p>
<p class='sub'><code>sus={level:1/6}</code> Set the amplitude level for sustain. Note the 'sustain' in an ADSR envelope is the level, so it is this value not the main 'sus' value (which is actually the sustain time). Default: 0.8.</p>
<p><code>rel</code> Release time. Default time units: beats.</p>
<p><code>wave</code> For audio synths that use a waveform, specify which waveform to use, from this list:
<code>sine</code>,
<code>square</code>,
<code>sawtooth</code> (can also use <code>saw</code> for convenience),
<code>triangle</code> (can also use <code>tri</code> for convenience),
<code>pulse</code>,
<code>ah</code>,
<code>bah</code>,
<code>bass</code>,
<code>'bass-amp360'</code>,
<code>'bass-fuzz'</code>,
<code>'bass-fuzz-2'</code>,
<code>'bass-sub-dub'</code>,
<code>'bass-sub-dub-2'</code>,
<code>brass</code>,
<code>'brit-blues'</code>,
<code>'brit-blues-driven'</code>,
<code>buzzy</code>,
<code>'buzzy-2'</code>,
<code>celeste</code>,
<code>'chorus-strings'</code>,
<code>'dissonant-1'</code>,
<code>'dissonant-2'</code>,
<code>'dissonant-piano'</code>,
<code>'dropped-saw'</code>,
<code>'dropped-square'</code>,
<code>'dyna-ep-bright'</code>,
<code>'dyna-ep-med'</code>,
<code>ee</code>,
<code>ethnic</code>,
<code>full</code>,
<code>'full-2'</code>,
<code>'guitar-fuzz'</code>,
<code>harsh</code>,
<code>'mkl-hard'</code>,
<code>noise</code>,
<code>o</code>,
<code>ooh</code>,
<code>organ</code>,
<code>'organ-2'</code>,
<code>piano</code>,
<code>'pop-ahhh'</code>,
<code>pulse</code>,
<code>'putney-wavering'</code>,
<code>tb303</code>,
<code>throaty</code>,
<code>trombone</code>,
<code>'twelve-optines'</code>,
<code>'twelve-string-guitar'</code>,
<code>'warm-saw'</code>,
<code>'warm-square'</code>,
<code>'warm-triangle'</code>,
<code>wurlitzer</code>,
<code>'wurlitzer-2'</code>
Note that values with hyphens must be enclosed in quotes. In addition, there may be a performance problem with using dynamic (per frame) pitch sweeps using these waveforms. This penalty does not apply to the basic waveforms (sine, sawtooth, triangle, square).
</p>
<p><code>detune</code> Amount of detune in semitones</p>
<p><code>lpf</code> Low pass filter frequency. Default time units: Hertz</p>
<p class='sub'><code>lpf={400,q:20}</code> Low pass filter resonance. 10 is approximately the transition where resonance starts to kick in. Default: 5.</p>
<p class='sub'><code>lpf={400,poles:4}</code> Filter poles. Default is a 2 pole filter giving 12 dB/octave. Alternatively, specify 4 for a Moog-like 4 pole filter giving 24 dB/octave.</p>
<p><code>hpf</code> High pass filter frequency. Default time units: Hertz</p>
<p class='sub'><code>hpf={400,q:20}</code> High pass filter resonance. Default: 5.</p>
<p class='sub'><code>hpf={400,poles:4}</code> Filter poles. Default is a 2 pole filter giving 12 dB/octave. Alternatively, specify 4 for a Moog-like 4 pole filter giving 24 dB/octave.</p>
<p><code>bpf</code> Band pass filter frequency. Default time units: Hertz.</p>
<p class='sub'><code>bpf={400,q:20}</code> Band pass filter resonance. Default: 1.</p>
<p class='sub'><code>bpf={400,poles:4}</code> Filter poles. Default is a 2 pole filter giving 12 dB/octave. Alternatively, specify 4 for a Moog-like 4 pole filter giving 24 dB/octave.</p>
<p><code>bpf1</code> Multiple, parallel bandpass filters are available using params <code>bpf1</code>, <code>bpf2</code> etc.</p>
<p><code>nf</code> Notch filter frequency. Default time units: Hertz</p>
<p class='sub'><code>nf={400,q:20}</code> Notch filter resonance. Default: 1.</p>
<p><code>apf1</code> All pass filter frequency. Default time units: Hertz. Multiple allpass filters can be specified with params <code>apf1</code>, <code>apf2</code> etc. They will operate in parallel so their outputs sum, allowing phase cancellation.</p>
<p class='sub'><code>apf={400,q:2}</code> Allpass filter resonance. Default: 1.</p>
<p><code>psf</code> Phaser stage filter consisting of two allpass filters in parallel. Multiple phaserstage filters can be specified with params <code>psf1</code>, <code>psf2</code> etc. The phaserstages will operate in series, allowing more complex phasers to be built up with multiple peaks and troughs in the frequency spectrum. Default units: Hertz</p>
<p class='sub'><code>psf={f1:300,f2:2300,q:0.7}</code> f1 and f2 are the frequencies in Hertz of the two allpass filters. Sweep these dynamically for the swirling phaser effect. q is filter resonance. Default: 1.</p>
<p><code>low</code> Low shelf gain. Eg <code>low=-6dB</code> will act like a gain of 1/2 for the low frequencies. Must specify the value with the <code>dB</code> unit, or use a relative gain value instead.</p>
<p class='sub'><code>low={-8db,freq:400}</code> Low shelf cutoff frequency. Default: 200Hz. Default units: Hertz</p>
<p><code>mid</code> Mid gain. Eg <code>mid=-6dB</code> will act like a gain of 1/2 for the mid frequencies. Must specify the value with the <code>dB</code> unit, or use a relative gain value instead.</p>
<p class='sub'><code>mid={-8db,freq:400}</code> Mid cutoff frequency. Default: 600Hz. Default units: Hertz</p>
<p class='sub'><code>mid={-8db,q:10}</code> Mid q defines the width of the mid frequency band; low q is wide. Default: 5</p>
<p><code>high</code> High shelf gain. Eg <code>high=-6dB</code> will act like a gain of 1/2 for the high frequencies. Must specify the value with the <code>dB</code> unit, or use a relative gain value instead.</p>
<p class='sub'><code>high={-8db,freq:400}</code> High shelf cutoff frequency. Default: 1100Hz. Default units: Hertz</p>
<p><code>chop</code> Apply a tremolo effect that chops the audio signal, eg <code>chop=2cpb</code> chops the signal twice per beat. Default time units: cycles per beat</p>
<p class='sub'><code>chop={2,wave:triangle}</code> chops twice per beat with a triangle waveform. The default waveform is sine; the options are sine, square, triangle, saw.</p>
<p class='sub'><code>chop={4,mix:1/4}</code> Mix subparam controls dry/wet mix. 0 for dry only, 1 for wet only. default: 1</p>
<p><code>ring</code> Apply ring modulation at the given frequency, eg <code>ring=32hz</code> apply ring modulation at 32Hz. Default time units: hz</p>
<p class='sub'><code>ring={32,wave:saw}</code> 32Hz ring modulation with a sawtooth waveform. The default waveform is triangle; the options are sine, square, triangle, saw.</p>
<p class='sub'><code>ring={32,mix:1/4}</code> Mix subparam controls dry/wet mix. 0 for dry only, 1 for wet only. default: 1</p>
<p><code>sample</code> With 'play' synth: number: choose which sample set to use. With 'sample' synth: string: url of online audio file to play (note: server must support cross origin requests for the file)</p>
<p class='sub'><code>sample={32,pitch:261.6}</code> Specify the original pitch of the sample (eg default is 261.6 Hz for C4). Default time units: hz</p>
<p><code>start</code> For the 'sample' synth, specify the playback start time within the sample. Default time units: seconds.</p>
<p><code>compress</code> Compression ratio, or the reduction in volume for signals above the compression threshold. A ratio of zero disables compression.</p>
<p class='sub'><code>compress={12,gain:2}</code> Input gain; gain amp to apply to the signal before compression is applied</p>
<p class='sub'><code>compress={12,threshold:-40dB}</code> Threshold at which the compression ratio kicks in. Default is <code>-50dB</code></p>
<p class='sub'><code>compress={12,knee:10dB}</code> the 'knee' is a softening of the compression curve, so that there is no sudden changeover at the threshold. A value of <code>0dB</code> disables the knee and gives a sudden changeover. Other values are the range over which the knee should apply. Default is <code>40dB</code>.</p>
<p class='sub'><code>compress={12,att:0.1}</code> Compressor attack time. The attack time is the time it takes for compression to 'kick in' once a signal crosses the threshold. Default is 0.01 (or 10ms). Default time units: seconds.</p>
<p class='sub'><code>compress={12,rel:0.2}</code> Compressor release time. The release time is the time it takes for compression to 'go away' once a signal falls back below the threshold. Default is 0.25. Default time units: seconds.</p>
<p><code>noisify</code> noisify: distort the signal into noise</p>
<p class='sub'><code>noisify={12,gain:2}</code> Input gain; gain amp to apply to the signal before noisify is applied</p>
<p class='sub'><code>noisify={1,mix:1/4}</code> Mix subparam controls dry/wet mix. 0 for dry only, 1 for wet only. default: 1</p>
<p><code>fold</code> distort the signal by boosting then folding the overdriven part of the waveform</p>
<p class='sub'><code>fold={12,gain:2}</code> Input gain; gain amp to apply to the signal before fold is applied</p>
<p class='sub'><code>fold={1,mix:1/4}</code> Mix subparam controls dry/wet mix. 0 for dry only, 1 for wet only. default: 1</p>
<p><code>clip</code> boost the signal then apply hard clipping</p>
<p class='sub'><code>clip={12,gain:2}</code> Input gain; gain amp to apply to the signal before clip is applied</p>
<p class='sub'><code>clip={1,mix:1/4}</code> Mix subparam controls dry/wet mix. 0 for dry only, 1 for wet only. default: 1</p>
<p><code>drive</code> overdrive by boosting the signal then applying soft clipping. Low values (eg 1/32, 1/16) give a gentle overdrive. Mid values (eg 1/8, 1/4) give a distortion effect. Higher values (eg 1/2, 1) give a full on fuzz.</p>
<p class='sub'><code>drive={12,gain:2}</code> Input gain; gain amp to apply to the signal before drive is applied</p>
<p class='sub'><code>drive={1,mix:1/4}</code> Mix subparam controls dry/wet mix. 0 for dry only, 1 for wet only. default: 1</p>
<p><code>bits</code> bit crush effect; value is number of bits. 1 bit is very distorted to (eg) 32 bits is relatively clean. 0 disables the effect.</p>
<p class='sub'><code>bits={12,gain:2}</code> Input gain; gain amp to apply to the signal before bits is applied</p>
<p class='sub'><code>bits={1,mix:1/4}</code> Mix subparam controls dry/wet mix. 0 for dry only, 1 for wet only. default: 1</p>
<p><code>suck</code> suck smaller amplitudes even smaller, but leave large amplitudes alone; value is a limit amplitude: when the waveform is within this limit, it is scaled down. This can provide an unusual form of distortion, or for samples with a long tail, can give a 'gated' effect.</p>
<p class='sub'><code>suck={12,gain:2}</code> Input gain; gain amp to apply to the signal before suck is applied</p>
<p class='sub'><code>suck={1,mix:1/4}</code> Mix subparam controls dry/wet mix. 0 for dry only, 1 for wet only. default: 1</p>
<p><code>scale</code> override scale for this player; set to one of these strings:
<code>chromatic</code>,
<code>major</code>,
<code>majorpentatonic</code>,
<code>pentatonic</code>,
<code>penta</code>,
<code>minor</code>,
<code>aeolian</code>,
<code>minorpentatonic</code>,
<code>minorpenta</code>,
<code>mixolydian</code>,
<code>melodicminor</code>,
<code>melodicmajor</code>,
<code>harmonicminor</code>,
<code>harmonicmajor</code>,
<code>dorian</code>,
<code>dorian2</code>,
<code>diminished</code>,
<code>egyptian</code>,
<code>yu</code>,
<code>zhi</code>,
<code>phrygian</code>,
<code>prometheus</code>,
<code>indian</code>,
<code>locrian</code>,
<code>locrianmajor</code>,
<code>lydian</code>,
<code>lydianminor</code>,
<code>hungarianminor</code>,
<code>romanianminor</code>,
<code>chinese</code>,
<code>wholetone</code>,
<code>halfwhole</code>,
<code>wholehalf</code>,
<code>bebopmaj</code>,
<code>bebopdorian</code>,
<code>bebopdom</code>,
<code>bebopmelmin</code>,
<code>blues</code>,
<code>minmaj</code>,
<code>susb9</code>,
<code>lydianaug</code>,
<code>lydiandom</code>,
<code>melmin5th</code>,
<code>halfdim</code>,
<code>altered</code>,
</p>
<p><code>vib</code> vibrato rate. Default time unit: cycles per beat</p>
<p class='sub'><code>vib={2,depth:1}</code> vibrato depth in semitones (default 0.4)</p>
<p class='sub'><code>vib={2,delay:1}</code> delay time before vibrato starts (default 1/2). Default time units: beats</p>
<p><code>glide</code> Glide from one note to the next (portamento). When a note plays with glide set, if there is a previous note playing on the same player in the same voice, then both notes will glide in pitch from the old note's pitch to the new. <code>glide=1/3</code> means it takes 1/3 of a beat to glide from the old note to the new. Default value is 0 (no glide). Default time units: beats.</p>
<p class='sub'><code>glide={1/3,curve:4}</code> glide curve. Zero means no curve, or a linear frequency change. Positive curve means the frequency moves quickly to the target, then slows down as it approaches. Default is 1.</p>
<p><code>pan</code> pan from -1 (left) to 1 (right). default: 0</p>
<p><code>mono</code> Force a signal to mono: the input signal appears equally in both left and right channels</p>
<p><code>choke</code> Set a choke group. Notes played with a choke group will cut off other notes that are already playing if they have the same choke group. The choke group can be a string, and can apply across multiple players.</p>
<p><code>echo</code> Echo time delay. Default time unit: beats.</p>
<p class='sub'><code>echo={1,feedback:0.8}</code> Echo feedback gain, 0 to 1, default 0.35. Higher value means the echo persists for longer.</p>
<p class='sub'><code>echo={1,max:2}</code> Echo max time delay. Only valid for bus echo. The bus echo time can be varied, but cannot be larger than this. Defaults to either 1 beat, or the initial value of the delay time, whichever is larger. Default time unit: beats.</p>
<p><code>chorus</code> Strength of lfo-delay based stereo chorus effect.</p>
<p class='sub'><code>chorus={1,mix:1/4}</code> Mix subparam controls dry/wet mix. 0 for dry only, 1 for wet only. default: 1</p>
<p><code>phaser</code> LFO frequency for phaser phase sweep effect. Default time units: cycles per beat.</p>
<p class='sub'><code>phaser={1/3,mix:1/4}</code> Mix subparam controls dry/wet mix. 0 for dry only, 1 for wet only. default: 1</p>
<p><code>flanger</code> LFO frequency for flanger effect. Default time units: cycles per beat.</p>
<p class='sub'><code>flanger={1/3,mix:1/4}</code> Mix subparam controls dry/wet mix. 0 for dry only, 1 for wet only. default: 1</p>
<p><code>room</code> freeverb room size.</p>
<p class='sub'><code>room={2,hpf:300}</code> HPF subparam Sets the cutoff frequency for a high pass filter placed before the freeverb. 0 disables the highpass filter altogether. default: 0. Default time units: hz</p>
<p class='sub'><code>room={2,mix:1/4}</code> Mix subparam controls dry/wet mix. 0 for dry only, 1 for wet only. default: 1/2</p>
<p><code>reverb</code> Convolution reverb duration. The value is a time in beats that the reverb tail will last for. Default time unit: beats.</p>
<p class='sub'><code>reverb={2,curve:3}</code> Decay curve power of the reverb tail. 1 is a linear decay, larger values make the tail decay faster. default: 5</p>
<p class='sub'><code>reverb={2,hpf:300}</code> HPF subparam Sets the cutoff frequency for a high pass filter placed before the reverb. 0 disables the highpass filter altogether. default: 0. Default time units: hz</p>
<p class='sub'><code>reverb={2,mix:1/4}</code> Mix subparam controls dry/wet mix. 0 for dry only, 1 for wet only. default: 1/2</p>
<p><code>freq</code> READ ONLY param. This param is set by all tonal synths, to the frequency in Hz of the note being played. This value can then be read for other purposes; eg <code>lpf=this.freq*2</code> will set the low pass cutoff frequency to double the note frequency.</p>
<p><code>bus</code> id of the bus that this player should mix to. If the sepcified player does not exist, this player will be silent. If the bus param is not specified, this player will be mixed to the global <code>main</code> bus.</p>
</div>
<h4 onclick="toggleAccordion('accordion-visual-params')" class="accordion"> Visual Params</h4>
<div id="accordion-visual-params" class="closed">
<p><code>add</code> Amount to add onto pattern value</p>
<p><code>zorder</code> order in which to draw visual synths; defaults to the 1/1000th of the source code line number for the player, so that visuals draw strictly in the order they appear in the source code; however, this param can be used to override this and force specific visuals to the front or rear of the draw order.</p>
<p><code>fade</code> brightness/transparent fadeout</p>
<p><code>time</code> time value to use in the shader. If this is set, the <code>rate</code> and <code>sway</code> params have no effect. Default time unit: beats.</p>
<p><code>rate</code> the rate that time should progress in the shader. If the <code>time</code> param is set, this has no effect</p>
<p><code>pulse</code> extent to which the audio signal affects the value passed to visual synths</p>
<p><code>sway</code> extent to which the audio signal affects the time passed to visual synths</p>
<p><code>loc</code> position and size. The visual coordinate system runs from (-1,-1) in the bottom left of the screen to (1,1) in the top right. x and y define the centre of the visual, and w and h are the full width and height; eg <code>{x:0,y:0,w:2,h:2}</code> covers the full screen.</p>
<p><code>window</code> display the only part of the shader image appropriate to the location of the tile on the screen. This way, a tile moved around the screen will act like a window onto the overall shader image.</p>
<p><code>scroll</code> scroll the shader; default: <code>{x:0,y:0}</code></p>
<p><code>repeat</code> repeat a section of the shader image in both directions. Value is the size of the area to be repeated.</p>
<p class='sub'><code>repeat={1/2,x:0.1,y:-0.05}</code> x/y offsets to apply to the area of the shader image being repeated.</p>
<p><code>zoom</code> zoom the shader; default: <code>{x:1,y:1}</code></p>
<p><code>rotate</code> rotate the shader; angle in full rotations so 1/2 is 180 degrees; default: <code>0</code></p>
<p><code>mirror</code> mirror the shader; number of mirror planes to apply; default: <code>0</code></p>
<p class='sub'><code>mirror={10,rotate:1/4}</code> Rotation offset (0-1) to apply to the mirror planes. Defaults to 0.</p>
<p class='sub'><code>mirror={10,fan:1}</code> fan out angle to apply to mirror segments, so each segment is taken from an incrementing portion of the original image. A fan of 1 moves each next segment by the size of one segment. Defaults to 0.</p>
<p><code>fore</code> foreground colour; eg <code>{r:0,g:1,b:0,a:1}</code> for green or <code>#fa0f</code> for orange.</p>
<p><code>mid</code> middleground colour; eg <code>{r:0,g:1,b:0,a:1}</code> for green or <code>#fa0f</code> for orange. If not specified, defaults to midway between fore and back.</p>
<p><code>back</code> background colour; eg <code>{r:0,g:1,b:0,a:1}</code> for green or <code>#00ff</code> for orange.</p>
<p><code>pixellate</code> number of pixels to pixellate to in x direction, or 0 to disable pixellation</p>
<p class='sub'><code>pixellate={10,y:20}</code> number of pixels to pixellate to in y direction, or same as x if not present.</p>
<p><code>perspective</code> perspective warp to apply to shader (negative to invert), or 0 to disable</p>
<p class='sub'><code>perspective={-1,shade:1/2}</code> amount of darkening shade to apply to the part of the image 'in the distance'.</p>
<p><code>tunnel</code> tunnel warp to apply to shader, or 0 to disable. Applies a slitscan type warp, where scrolling in the x direction will scroll the original shader through the tunnel.</p>
<p><code>ripple</code> Apply a ripple warp to the shader, to give the effect of waves of image distortion rippling out from the centre of the shader.</p>
<p class='sub'><code>ripple={1,scale:1/4}</code> scale (size) of ripples. Defaults to 1.</p>
<p><code>additive</code> add this shaders output to those beneath instead of blending</p>
<p><code>blend</code> set the blend mode which defines how this shaders output interacts with the color already present underneath. Possible values: <code>additive subtractive average multiply invert min max</code></p>
<p><code>monochrome</code> make the shader output monochrome; 0 for normal, 1 for monochrome</p>
<p><code>vignette</code> fade out the visual around the edges. The value controls the shape.</p>
<p class='sub'><code>vignette={1/2,aspect:4/3}</code> aspect ratio of vignette effect. Defaults to 1.</p>
<p class='sub'><code>vignette={1,cutoff:0.95}</code> cutoff for vignette; lower values provide a more gradual fade around the edges. Defaults to 0.9.</p>
<p><code>vhs</code> Apply a VHS tape effect, including colour modification, horizontal bars, wobble, and noise.</p>
<p><code>recol</code> recolour the shader. Set to <code>oil</code> for oil film colours, <code>hue</code> for a hue spectrum, <code>fire</code> for a flame effect, <code>sunset</code> for dusk colours, <code>neon</code> for neon megenta and cyan, <code>titanium</code> for titanium anodisation colours</p>
<p><code>contrast</code> apply a power based contrast curve. Default is zero meaning no contrast curve applied.</p>
<p><code>buffer</code> send the output of this synth to a buffer player. For example, <code>buffer=vb</code> makes this synth render to the synth with id <code>vb</code>, which must be a synth of type <code>buffer</code>. The buffer synth can then render itself to the screen to display the output.</p>
<p><code>rez</code> only for a <code>buffer</code> synth: sets the render target resolution scaling. For example, a <code>rez</code> of <code>1</code> will make a render target texture that is identical width and height to the display screen canvas. Default value is 1/2.</p>
<p><code>feedback</code> only for a <code>buffer</code> synth: use video feedback by rednering the buffer onto itself every frame. The subparams control that rendering. Any visual params can be used as <code>feedback</code> subparams. For example <code>feedback={zoom:1.01}</code> will render the feedback slightly zoomed, giving a classic video feedback effect.</p>
</div>
<h4 onclick="toggleAccordion('accordion-main-vars')" class="accordion"> Main Vars</h4>
<div id="accordion-main-vars" class="closed">
<p>Main vars can be set, but not read.</p>
<p><code>bpm</code> Beats per minute. Value resets unless set every time the code is updated.</p>
<p><code>beat.readouts</code> Set the beat counts to use for the readouts; eg <code>beat.readouts=(3,12)</code> will show two beat counters, one that counts in 3's (for a waltz), and another that counts to 12 (for 4 bars of a waltz). There cannot be more than 3 readouts. The default is <code>(12,16,32)</code></p>
<p><code>scale</code> Scale eg minor, major, chromatic, majorpentatonic, lydian etc etc. Value resets unless set every time the code is updated.</p>
<p><code>root</code> Main root pitch offset; default <code>0</code> roots the pitches on middle c; <code>1</code> pitches up by one semitone etc. This is fractional, so can be used to 'nudge' the tuning to match other instruments; eg <code>root=0.135</code> </p>
</div>
<h4 onclick="toggleAccordion('accordion-predefined-vars')" class="accordion"> Predefined Vars</h4>
<div id="accordion-predefined-vars" class="closed">
<p>Predefined vars are predefined values that may be useful as shortcuts when live coding.</p>
<p><code>time</code> Time, counted in beats (including fractions of a beat)</p>
<p><code>drop6_2</code> Predefined time var: equivalent to <code>[1,0]t[6.2]</code>. These are all the predefined drops: drop6_2, drop7_1, drop12_4, drop14_2, drop15_1, drop24_8, drop28_4, drop30_2, drop31_1, drop56_8, drop60_4, drop62_2, drop63_1</p>
<p><code>tile_full</code> For <code>loc</code> visual param. Predefined loc param map to cover the full screen: equivalent to <code>{x:0,y:0,w:1,h:1}</code>. Other predefined locations: tile_tl/tr/bl/br/m, tile_h1/2/3/4/5, tile_v1/2/3/4/5</p>
<p><code>fullscreen</code> For <code>loc</code> visual param. Tile covering the full screen</p>
<p><code>tile_random</code> For <code>loc</code> visual param. Tile in a random location</p>
<p><code>tile_rand</code> For <code>loc</code> visual param. Tile in a random location</p>
<p><code>sparkle</code> For <code>loc</code> visual param. Small tile in a random location</p>
<p><code>droplet</code> For <code>loc</code> visual param. Small tile in a random location, then falling down the screen</p>
<p><code>spark</code> For <code>loc</code> visual param. Small tile flying outwards</p>
<p><code>gravity</code> For <code>loc</code> visual param. Accelrating motion downwards. Best combined with other values; eg <code>spark+gravity</code></p>
<p><code>firefly</code> For <code>loc</code> visual param. Random motion like a flying insect</p>
<p><code>transparent</code> For colour visual params. Predefined colour. Others: black, darkgray, gray, lightgray, white, red, orange, yellow, green, blue, indigo, violet, neonpink, neongreen</p>
<p><code>random</code> For colour visual params. Random colour</p>
<p><code>rainbow</code> For colour visual params. Colour changing through the rainbow</p>
<p><code>wow</code> Predefined time var: Randomly but smoothly varying signal, good for simulating analog 'wow' pitch distortion; eg <code>addc=wow</code></p>
</div>
<h4 onclick="toggleAccordion('accordion-controls')" class="accordion"> Controls</h4>
<div id="accordion-controls" class="closed">
<p><code>slider{}</code> Create a new slider control on the page, which can be used for live control of live coded expressions. The value dynamically updates to reflect the current position of the slider control.</p>
<p class='sub'><code>slider{0.1}</code> Initial value for the slider control when it is first created. Default is 0.</p>
<p class='sub'><code>slider{name:'Foo'}</code> Name to display with the slider. The name uniquely identifies the slider. Multiple <code>slider</code> usages in the source code with the same name will be treated as all referencing the same slider. Default is a name constructed from the player and param names.</p>
<p class='sub'><code>slider{min:-5, max:5}</code> Minimum and maximum values when the slider is at the ends of its travel. Defaults are min:0 max:1.</p>
<p class='sub'><code>slider{curve:2}</code> Curve to apply to the values. Positive values give greater change in value towards the lower end of travel. Default is 0.</p>
</div>
<h4 onclick="toggleAccordion('accordion-functions')" class="accordion"> Functions</h4>
<div id="accordion-functions" class="closed">
<p><code>pitch{1}</code> Calculate a frequency in Hz for a given scale degree.</p>
<p class='sub'><code>pitch{4#}</code> Calculate a frequency in Hz for a given scale degree with sharpening (#) or flattening.</p>
<p class='sub'><code>pitch{0,oct:3}</code> Calculate a frequency in Hz for a given scale degree on a given octave. Default octave is 4.</p>
<p class='sub'><code>pitch{0,scale:minor}</code> Calculate a frequency in Hz for a given scale degree using a given scale. Default scale is the current global var <code>scale</code></p>
<p><code>floor{1.5}</code> Returns the rounded down value (returns 1 in the example)</p>
<p class='sub'><code>floor{1.7,to:1/2}</code> Precision to round to, so the example rounds 1.7 down to the nearest 1/2, which is 1.5. Defaults to 1, which rounds down to the nearest integer below.</p>
<p><code>ceil{1.5}</code> Returns the rounded up value (returns 2 in the example)</p>
<p class='sub'><code>ceil{1.2,to:1/2}</code> Precision to round to, so the example rounds 1.2 up to the nearest 1/2, which is 1.5. Defaults to 1, which rounds up to the nearest integer above.</p>
<p><code>round{1.5}</code> Returns the rounded value (returns 2 in the example)</p>
<p class='sub'><code>round{1.7,to:1/2}</code> Precision to round to, so the example rounds 1.7 to the nearest 1/2, which is 1.5. Defaults to 1, which rounds to the nearest integer.</p>
<p><code>accum{1}</code> Accumulates a value over time. In the example, the result will be 1 after the first beat, 2 after the second etc, 3 after the third etc. Note that negative values are ignored; the accum value will only ever rise over time.</p>
<p><code>smooth{1}</code> Smooths a value over time. In the example, the result will rise towards 1.</p>
<p class='sub'><code>smooth{1,att:4}</code> Smoothing attack rate; higher rate means the value will converge to the target faster when the target is above the current value. Default is 8.</p>
<p class='sub'><code>smooth{1,dec:4}</code> Smoothing decay rate; higher rate means the value will converge to the target faster when the target is below the current value. Default is 4.</p>
<p><code>rate{[0:1]l1@f}</code> Calculate a rate of change of a value over time, in units per beat. In the example, the expression <code>[0:1]l1@f</code> rises from 0 to 1 over the course of the first beat, so the rate will be approximately 1 for the first beat. It then falls so the rate will be approximately -1. The rates will have jitter due to measurement inaccuracies, so it can be useful to <code>smooth{}</code> the result.</p>
<p><code>first{3,1,2}</code> Returns the first argument (3 in the example)</p>
<p><code>last{3,1,2}</code> Returns the last argument (2 in the example)</p>
<p><code>min{3,1,2}</code> Returns the smallest argument (1 in the example)</p>
<p><code>max{3,1,2}</code> Returns the largest argument (3 in the example)</p>
<p><code>count{3,1,2}</code> Returns the number of arguments (3 in the example)</p>
<p><code>sum{3,1,2}</code> Returns the sum of all arguments (6 in the example)</p>
<p><code>avg{3,1,2}</code> Returns the mean average of all arguments (2 in the example)</p>
<p><code>rand{3,1,2}</code> Returns one of the arguments at random</p>
<p><code>euclid{3,from:8}</code> Euclidean rhythm generator. The example will evenly spread 3 events between 8 beats. For example <code>p ping 0, dur=euclid{3,from:8}</code> will make 3 notes of durations 3,2 and 3. Note this uses a Bresenham type algorithm to spread the events, rather than a classic Euclidean algorithm. This it may produce a slightly different ordering ("3 from 8" would give a 3,3,2 pattern in a classic Euclidean algorithm, but the Bresenham gives a 3,2,3 pattern. The offset subparam can be used to 'fix' this.</p>
<p class='sub'><code>euclid{3,from:8,offset:1}</code> Offset rotates the pattern. The example will give a 3,3,2 pattern which is the default 3,2,3 pattern but rotated by one.</p>
<p><code>envelope{}</code> !DEPRECATED: prefer to use eg <code>[0:!200ms, 1:!400ms, 0:!]e</code> instead of <code>envelope{a:200ms,d:400ms}</code>. Return a value that changes over the course of each event like an envelope generator.</p>
<p class='sub'><code>envelope{shape:'lin'}</code> Specify the shaping applied to envelope segments. Valid values 'exp' for an exponential trend to the new value, or 'lin' for linear'. The default is 'exp'.</p>
<p class='sub'><code>envelope{a:1}</code> Attack time for the envelope, with the shaping of 'shape'. Default: time units: beats</p>
<p class='sub'><code>envelope{d:1}</code> Decay time for the envelope, with the shaping of 'shape'. Default: time units: beats</p>
<p><code>rand</code> Returns a pseudo random number between zero and one. Uses time-based hashing to provide consistent values. <code>rand@e</code> will provide a number that is different on each pattern event, but constant within each event. <code>rand{seed:0}</code> sets a specific seed for the randoms. Because the value comes from time-hashing, time based modifiers such as <code>step</code> and <code>per</code> are respected.</p>
<p><code>time</code> Returns the current time in beats. Time modifiers such as <code>step</code> and <code>per</code> are respected.</p>
</div>
<h4 onclick="toggleAccordion('accordion-play-samples')" class="accordion"> Play Samples</h4>
<div id="accordion-play-samples" class="closed">
<p>
<code>a</code> Gameboy hihat<br/>
<code>A</code> Gameboy kick drum<br/>
<code>b</code> Noisy beep<br/>
<code>B</code> Short saw<br/>
<code>c</code> Voice/string<br/>
<code>C</code> Choral<br/>
<code>d</code> Woodblock<br/>
<code>D</code> Dirty snare<br/>
<code>e</code> Electronic Cowbell<br/>
<code>E</code> Ringing percussion<br/>
<code>f</code> Pops<br/>
<code>F</code> Trumpet stabs<br/>
<code>g</code> Ominous<br/>
<code>G</code> Ambient stabs<br/>
<code>h</code> Finger snaps<br/>
<code>H</code> Clap<br/>
<code>i</code> Jungle snare<br/>
<code>I</code> Rock snare<br/>
<code>j</code> Whines<br/>
<code>J</code> Ambient stabs<br/>
<code>k</code> Wood shaker<br/>
<code>K</code> Percussive hits<br/>
<code>l</code> Robot noise<br/>
<code>L</code> Noisy percussive hits<br/>
<code>m</code> 808 toms<br/>
<code>M</code> Acoustic toms<br/>
<code>n</code> Noise<br/>
<code>N</code> Gameboy SFX<br/>
<code>o</code> Snare drum<br/>
<code>O</code> Heavy snare<br/>
<code>p</code> Tabla<br/>
<code>P</code> Tabla long<br/>
<code>q</code> Ambient stabs<br/>
<code>Q</code> Electronic stabs<br/>
<code>r</code> Metal<br/>
<code>R</code> Metallic<br/>
<code>s</code> Shaker<br/>
<code>S</code> Tamborine<br/>
<code>t</code> Rimshot<br/>
<code>T</code> Cowbell<br/>
<code>u</code> Soft snare<br/>
<code>U</code> Misc. Fx<br/>
<code>v</code> Soft kick<br/>
<code>V</code> Hard kick<br/>
<code>w</code> Dub hits<br/>
<code>W</code> Distorted<br/>
<code>x</code> Bass drum<br/>
<code>X</code> Heavy kick<br/>
<code>y</code> Percussive hits<br/>
<code>Y</code> High buzz<br/>
<code>z</code> Scratch<br/>
<code>Z</code> Loud stabs<br/>
<code>-</code> Hi hat closed<br/>
<code>|</code> Hangdrum<br/>
<code>=</code> Hi hat open<br/>
<code>/</code> Reverse sounds<br/>
<code>*</code> Clap<br/>
<code>\</code> Lazer<br/>
<code>~</code> Ride cymbal<br/>
<code>%</code> Noise bursts<br/>
<code>$</code> Beatbox<br/>
<code>#</code> Crash<br/>
<code>!</code> Yeah!<br/>
<code>+</code> Clicks<br/>
<code>&</code> Chime<br/>
<code>@</code> Gameboy noise<br/>
<code>:</code> Hi-hats<br/>
<code>1</code> Vocals (One)<br/>
<code>2</code> Vocals (Two)<br/>
<code>3</code> Vocals (Three)<br/>