jevstrudel.git / docs / iclc2023-paper / paper-preprocessed.md
1---
2date: 2022-03-22
3references:
4- abstract: In this artist statement, I will discuss the tension between
5    source code as an interactive system for performers and source code
6    as information and entertainment for audiences in live-coding
7    performances. I then describe augmentations I developed for the
8    presentation of source code in the live-coding environment Gibber,
9    including animations and annotations that visually reveal aspects of
10    system state during performances. I briefly describe audience
11    responses to these techniques and, more importantly, how they are
12    critical to my own artistic practice.
13  accessed:
14    date-parts:
15    - - 2022
16      - 3
17      - 24
18  author:
19  - family: Roberts
20    given: Charles
21  container-title: International Journal of Performance Arts and Digital
22    Media
23  DOI: 10.1080/14794713.2016.1227602
24  id: "https://www.tandfonline.com/doi/abs/10.1080/14794713.2016.1227602?journalCode_x61_rpdm20"
25  ISSN: 1479-4713
26  issue: 2
27  issued:
28    date-parts:
29    - - 2016
30      - 7
31  keyword: Live coding, psychology of programming, notation, audiences,
32    algorithms
33  page: 201-206
34  title: Code as information and code as spectacle
35  type: article-journal
36  URL: "https://doi.org/10.1080/14794713.2016.1227602"
37  volume: 12
38- abstract: The TidalCycles (or Tidal for short) live coding environment
39    has been developed since around 2009, via several rewrites of its
40    core representation. Rather than having fixed goals, this
41    development has been guided by use, motivated by the open aim to
42    make music. This development process can be seen as a long-form
43    improvisation, with insights into the nature of Tidal gained through
44    the process of writing it, feeding back to guide the next steps of
45    development. This brings the worrying thought that key insights will
46    have been missed along this development journey, that would
47    otherwise have lead to very different software. Indeed participants
48    at beginners' workshops that I have lead or co-lead have often asked
49    questions without good answers, because they made deficiencies or
50    missing features in the software clear. It is well known that a
51    beginner's mind is able to see much that an expert has become blind
52    to. Running workshops are an excellent way to find new development
53    ideas, but the present paper explores a different technique -- the
54    rewrite.
55  accessed:
56    date-parts:
57    - - 2022
58      - 3
59      - 24
60  id: "https://zenodo.org/record/5788732"
61  issued:
62    date-parts:
63    - - 2021
64      - 12
65  keyword: live coding, algorithmic pattern, tidalcycles, haskell,
66    python
67  publisher-place: Valdivia, Chile
68  title: Alternate Timelines for TidalCycles
69  URL: "https://zenodo.org/record/5788732"
70- abstract: A JavaScript dialect of its mini-notation for pattern is
71    created, enabling easy integration with creative coding tools and an
72    accompanying technique for visually annotating the playback of
73    TidalCycles patterns over time. TidalCycles has rapidly become the
74    most popular system for many styles of live coding performance, in
75    particular Algoraves. We created a JavaScript dialect of its
76    mini-notation for pattern, enabling easy integration with creative
77    coding tools. Our research pairs a formalism describing the
78    mini-notation with a small JavaScript library for generating events
79    over time; this library is suitable for generating events inside of
80    an AudioWorkletProcessor thread and for assisting with scheduling in
81    JavaScript environments more generally. We describe integrating the
82    library into the two live coding systems, Gibber and Hydra, and
83    discuss an accompanying technique for visually annotating the
84    playback of TidalCycles patterns over time.
85  accessed:
86    date-parts:
87    - - 2022
88      - 4
89      - 12
90  author:
91  - family: Roberts
92    given: Charles
93  container-title: www.semanticscholar.org
94  id: "https://www.semanticscholar.org/paper/Bringing-the-TidalCycles-Mini-Notation-to-the-Roberts/74965efadd572ae3f40d14c633a5c8581c1b9f42"
95  issued:
96    date-parts:
97    - - 2019
98  title: Bringing the TidalCycles Mini-Notation to the Browser
99  URL: "https://www.semanticscholar.org/paper/Bringing-the-TidalCycles-Mini-Notation-to-the-Roberts/74965efadd572ae3f40d14c633a5c8581c1b9f42"
100title: Strudel
101url2cite: all-links
102---
103
104# Introduction
105
106This paper introduces Strudel, an alternative implementation of the
107TidalCycles live coding system, using the JavaScript programming
108language.
109
110# Background
111
112General motivations / related work. Reference vortex paper and summarise
113its background.
114
115The reimplementation of TidalCycles in Python (cite TidalVortex) showed
116that it is possible to translate pure functional reactive programming
117ideas to a multi paradigm language. It proved to be a stepping stone to
118move to other multi-paradigm languages, like JavaScript. A significant
119part of of the Python codebase could be ported to JavaScript by
120syntactical adjustments.
121
122# Introducing TidalStrudel
123
124(do we want to call it TidalStrudel once, and Strudel for short from
125then on as with vortex? Or just stick with Strudel? Should we start
126calling TidalCycles just Cycles?? froos: I think TidalStrudel sounds a
127bit weird, but we can stick to the TidalX naming scheme if that's
128important. For me, StrudelCycles sounds better, because it has 3/4
129phonems in common with TidalCycles)
130
131-   Motivating musical example
132
133# Tidal patterns
134
135(should we explain shortly what tidal patterns do in general here?)
136
137The essence of TidalCycles are Patterns. Patterns are abstract entities
138that represent flows of time. Taking a time span as its input, a Pattern
139can output a set of events that happen within that time span. It depends
140on the structure of the Pattern where the events are placed. From now
141on, this process of generating events from a time span will be called
142**querying**. Example:
143
144<MiniRepl tune={`const pattern = sequence(c3, [e3, g3]);
145const events = pattern.query(0, 1);
146console.log(events.map(e => e.show()))`} />
147
148In this example, we create a pattern using the `sequence` function and
149**query** it for the timespan from `0` to `1`. Those numbers represent
150units of time called **cycles**. The length of one cycle defaults to one
151second, but could be any number of seconds. The console output looks
152like this:
153
154<MiniRepl tune={`(0   -> 1/2 c3)
155(1/2 -> 3/4 e3)
156(3/2 -> 1   g3)`} />
157
158In this output, each line represents one event. The two fractions
159represent the begin and end time of the event, followed by its value. In
160this case, the events are placed in sequential order, where c3 takes the
161first half, and e3 and g3 together take the second half. This temporal
162placement is the result of the `sequence` function, which divides its
163arguments equally over one cycle. If an argument is an array, the same
164rule applies to that part of the sequence. In our example e3 and g3 are
165divided equally over the second half of the whole sequence.
166
167# Mini Notation
168
169In this example, the Pattern is created using the `mini` function, which
170parses Tidal's Mini Notation. The Mini Notation is a Domain Specific
171Language (DSL) that allows expressing rhythms in a short mannger.
172
173-   Some comparisons of -Strudel with -Vortex and -Cycles code?
174
175(the following examples are from vortex paper, with added js versions)
176
177## 1
178
179<MiniRepl tune={`sound "bd ~ [sd cp]"`} />
180<MiniRepl tune={`sound("bd", silence, ["sd", "cp"])`} />
181<MiniRepl tune={`sound("bd ~ [sd cp]")`} />
182
183without mini notation:
184
185<MiniRepl tune={`sound $ cat
186   [pure "bd", silence,
187    cat(pure "sd", pure "cp")]`} />
188<MiniRepl tune={`sound('bd', silence, cat('sd', 'cp'))`} />
189
190## 2
191
192<MiniRepl tune={`sound "bd ~ <sd cp>"`} />
193<MiniRepl tune={`sound("bd", silence, slowcat("sd", "cp"))`} />
194<MiniRepl tune={`sound("bd ~ <sd cp>")
195// sound('bd', silence, slowcat('sd', 'cp'))`} />
196
197## 3
198
199<MiniRepl tune={`sound "bd {cp sd, lt mt ht}"`} />
200<MiniRepl tune={`sound("bd", pm(["cp", "sd"], ["lt", "mt", "ht"]))`} />
201<MiniRepl tune={`?`} />
202
203## 4
204
205<MiniRepl tune={`sound "bd {cp sd, [lt mt,bd bd bd] ht}"`} />
206<MiniRepl tune={` sound("bd", pm(["cp", "sd"],
207 [pr(["lt", "mt"],
208 ["bd", "bd", "bd"]
209 ),
210 "ht" ]))`} />
211<MiniRepl tune={`??`} />
212
213## 5
214
215<MiniRepl tune={`sound "bd sd cp" # speed "1 2"`} />
216<MiniRepl tune={`sound("bd", "sd", "cp") >> speed (1, 2)`} />
217<MiniRepl tune={`sound("bd sd cp").speed("1 2")`} />
218
219(operator overloading like in vortex?)
220
221## 6
222
223<MiniRepl tune={`rev $ sound "bd sd"`} />
224<MiniRepl tune={`rev(sound("bd", "sd"))
225sound("bd", "sd").rev()`} />
226<MiniRepl tune={`rev(sound("bd sd"))
227sound("bd sd").rev()`} />
228
229## 7
230
231<MiniRepl tune={`jux rev $ every 3 (fast 2) $ sound "bd sd"`} />
232<MiniRepl tune={`jux(rev, every(3, fast(2), sound("bd", "sd")))
233sound("bd","sd").every(3, fast(2)).jux(rev)`} />
234<MiniRepl tune={`jux(rev, every(3, fast(2), sound("bd sd")))
235sound("bd sd").every(3, fast(2)).jux(rev)`} />
236
237(partial application)
238
239## 8
240
241<MiniRepl tune={`n ("1 2 3" + "4 5") # sound "drum"`} />
242<MiniRepl tune={`n (sequence(1,2,3) + sequence(4,5)) >> sound "drum"`} />
243<MiniRepl tune={`n("1 2 3".add("4 5")).sound("drum")
244n("5 [6 7] 8").sound("drum")`} />
245
246(operator overloading?)
247
248## 9
249
250<MiniRepl tune={`speed("1 2 3" + sine)`} />
251<MiniRepl tune={`speed(sequence(1,2,3) + sine)`} />
252<MiniRepl tune={`speed("1 2 3".add(sine))
253"c3*4".add(sine.mul(12).slow(8)).pianoroll()`} />
254
255## 10
256
257-   Mininotation
258
259# Strudel/web specifics
260
261Some discussion about whether strudel is really a port of TidalCycles,
262or whether javascript affordances mean it's going its own way..
263
264-   Recursive Scheduling: "calling itself in the future"
265-   Optimizing Syntax for minimal keystrokes / readability: "AST
266    Hacking" via shift-ast pseudo variables
267    -   Handling mininotation - double quoted and template strings to
268        mini calls
269    -   Operator overloading
270-   Fixing inconsistencies (e.g. with stut/echo) adding source locations
271-   Dynamic HUD: Highlighting + drawing
272-   Translation of Tidal concepts to Javascript - different constraints,
273    affordances, aesthetics
274-   Dynamic Harmonic Programming?
275-   emulating musician thought patterns
276-   microtonal features? webserial
277
278## User Code Transpilation
279
280(compare user input vs shifted output)
281
282### double quotes -\> mini calls
283
284<MiniRepl tune={`"c3 e3" // or `c3 e3``} />
285<MiniRepl tune={`mini("c3 e3")`} />
286
287### operator overloading
288
289<MiniRepl tune={`cat(c3, e3) * 4`} />
290<MiniRepl tune={`reify(cat("c3","e3")).fast(4)`} />
291
292(reify is redundant here, the shapeshifter could have an additional
293check...)
294
295(TBD: ability to multiply mini notation strings)
296
297### pseudo variables
298
299<MiniRepl tune={`cat(c3, r, e3)`} />
300<MiniRepl tune={`cat("c3",silence,"e3")`} />
301
302### locations
303
304<MiniRepl tune={`cat(c3, e3)`} />
305<MiniRepl tune={`cat(
306  reify("c3").withLocation([1,4,4],[1,6,6]),
307  reify("e3").withLocation([1,8,8],[1,10,10])
308)`} />
309<MiniRepl tune={`mini("c3 e3")`} />
310
311with locations:
312
313<MiniRepl tune={`// "c3 e3"
314mini("c3 e3").withMiniLocation([1,0,0],[1,7,7])`} />
315
316(talk about mini adding locations of mini notation parser)
317
318### top level await
319
320<MiniRepl tune={`const p = (await piano()).toDestination()
321cat(c3).tone(p)`} />
322<MiniRepl tune={`(async()=>{
323  const p = (await piano()).toDestination();
324  return cat("c3").tone(p);
325})()`} />
326
327# Musical examples
328
329...
330
331# Ongoing work/future aims
332
333-   WASM Sound Backend
334-   OSC -\> Supercollider
335-   mininotation as the 'regex' of metre
336
337That
338@https://www.tandfonline.com/doi/abs/10.1080/14794713.2016.1227602?journalCode_x61_rpdm20
339are excellent, I reference their work at least twice per sentence
340[@https://www.tandfonline.com/doi/abs/10.1080/14794713.2016.1227602?journalCode_x61_rpdm20,
341p. 3]. Another reference [@https://zenodo.org/record/5788732].
342
343<MiniRepl tune={`"1 2 3"`} />
344
345# References
346
347-   gibber
348-   krill
349-   glicol